Blob Blame History Raw
From f97b21d1e1d4bff4e667991997dd78fec3b95159 Mon Sep 17 00:00:00 2001
From: Matej Habrnal <mhabrnal@redhat.com>
Date: Tue, 14 Mar 2017 12:55:25 +0100
Subject: [PATCH] reporter-s-journal: add journal default entries

This commit adds 3 new fields into journal logs. All of them are in the
NONE dump.

The new fields are:
PROBLEM_DIR - Represents absolute file system path of problem directory.
    The full path is needed because that is the way with which are
    problems identified in DBus Problems2API.
PROBLEM_UUID - Represents uuid
PROBLEM_DUPHASH - Represents duphash

These new fields were needed for ABRT in Cockpit for connecting problems
with journal entries. All three are needed, because the problem directory
might be removed at the time of reading journal but a dupe can be
present there and the dupe can be identified based on DUPHASH or UUID.

Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
---
 src/plugins/reporter-systemd-journal.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/plugins/reporter-systemd-journal.c b/src/plugins/reporter-systemd-journal.c
index 8df5ac7..957002b 100644
--- a/src/plugins/reporter-systemd-journal.c
+++ b/src/plugins/reporter-systemd-journal.c
@@ -102,6 +102,7 @@ static void msg_content_free(msg_content_t *msg_c)
 #define BINARY_NAME "binary"
 #define SYSLOG_ID   "SYSLOG_IDENTIFIER"
 #define MESSAGE_ID  "MESSAGE_ID"
+#define DUMPDIR_PATH "DIR"
 
 enum {
     DUMP_NONE      = 1 << 0,
@@ -122,6 +123,9 @@ static const char *const fields_default[] = {
     FILENAME_EXCEPTION_TYPE ,
     FILENAME_REASON             ,
     FILENAME_CRASH_FUNCTION     ,
+    DUMPDIR_PATH                ,
+    FILENAME_UUID               ,
+    FILENAME_DUPHASH            ,
     NULL
 };
 
@@ -302,6 +306,12 @@ int main(int argc, char **argv)
     if (binary_name)
         problem_data_add_text_noteditable(problem_data, BINARY_NAME, binary_name);
 
+    /* add problem dir path into problem data */
+    char *abspath = realpath(dump_dir_name, NULL);
+    if (abspath)
+        problem_data_add_text_noteditable(problem_data, DUMPDIR_PATH, abspath);
+    free(abspath);
+
     /* crash_function element is neeeded by systemd journal messages, save ??, if it doesn't exist */
     const char *crash_function = problem_data_get_content_or_NULL(problem_data, FILENAME_CRASH_FUNCTION);
     if (!crash_function)
-- 
2.9.3