2

Is there a way to export the contents of access.log to excel spreadsheet so as to manipulate the data from there?

3 Answers 3

2

The squid native log format is :

time elapsed remotehost code/status bytes method URL rfc931 peerstatus/peerhost type

In the fact, you can develop a simple parser using awk or maybe with perl or python, ... and delimit the data with a delimiter of your choice to get a CSV file. Somethink like this:

 awk '{ print $1","$2","$3","$4","$5","$6","$7","$8","$9","10 }' /var/log/squid/access.log
For more information, please find here a small squid log viewer using python. http://github.com/mezgani/sqview

0

Easy enough with Perl, which has modules for working with Excel, but wouldn't a database be a more appropriate tool? Excel really seems like the wrong tool for this job. Sort of like using a lawnmower to pick flowers. Sure it will work but there are better ways.

1
0

Yeah, Excel can read CSV files, so your best bet would be to alter the log format such that it's comma separated (or perhaps some other delineation token). You can then open your CSV-formatted Squid log using Excel.

See: http://wiki.squid-cache.org/Features/LogFormat

Alternatively, if you don't care to alter the format, you can toss a script together to reformat to include the fields you need.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .