On Thu, 10 Dec 1998, Mohammed Hamed wrote:

> Are there any scripts that can convert the time stamps in the access.log files to 
>meaningful time values ?

Consider searching the archive. Similar question was asked before and several
people posted their scripts. Some of them were better than the one I re-post
below. My script will convert "anything" that looks like Squid timestamp into
a local time string. 

N.B. Time stamps in access.log are meaningful time values.

Alex.

#!/usr/local/bin/perl -w

while (<STDIN>) {
    if (/^\d+$/) {
        printf("%d = %s\n", $_, scalar localtime($_));
    } else {
        while (/\b(\d{9})(?:\.\d\d\d)?\b/) {
            $_ = $` . scalar(localtime($1)) . $';
        }
        print($_);
    }
}

Reply via email to