perl script for translating log times

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

perl script for translating log times

Matus UHLAR - fantomas
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, [hidden email] ; 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...
_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users