summaryrefslogtreecommitdiff
path: root/src/journal/journald-server.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-08-30 21:00:52 +0200
committerLennart Poettering <lennart@poettering.net>2016-10-07 20:14:38 +0200
commitd473176a74891256b95a4a5c89f1c0b9e1440945 (patch)
treef7556daf4e2c6d7767b2cb7df4eb082fdad156f0 /src/journal/journald-server.c
parent766c94ad6b6d6101520a02aa2906ca7a446f4863 (diff)
journal: complete slice info in journal metadata
We are already attaching the system slice information to log messages, now add theuser slice info too, as well as the object slice info.
Diffstat (limited to 'src/journal/journald-server.c')
-rw-r--r--src/journal/journald-server.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index a762558e3d..79a93df26a 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -713,7 +713,7 @@ static void dispatch_message_real(
assert(s);
assert(iovec);
assert(n > 0);
- assert(n + N_IOVEC_META_FIELDS + (object_pid ? N_IOVEC_OBJECT_FIELDS : 0) <= m);
+ assert(n + N_IOVEC_META_FIELDS + (object_pid > 0 ? N_IOVEC_OBJECT_FIELDS : 0) <= m);
if (ucred) {
realuid = ucred->uid;
@@ -814,6 +814,12 @@ static void dispatch_message_real(
IOVEC_SET_STRING(iovec[n++], x);
}
+ if (cg_path_get_user_slice(c, &t) >= 0) {
+ x = strjoina("_SYSTEMD_USER_SLICE=", t);
+ free(t);
+ IOVEC_SET_STRING(iovec[n++], x);
+ }
+
free(c);
} else if (unit_id) {
x = strjoina("_SYSTEMD_UNIT=", unit_id);
@@ -919,6 +925,18 @@ static void dispatch_message_real(
IOVEC_SET_STRING(iovec[n++], x);
}
+ if (cg_path_get_slice(c, &t) >= 0) {
+ x = strjoina("OBJECT_SYSTEMD_SLICE=", t);
+ free(t);
+ IOVEC_SET_STRING(iovec[n++], x);
+ }
+
+ if (cg_path_get_user_slice(c, &t) >= 0) {
+ x = strjoina("OBJECT_SYSTEMD_USER_SLICE=", t);
+ free(t);
+ IOVEC_SET_STRING(iovec[n++], x);
+ }
+
free(c);
}
}