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).
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
}
--
Alan Mackenzie (Nuremberg, Germany).