squeezer2.pl is a rewrite of
squeezer.pl by
Maciej Kozinski.
The original can be found at
http://maciej_kozinski.webpark.pl/squeezer.html
I also have a local copy of
an old version of his page.
The script is currently at 0.8. Licensing is an issue I am currently addressing, I would release this under the BSD license, but unfortunately the original script that I took parts from was licensed GPL so I expect this script needs to be licensed GPL as well. Until further notice, the code is GPLv2.
I really liked M.K.'s script, but I wanted more information that I couldn't get from it. I needed the perl practice anyway and here is my rewrite.
If you don't already know, squid is an open source web-caching server that runs on almost any OS. Their web site for more information is http://www.squid-cache.org.
The idea for this came from Maciej's script, although I rewrote most of it and shamelessly stole bits and pieces of his script to use. Any errors in this version are totally my mistake and should be reported to me. However I don't guarantee that it will work correctly, so if it is completely screwed up and crashes your computer or starts a global thermonuclear war, I take no responsibility.
I tried to write it so that it doesn't require any additional modules so that it could run more easily from a chrooted apache if you so choose. I will someday hopefully put back the feature where it will run from the web server and generate the reports on the fly. Although for me that doesn't work well as my logs are generally 200 megs a day and it takes quite a while to generate the report so I just have it run from cron (actually as a part of /etc/daily on my OpenBSD box) Then I run it and generate current reports from the command line if I need to.
Here are the lines I have in my /etc/daily. It generates a daily report and then a report of all the logs that I have (generally 7 days of logs).
echo "" echo "Rotating squid logs" "/usr/local/sbin/squid -k rotate echo "" echo "Generating squid usage reports" "/usr/local/bin/squeezer2.pl /var/squid/logs/access.log.0 >/var/www/htdocs/squeezer/SQ`date +%Y%m%d`.html /usr/local/bin/squeezer2.pl >/var/www/htdocs/squeezer/all.html
You can download the script from here along with examples of the reporting that it does.
These are some example reports with different amount of reporting turned on. They all processed the same ~ 1.2 gig's (about 5 million lines) of logs which were about 7 days worth for me. Unfortunately, these reports were all generated with an old version of the script so the actual output, while the numbers should be the same, looks slightly different.
Thanks for stopping by, I hope you are able to use this script to tune your squid installation!
If you have any questions or comments, I can be reached by e-mail, andrew fresh andrew at afresh1.com