views:

270

answers:

2

I'm looking for a flexible event logging platform to store both pre-defined (username, ip address) and non-pre-defined (can be generated as needed by any piece of code) events for Django. I'm currently doing some of this with log files, but it ends up requiring various analysis scripts and ends up in a DB anyway, so I'm considering throwing it immediately into a nosql store such as MongoDB or Redis.

The idea is to be easily able to query, for example, which ip address the user most commonly comes from, whether the user has ever performed some action, lookup the outcome for a specific event, etc.

Is there something that already does this?

If not, I'm thinking of this:

The "event" is a dictionary attached to the request object. Middleware fills in various pieces (username, ip, sql timing), code fills in the rest as needed.

After the request is served a post-request hook drops the event into mongodb/redis, normalizing various fields (eg. incrementing the username:ip address counter) and dropping the rest in as is.

Words of wisdom / pointers to code that does some/all of this would be appreciated.

+1  A: 

I'm not sure if a library exists that does exactly what you're looking for with a NoSQL DB. However, a MongoDB backend was just released and it appears to work with Django's ORM (in a limited fashion).

Here's the link.

Perhaps you could use this with an existing logging system that utilizes Django's built-in ORM? I hope this helps, if only a little.

Eric Palakovich Carr
A: 

The mongodb-log project can probably be used as a foundation for what you want to do.

Van Gale