]> git.ipfire.org Git - thirdparty/systemd.git/commit
journal: store the original timestamp as SYSLOG_TIMESTAMP= 9346/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 4 Jul 2018 22:17:55 +0000 (00:17 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 4 Jul 2018 22:40:35 +0000 (00:40 +0200)
commit7c30c3c44f84421bbe510fb3339378e075b3ab48
treeffa01618ded63f5a37ce158de83ef9b2f2740c51
parent855a86a3497178b368d3b04df9503e7051f85b8d
journal: store the original timestamp as SYSLOG_TIMESTAMP=

This is useful if someone wants to recreate the original syslog datagram. We
already include timestamp information as _SOURCE_REALTIME_TIMESTAMP=, and in
normal use that timestamp, converted back to the form used by syslog
(Mth dd HH:MM:SS) would usually give the value. But there are various
circumstances where this might not be true. Most obviously, if the datagram is
sent a bit later after being prepared, the time is rounded to the nearest
second, and it might be off. This is especially bad around New Year when the
syslog timestamp wraps around. Then the same timezone and locale need to be
used to recreate the original timestamp. In the end doing this reliably is
complicated, and it seems much easier to just unconditionally include the
original timestamp.

If the original timestamp cannot be located, we store the full log line.
This way, it should be always possible to recreate the original input.

Example:
MESSAGE=x
SYSLOG_TIMESTAMP=Sep 15 15:07:58
SYSLOG_RAW
^]^@^@^@^@^@^@^@<13>Sep 15 15:07:58 HOST: x^@y
_PID=3318
_SOURCE_REALTIME_TIMESTAMP=1530743976393553

Fixes #2398.
man/systemd.journal-fields.xml
src/journal/journald-syslog.c