mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-24 21:34:08 +03:00
log: include TID= field in structred log output
It always was the intention to expose this as trusted field _TID=, i.e. automatically determine it from journald via some SCM_xyz field or so, but this is never happened, and it's unlikely this will be added anytime soon to the kernel either, hence let's just generate this sender side, even if it means it's untrusted.
This commit is contained in:
parent
9ee806d1a8
commit
38ffc7d18a
@ -149,6 +149,13 @@
|
|||||||
<literal>file:/</literal>, <literal>man:</literal> or <literal>info:</literal> URL.</para>
|
<literal>file:/</literal>, <literal>man:</literal> or <literal>info:</literal> URL.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><varname>TID=</varname></term>
|
||||||
|
<listitem>
|
||||||
|
<para>The numeric thread ID (TID) the log message originates from.</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
</variablelist>
|
</variablelist>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
|
@ -547,6 +547,7 @@ static int log_do_header(
|
|||||||
r = snprintf(header, size,
|
r = snprintf(header, size,
|
||||||
"PRIORITY=%i\n"
|
"PRIORITY=%i\n"
|
||||||
"SYSLOG_FACILITY=%i\n"
|
"SYSLOG_FACILITY=%i\n"
|
||||||
|
"TID=" PID_FMT "\n"
|
||||||
"%s%.256s%s" /* CODE_FILE */
|
"%s%.256s%s" /* CODE_FILE */
|
||||||
"%s%.*i%s" /* CODE_LINE */
|
"%s%.*i%s" /* CODE_LINE */
|
||||||
"%s%.256s%s" /* CODE_FUNC */
|
"%s%.256s%s" /* CODE_FUNC */
|
||||||
@ -556,6 +557,7 @@ static int log_do_header(
|
|||||||
"SYSLOG_IDENTIFIER=%.256s\n",
|
"SYSLOG_IDENTIFIER=%.256s\n",
|
||||||
LOG_PRI(level),
|
LOG_PRI(level),
|
||||||
LOG_FAC(level),
|
LOG_FAC(level),
|
||||||
|
gettid(),
|
||||||
isempty(file) ? "" : "CODE_FILE=",
|
isempty(file) ? "" : "CODE_FILE=",
|
||||||
isempty(file) ? "" : file,
|
isempty(file) ? "" : file,
|
||||||
isempty(file) ? "" : "\n",
|
isempty(file) ? "" : "\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user