Squid logs on mongodb

Posted by user306241 on Stack Overflow See other posts from Stack Overflow or by user306241
Published on 2010-04-25T15:37:28Z Indexed on 2010/04/25 15:43 UTC
Read the original article Hit count: 146

Filed under:
|
|

Hi, I'm planning to log my squid instances to a mongodb, but the actual problem is that we have a huge traffic to be logged, every access authenticated with user/pass. Eventually we have to make some reports based on logs. I was thinking to insert the logs distributed by months and by users, so my collection will look like this:

{month: 'april', users: [{user: 'loop0', logs: [{timestamp: 12345678.9, url: 'http://stackoverflow.com/question/ask', ... }]}]

So if I want to generate my reports based on the month of april I just have to get the right month instead of looking in zillions of lines to fetch the lines that timestamp match between April, 1 and April, 30.

Of course this type of insert will be slower than just insert the log line directly. So my question is: is there a best way to do this?

Nowadays we have around 12 million lines of log by day.

© Stack Overflow or respective owner

Related posts about squid

Related posts about mongodb