How to convert Squid unixtime logs in human-readable format?
If you’re looking at squid access.log, you’ll find the first column of it is the time, for example:
1310313302.640 829 58.215.75.51 TCP_MISS/200 104 CONNECT smtp.126.com:25 – DIRECT/123.125.50.112 –
1310313303.484 1845 58.215.75.51 TCP_MISS/200 104 CONNECT smtp.126.com:25 – DIRECT/123.125.50.111 –
This is not very human readable.
To convert Squid unixtime logs in human-readable format, one can use following command:
perl -p -e ‘s/^([0-9]*)/”[“.localtime($1).”]”/e’ > converted.log