2

The standard squid log format writes time in seconds from epoch. How to add date and time in a human readable format?

Miguel
  • 541
  • 4
  • 7
  • 17

1 Answers1

4

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.

Miguel
  • 541
  • 4
  • 7
  • 17
  • 2
    For 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 `%{}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](http://www.squid-cache.org/Doc/config/logformat/). – Samuel Harmer Oct 07 '21 at 14:29