Agnus Dei (jackal) wrote,
Agnus Dei
jackal

How to convert Apache TimeStamp into EPOCH time

For an Apache log file that ends in a line like this:

123.123.123.123 - - [26/Sep/2013:20:26:45 +0000] "GET /fun.html HTTP/1.1" 302 - "-" "check_http/v1.4.16.29.g3c10.dirty (nagios-plugins 1.4.16)" "-" "-" 537 2498 5502 usec


[root@m2qastaging-ema-01 ~]# export LASTTIME=`tail -1 /var/log/httpd/funfunfun.com-ssl-access_log | sed -r "s/.*\[(.*)\].*/\1/g" `
[root@m2qastaging-ema-01 ~]#  perl -MDate::Parse -e"print str2time(\"$LASTTIME\")"; echo
1380228615


[root@m2qastaging-ema-01 ~]# date +%s
1380228629

Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

  • 0 comments