https://github.com/bard/logagent-output-http-sse
An HTTP server-side events plugin for logagent
https://github.com/bard/logagent-output-http-sse
Last synced: 8 days ago
JSON representation
An HTTP server-side events plugin for logagent
- Host: GitHub
- URL: https://github.com/bard/logagent-output-http-sse
- Owner: bard
- Created: 2018-09-11T10:41:26.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-01-05T18:27:43.000Z (over 7 years ago)
- Last Synced: 2026-03-11T15:50:49.303Z (4 months ago)
- Language: JavaScript
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
An HTTP server-side events plugin for [logagent](https://github.com/sematext/logagent-js). Can be used for e.g. writing a custom web log live tail UI.
## Installation
On the machine where you're running logagent:
```
npm install -g logagent-output-http-sse
```
## Configuration
In logagent's `config.yml` output section, add:
```
output:
http-sse:
module: logagent-output-http-sse
port: 80
```
Adjust port as needed. If omitted, it will listen on 3000.
## Usage
Assuming logagent is running on `log.example.com`, the following will stream all log events to the browser console:
```
const eventSource = new EventSource('http://log.example.com/events')
eventSource.onmessage = (event) => {
console.log(event.data)
}
```
To request events from certain sources only, use a "source" query parameter with an [extglob](https://www.npmjs.com/package/extglob) pattern value.
For example, to only request events from sources beginning with "myapp_":
```
const eventSource = new EventSource('http://log.example.com/events?source=myapp_*')
```
## Security
There is no authorization or encryption, please use a reverse proxy to provide those if running on an untrusted network.