Clog is a centralized logging system.
This is the server-side implementation. Clients are available for Python and JavaScript.
The server is able to receive logging data via an HTTP JSON API, and display it on its web dashboard. The logs themselves are stored in a local SQLite database.
If it wasn't obvious so far, this is a toy project and is not meant for production use at all. Use a proper logging system like Sentry, New Relic, ELK, etc. instead.
$ git clone https://github.com/imiric/clog-server.git
# Optionally: pyvenv venv && source venv/bin/activate
$ python setup.py develop
-
Create the SQLite DB and schema:
$ python -m clog.models.log
-
Start the server with:
python manage.py runserver
It will be listening on
localhost:5000
, by default.
To insert some log data, use one of the above-mentioned clients, or simply use
curl(1)
:
$ curl -H 'Content-Type: application/json' \
-d '{"log": {"data": "Some test exception"}, "source": "my-test-app"}' \
localhost:5000/api/v1/logs/
You should get an HTTP 201 response back with the created log data in the response body.
The logs can be viewed in the web dashboard, which requires some additional setup.
- Install Node.js w/ npm.
- Install frontend dependencies:
$ cd clog/web && npm install
- Compile frontend assets:
$ npm run build
Finally, load http://localhost:5000
in your web browser to access the
dashboard.
The configuration is statically defined in config.py
and can be switched by
setting the CLOG_ENV
environment variable.
For example:
$ CLOG_ENV=prod python manage.py runserver
By default, the dev
configuration is used.
Install tox and run:
$ tox