[squid-users] perl script for translating log times

Matus UHLAR - fantomas uhlar at fantomas.sk
Thu Sep 5 12:03:29 UTC 2019


Hello,

if anyone is interested in translating log timestamps, here it is:

perl -pe 's/(\d+\.\d+)(\s+)(\d+)/localtime($1-$3\/1000)." - ".localtime($1)/e'


This translates log timestamps from:

1567673687.237 1737748

e.g. date of end, time in microseconds into format of:

date of start - date of end

e.g. from:

1567673687.237 1737748 192.168.X.Y TCP_TUNNEL/200 2758742 CONNECT A.B.C.D:8089 - HIER_DIRECT/A.B.C.D -

to:

Thu Sep  5 10:25:49 2019 - Thu Sep  5 10:54:47 2019 192.168.X.Y TCP_TUNNEL/200 2758742 CONNECT A.B.C.D:8089 - HIER_DIRECT/A.B.C.D -

in local time.

-- 
Matus UHLAR - fantomas, uhlar at fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
Fighting for peace is like fucking for virginity...


More information about the squid-users mailing list