jilo
Logging server
Install
$ npm install -g jilo-server
Setup
Create a capped collection in Mongo:
> db.createCollection('log', { capped: true, size: 100000 })
For more info, see the MongoDB documentation.
Start the server:
$ jilo-server --key=secret [options]
All clients must connect to the server using the token secret
.
By default the server will start on port 3000 and connect to a database named jilo
on localhost.
API
GET /
:
Query the server curl 'http://localhost:3000/?token=secret&query=%7B%22format%22:%22string%22%7D'
Possible query params:
- query
- filter
- sort
- skip
- limit
The server will stream log entries to the client as they are logged (kind of like the lovely tail -f
).
Note: If you use either sort
or limit
streaming will be disabled for obvious reasons.
POST /
:
Send a log entry to the server curl -i \
-X POST \
-d '{"host":"localhost","data":"foo","format":"string"}' \
'http://localhost:3000/?token=secret'
JSON format
Example:
format: 'json' timestamp: '2013-01-01T00:00:00.000Z' id: 123 level: 'info' user: 123 host: 'example.com' group: 'web' responseTime: 23 version: '1.7.1' data: foo: 'bar'
Debug
DEBUG=jilo-server node cli.js --key=secret