Converting Log File Date/Time
- Technology:
- Linux,
- squid,
- date,
- time,
- conversion
The time in the logfiles in for squid are impossible to figure out. They are in epoch time. To convert the times in the log to an understandable format you can use a script. I found this on the squid users mailing list...
http://www.squid-cache.org/mail-archive/squid-users/200608/0043.html
Save the two lines in that message to a file somewhere and make it executable...
#!/bin/sh
perl -p -e 's/^([0-9]*)/"[".localtime($1)."]"/e'
chmod 755 squidtime.sh
First you should get the information you are looking for into a file like this...
cat /var/log/squid/access.log | grep -i "whatIamLookingFor" >whatIamLookingFor.log
Then...
cat whatIamLookingFor.log | perl squidtime.sh >Reformatted.log
- Printer-friendly version
- 699 reads