[squid-users] logformat: override %tg, but keep subsecond resolution

Andreas Hasenack andreas at canonical.com
Wed Apr 22 14:29:35 UTC 2020


Hi,

I'm trying to override the %tg log format but keep its subsecond time
resolution.

As a reminder, %tg gives you this:

22/Apr/2020:14:14:18.360

I would like it to be

2020-04-22 14:14:18.360 +0000

I tried this first: %tg{%F %H:%M:%S %z}

That gave me 2020-04-22 14:14:18 +0000, so it's just missing the
milliseconds. And this is where I couldn't figure it out anymore.

Some combinations I tried, ranging from thoughtful experiments to just
random attempts:
%tg{%F %H:%M:%S %z}.%03tu -> 2020-04-22 14:14:18 +0000.360
%tg{%F %H:%M:%S.%03f %z} -> 2020-04-22 14:14:18.%03f +0000
%tg{%F %H:%M:%S.%03tu %z} -> ??? 2020-04-22 14:14:18.00  u +0000

What's the right format string I should use? I also checked
strftime(3) but couldn't figure it out.

Thanks!


More information about the squid-users mailing list