by prettyscripts on 2008-07-18 10:58:05
some log files such as squid log uses uses unix time as timestamp, which looks like some random number generated number.
you can use this online conversion tool.
to run from unix command line, to convert to human readable format, eg in yyyy-mm-dd hh:mm:ss format,
Code:
echo <timestamp> | awk '{ print strftime("%Y-%m-%d %H:%M:%S", $1); }' |
replace <timestamp> with the unix timestamp. the format for strftime is similar to php function with the same name.
i put this in a shell script so i don’t have to remember the awk command. if there’s a simpler way to do it, please post in comment.