From 0a244b8ecb6dfcb381fe831dc2aa9bacb2c12975 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 17 Sep 2013 15:21:00 -0500 Subject: journald: log the slice of a process along with each message in _SYSTEMD_SLICE= --- man/systemd.journal-fields.xml | 19 +++++++++++-------- src/journal/journald-server.c | 6 ++++++ src/journal/journald-server.h | 2 +- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/man/systemd.journal-fields.xml b/man/systemd.journal-fields.xml index cffcccb53e..8a15598e63 100644 --- a/man/systemd.journal-fields.xml +++ b/man/systemd.journal-fields.xml @@ -223,17 +223,20 @@ _SYSTEMD_UNIT= _SYSTEMD_USER_UNIT= _SYSTEMD_OWNER_UID= + _SYSTEMD_SLICE= - The control group path in - the systemd hierarchy, the + The control group path + in the systemd hierarchy, the systemd session ID (if any), - the systemd unit name (if any), - the systemd user session unit name (if any) - and the owner UID of the - systemd session (if any) of - the process the journal entry - originates from. + the systemd unit name (if + any), the systemd user session + unit name (if any), the owner + UID of the systemd session (if + any) and the systemd slice + unit of the process the + journal entry originates + from. diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c index ba211b3724..709fa8b7d0 100644 --- a/src/journal/journald-server.c +++ b/src/journal/journald-server.c @@ -638,6 +638,12 @@ static void dispatch_message_real( IOVEC_SET_STRING(iovec[n++], x); } + if (cg_path_get_slice(c, &t) >= 0) { + x = strappenda("_SYSTEMD_SLICE=", t); + free(t); + IOVEC_SET_STRING(iovec[n++], x); + } + free(c); } diff --git a/src/journal/journald-server.h b/src/journal/journald-server.h index e856ef277a..238fc8c3fb 100644 --- a/src/journal/journald-server.h +++ b/src/journal/journald-server.h @@ -125,7 +125,7 @@ typedef struct Server { bool sync_scheduled; } Server; -#define N_IOVEC_META_FIELDS 19 +#define N_IOVEC_META_FIELDS 20 #define N_IOVEC_KERNEL_FIELDS 64 #define N_IOVEC_UDEV_FIELDS 32 #define N_IOVEC_OBJECT_FIELDS 11 -- cgit v1.2.3-54-g00ecf