chiark / gitweb /
journald: log the slice of a process along with each message in _SYSTEMD_SLICE=
authorLennart Poettering <lennart@poettering.net>
Tue, 17 Sep 2013 20:21:00 +0000 (15:21 -0500)
committerLennart Poettering <lennart@poettering.net>
Tue, 17 Sep 2013 20:21:30 +0000 (15:21 -0500)
man/systemd.journal-fields.xml
src/journal/journald-server.c
src/journal/journald-server.h

index cffcccb53efa8c20072321ddd264c90113d98a6e..8a15598e631ed4000a6e25ef64c9dfd96ab53ac4 100644 (file)
                                 <term><varname>_SYSTEMD_UNIT=</varname></term>
                                 <term><varname>_SYSTEMD_USER_UNIT=</varname></term>
                                 <term><varname>_SYSTEMD_OWNER_UID=</varname></term>
                                 <term><varname>_SYSTEMD_UNIT=</varname></term>
                                 <term><varname>_SYSTEMD_USER_UNIT=</varname></term>
                                 <term><varname>_SYSTEMD_OWNER_UID=</varname></term>
+                                <term><varname>_SYSTEMD_SLICE=</varname></term>
 
                                 <listitem>
 
                                 <listitem>
-                                        <para>The control group path in
-                                        the systemd hierarchy, the
+                                        <para>The control group path
+                                        in the systemd hierarchy, the
                                         systemd session ID (if any),
                                         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.</para>
+                                        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.</para>
                                 </listitem>
                         </varlistentry>
 
                                 </listitem>
                         </varlistentry>
 
index ba211b3724f99fe8518fe430472efc60419ea1c9..709fa8b7d09921eadc246775d13461c963681729 100644 (file)
@@ -638,6 +638,12 @@ static void dispatch_message_real(
                                 IOVEC_SET_STRING(iovec[n++], x);
                         }
 
                                 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);
                 }
 
                         free(c);
                 }
 
index e856ef277a727688204692ed47bdde1ac30f8b0c..238fc8c3fb757015d574ed4acea332d3154a4661 100644 (file)
@@ -125,7 +125,7 @@ typedef struct Server {
         bool sync_scheduled;
 } 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
 #define N_IOVEC_KERNEL_FIELDS 64
 #define N_IOVEC_UDEV_FIELDS 32
 #define N_IOVEC_OBJECT_FIELDS 11