Friday, January 11, 2013

Fun with Squid and Python

Viewing images that users of squid have been viewing.

The goal of this is to have some fun with your squid server using a python script.
the idea is you have an access log which contains all your logs from squid.
This is usually located at
/var/log/squid/access.log
*may differ on different OS's*

this contains a list of URLS that have been visited and by which IP Address.

This script goes through this access.log and creates an html file which contains images from the access log.

Code:

http://code.google.com/p/squidimage

Click Here  to download src code.

Download the Source code from above.

Simply run by 
python main.py -i /var/log/squid/access.log -o output.html
You can have a more advanced scoped output
python main.py -i /var/log/squid/access.log -o output.html -x <amount> -a <ip>
Full Example
python main.py -i /var/log/squid/access.log -o output.html -x 200 -a 10.0.0.140
More?
python main.py -h


Output Example:


Now, you can what images people have been looking at.

UPDATE:
The next version of squidimage you will be able to provide a min size of images to load into the HTML file.

No comments:

Post a Comment