Mailing List Archive

Human readable timestamps in qmail log files
Hello, qmail.

I've often been irritated by the timestamps in qmail log files not being
human readable, though I accept there are good reasons for this.

So I've written the following script, called log-qmail, to make the
timestamps human readable. It works in GNU/Linux with gawk, and may
well work in other environments.

Ignore or enjoy!


#!/usr/bin/awk -f
#########################################################################
# log-qmail:
#
# A filter which converts the time stamp on qmail log files to a human
# readable form.
#
# Written by Alan Mackenzie <acm@muc.de>, 2015-10-18.
# This script is in the public domain.
#
# To use, pipe all or part of a log file through this filter.
#########################################################################
{
sec = strtonum("0x" substr($1, 10, 8))
subsec = strtonum("0x" substr($1, 18, 8)) / 1000000000
str = strftime("%Y-%m-%d %H:%M:%S%% %z", sec, 0)
sub("%", substr (sprintf("%.3f", subsec), 2), str)
$1 = str
print
}


--
Alan Mackenzie (Nuremberg, Germany).
Re: Human readable timestamps in qmail log files [ In reply to ]
Hi Alan,

Congratulations, you just re-invented tai64nlocal. :)

Regards
--
Robert Sander
Re: Human readable timestamps in qmail log files [ In reply to ]
Hello, Robert.

On Sun, Oct 18, 2015 at 01:26:06PM +0200, Robert Sander wrote:
> Hi Alan,

> Congratulations, you just re-invented tai64nlocal. :)

I've just discovered the existence of tai64nlocal in a somewhat
efficient manner!

Thanks for telling me about it.

> Regards
> --
> Robert Sander

--
Alan Mackenzie (Nuremberg, Germany).