Introduction

This will describe how to get all of the Squid access logs into mysql so you can run whatever reports you want off of them. I don't have time to really write this out nicely right now. But I plan to in the future. So far I just have a basic outline and it'll take a bucket of smarts and common sense to get something to work out of this. I do now have the script up for download which is really the key piece. There's 2-3 other ways of doing this and I plan to mention those as well. Perhaps once I'm done with my IPSEC howto I can get to this. If you have questions I'm generally willing to help, http://sqls.net/contact

Squid.conf

Find the log section of you squid file and add/change these lines:

logformat custom %{%Y-%m-%d %H:%M:%S}tl %03tu %>a %>A %<A %la %lp %tr %{Referer}>h %{User-Agent}>h %{Server}<h %un %ul %ui %Hs %mt %rm %ru %rv %<st %Sh %Ss cache_access_log /var/log/squid/access.log custom

You could use any format you want honestly. But this is what I am using.

Create mysql DB for Squid

Yea, sure.. someday I'll export the schema. Meanwhile you'll have to look at the script and build an appropriate DB for it.

squid2mysql.pl

Download http://sqls.net/files/squid2mysql.pl and install it to /opt/squid2mysql

Gentoo init.d Script

Download http://sqls.net/files/squid2mysql and copy it to /etc/init.d

Set it to run at boot

# rc-update add squid2mysql default

Restart/start Squid

/etc/init.d/squid restart

Start Squid2MySQL

/etc/init.d/squid2mysql start

 
howto/log_squid_to_mysql.txt · Last modified: 2012/01/05 16:45 by bruce
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki