Version: 0.2.2
Simplelogs is [RESTful] rest API logging system written in Python. It based on [MongoDB] mongo and [Flask Framework] flask.
For start Simplelogs use:
python app.py
For testing sending log message you can use curl.
- [MongoDB] mongo
- [Flask Framework] flask
- PyMongo pymongo
- PyYAML pyyaml
- Flask-WTF Flask-WTF
- [Any web-server with WSGI support] deploying
app/config.yaml - configuration file. Config file is in YAML-format.
It has 2 section: mongo and levels.
Mongo section describes base information about connection:
- host - hostname
- port - connection port
- user - not yet supported
- password not yet supported
- database - which database will be used
- collection - which collection in database will be used
Level section describes logenty levels. By default it includes:
- Critical – for errors that lead to termination
- Error – for errors that occur, but are handled
- Warning – for exceptional circumstances that might not be errors
- Notice – for non-error messages you usually want to see
- Info – for messages you usually don’t want to see
- Debug – for debug messages
You can add, remove or modify any of level you want. You don't need to restart server after it.
Log-entry is a collection of 3 required and 2 non-required entries:
- level (Required) - only text. Shoud be specified in app/config.yaml
- datetimestamp - current datetime stamp. You don't need to send it. Server will do it automaticly.
- owner (Required) - text or dict (hash-table, key-value storage). Dict can include arrays. (MAX 7 MB)
- data (Required) - text or dict (hash-table, key-value storage). Dict can include arrays. (MAX 7 MB)
- tags - list (array) only.
Method | URI | Description |
GET | http://host/api/ | Get server status. |
GET | http://host/api/level/ | Get avaliable log entry levels. |
POST | http://host/api/entry/ | Create new log entry. |
0.2.2:
- Supporting datetime search parameter instead of date type,
- Added 'skip' parameter for possibility of pagination realization.
0.2.1:
- Modernizations getting data methods;
- Supporting more various search parameters.
0.2.0:
- New methods for getting data;
- Some refactoring.
0.1.4:
- Full test coverage;
- Supporting username and password for remote connection to MongoDB-server. [Setting up authentication for MongoDB on Ubuntu with pymongo example.] mongodb-remote-access
0.1.3:
- New method for creating entries. Now it understand only application/json content-type headers.
0.1.2:
- New call get avaliable log entry levels (GET http://host/api/level/).
- helpers.config - wrapper for config file. It returns dict with full configurations.
- connectors.connect - static method. It returns MongoDB db-object.
For run unittests use:
python -m unittest tests
in project-root directory.