summaryrefslogtreecommitdiff
path: root/src/basic/log.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2020-09-29 13:07:07 +0200
committerLennart Poettering <lennart@poettering.net>2020-09-29 15:51:53 +0200
commit38ffc7d18aa05c2be6bd3d26fdcd8efbb9bab255 (patch)
tree3085535d5f1ac2495d720a66ab762eadc789b461 /src/basic/log.c
parent9ee806d1a80d7aa9d85fc91dca48e7b37efcb053 (diff)
downloadsystemd-38ffc7d18aa05c2be6bd3d26fdcd8efbb9bab255.tar.gz
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.
Diffstat (limited to 'src/basic/log.c')
-rw-r--r--src/basic/log.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/basic/log.c b/src/basic/log.c
index 89d26a4a43..7c68258ea8 100644
--- a/src/basic/log.c
+++ b/src/basic/log.c
@@ -547,6 +547,7 @@ static int log_do_header(
r = snprintf(header, size,
"PRIORITY=%i\n"
"SYSLOG_FACILITY=%i\n"
+ "TID=" PID_FMT "\n"
"%s%.256s%s" /* CODE_FILE */
"%s%.*i%s" /* CODE_LINE */
"%s%.256s%s" /* CODE_FUNC */
@@ -556,6 +557,7 @@ static int log_do_header(
"SYSLOG_IDENTIFIER=%.256s\n",
LOG_PRI(level),
LOG_FAC(level),
+ gettid(),
isempty(file) ? "" : "CODE_FILE=",
isempty(file) ? "" : file,
isempty(file) ? "" : "\n",