apacheのログ(Common Log Format)の時刻をISO 8601 標準の形式に変換する

apacheのログ

127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326


(clftime_to_iso8601.pl)

#!/usr/bin/env perl
use Time::Piece;

print Time::Piece->strptime($ARGV[0],"%d/%b/%Y:%H:%M:%S %z")->datetime,"\n";


実行してみる

$ ./clftime_2_iso8601.pl '10/Oct/2000:13:55:36 -0700'
2000-10-10T20:55:36