?
Solved

Logging and summarizing squid usage

Posted on 1999-10-25
2
Medium Priority
?
278 Views
Last Modified: 2010-04-22
I need to create a monthly summary of the web usage of a particular IP through our proxy server.
We are using squid, but do not wish to log the entire month's usage for our entire customer base!
My current plan is to run tail -f /usr/local/squid/logs/access.log |grep <ip> >> /usr/local/squid/logs/access.ip.log
 constantly in the background and have a cron job that will take this log, and run calamari on it monthly to generate
the report. This does not seem too elegant, but with limited C and Perl knowledge, can anyone reccomend a better way?
0
Comment
Question by:apophis
2 Comments
 
LVL 1

Expert Comment

by:jacekf
ID: 2158080
Maybe you should use tcpdump. For example
tcpdump ip src <ip_number> >> access.ip.log
0
 

Accepted Solution

by:
LarsG earned 140 total points
ID: 2174692
Tcpdump won't cut it unless you enjoy really large dumps of network traffic.

Many distributions come with log rotation. If you have a RedHat install, you'll have a file called /etc/logrotate.d/squid. If you have a different distribution, look through the crontab(s) and see if you can find a reference to logrotate.

Make a script that greps the log for the appropriate ip address and pipe the result to calamari. Then add the following lines to the squid logrotate configuration file (/etc/logrotate.d/squid or similar):

prerotate
  your_script
end

I don't have the man page for logrotate here at the moment, so I'm not 100% sure about the syntax.
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Often times it's very very easy to extend a volume on a Linux instance in AWS, but impossible to shrink it. I wanted to contribute to the experts-exchange community a way of providing a procedure that works on an AWS instance. It can also be used on…
Can you run Linux on a Windows system?  Yep.  Here's how.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses

601 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question