diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-07-05 00:17:55 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-07-05 00:40:35 +0200 |
commit | 7c30c3c44f84421bbe510fb3339378e075b3ab48 (patch) | |
tree | ffa01618ded63f5a37ce158de83ef9b2f2740c51 /man/systemd.journal-fields.xml | |
parent | 855a86a3497178b368d3b04df9503e7051f85b8d (diff) | |
download | systemd-7c30c3c44f84421bbe510fb3339378e075b3ab48.tar.gz |
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.
Diffstat (limited to 'man/systemd.journal-fields.xml')
-rw-r--r-- | man/systemd.journal-fields.xml | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/man/systemd.journal-fields.xml b/man/systemd.journal-fields.xml index aeb5367d24..942c6ba91a 100644 --- a/man/systemd.journal-fields.xml +++ b/man/systemd.journal-fields.xml @@ -103,13 +103,13 @@ <term><varname>SYSLOG_FACILITY=</varname></term> <term><varname>SYSLOG_IDENTIFIER=</varname></term> <term><varname>SYSLOG_PID=</varname></term> + <term><varname>SYSLOG_TIMESTAMP=</varname></term> <listitem> - <para>Syslog compatibility fields containing the facility - (formatted as decimal string), the identifier string (i.e. - "tag"), and the client PID. (Note that the tag is usually - derived from glibc's - <varname>program_invocation_short_name</varname> variable, - see + <para>Syslog compatibility fields containing the facility (formatted as + decimal string), the identifier string (i.e. "tag"), the client PID, and + the timestamp as specified in the original datagram. (Note that the tag is + usually derived from glibc's + <varname>program_invocation_short_name</varname> variable, see <citerefentry project='die-net'><refentrytitle>program_invocation_short_name</refentrytitle><manvolnum>3</manvolnum></citerefentry>.)</para> </listitem> </varlistentry> @@ -119,14 +119,17 @@ <listitem> <para>The original contents of the syslog line as received in the syslog datagram. This field is only included if the <varname>MESSAGE=</varname> - field was modified compared to the original payload. This happens when the - message contains leading or trailing whitespace (trailing and leading + field was modified compared to the original payload or the timestamp could + not be located properly and is not included in + <varname>SYSLOG_TIMESTAMP=</varname>. Message truncation occurs when when + the message contains leading or trailing whitespace (trailing and leading whitespace is stripped), or it contains an embedded <constant>NUL</constant> byte (the <constant>NUL</constant> byte and anything after it is not included). Thus, the original syslog line is either stored as <varname>SYSLOG_RAW=</varname> or it can be recreated - based on the stored priority, timestamp, hostname, and the message payload - stored in <varname>MESSAGE=</varname>.</para> + based on the stored priority and facility, timestamp, identifier, and the + message payload in <varname>MESSAGE=</varname>. + </para> </listitem> </varlistentry> </variablelist> |