title: Squid logs on mongodb
body: <p>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:</p>
  
  <pre><code>{month: 'april', users: [{user: 'loop0', logs: [{timestamp: 12345678.9, url: 'http://stackoverflow.com/question/ask', ... }]}]
  </code></pre>
  
  <p>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.</p>
  
  <p>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?</p>
  
  <p>Nowadays we have around 12 million lines of log by day.</p>