The standard squid log format writes time in seconds from epoch. How to add date and time in a human readable format?
1 Answer
Add these to squid.config file:
logformat timereadable %tl %6tr %>a %Ss/%03Hs %<st %rm %ru %un %Sh/%<A %mt
access_log daemon:/var/log/squid/access.log timereadable
then restart squid:
systemctl restart squid //for debian
Make sure the path were file is to be written exists.
-
2For ISO 8601 format with milliseconds replace
%tl
with%{%FT%T}tl.%03tu%{%z}tl
. That is to say: most of the date in the first%{<strftime formatting>}tl
, a zero-padded%tu
for the milliseconds, followed by just the time zone from a second%tl
. Not pretty but it works. See Time related format codes. Oct 7, 2021 at 14:29