Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

share|improve this question

3 Answers 3

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

share|improve this answer

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.

share|improve this answer
    
Best. Analogy. Ever. –  Mark Henderson Oct 25 '10 at 21:48

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.