Mojology is a simple application to browse syslog messages stored in a MongoDB store, as logged by syslog-ng, using the mongodb destination driver.
For the curious, there is a demo available with a small set of log data.
- Easy installation & configuration
- A neat & lean web interface to browse logs
- Built upon solid foundations: Flask, PyMongo, and HTML5 & AJAX - and degrades gracefully (usable even with lynx!)
The easiest way to install the application is to make use of virtualenv and pip - though, if one's distribution of choice has the appropriate packages available, and globally installed, that works just aswell. One will also need a recent version of the mongodb destination driver.
$ git clone git://github.com/algernon/mojology.git $ virtualenv --no-site-packages mojology $ cd mojology $ . bin/activate $ pip install -r requirements.txt $ python server.py
This will start up the server with the default settings, and expects that the database and collection are ready to be browsed.
On how to set up syslog-ng to create appropriate entries within our collection, see the next section!
Though one can customize the database layout to some extent, how to do that is out of the scope of this small document. Instead, we'll have a look at how to set up syslog-ng to produce documents with which mojology can work with.
By default, we only need a simple change: the DATE key must be a $UNIXTIME macro. Apart from this, mojology does not make many more assumptions, and by default, uses the same keys for the various bits of information (host, program, message, etc) that syslog-ng uses by default.
Thus, in order to get all the information mojology needs, along with every discovered (by patterndb or similar) key, one could use the following destination definition:
destination d_mongo { mongodb( value-pairs( scope(selected_macros nv_pairs) exclude("R_*") exclude("S_*") exclude("HOST_FROM") exclude("LEGACY_MSGHDR") exclude("MSG") pair("DATE" "$UNIXTIME") ) ); };
Sprinkle the log block with some patterndb or other parser magic, and you're good to go!
If one wants to configure mojology itself, the best course of action is to copy the mojology/default_settings.py file to the root directory, along with server.py, and change values therein.
Alternatively, setting the MOJOLOGY_SETTINGS environment variable to the path of the desired configuration file will work just as well.
mojology is built upon free software, and is itself free aswell, released under the GNU GPL (version 3 or later).
The source code is available from github.