Blame 0002-reporter-s-journal-add-journal-default-entries.patch

8065018
From f97b21d1e1d4bff4e667991997dd78fec3b95159 Mon Sep 17 00:00:00 2001
8065018
From: Matej Habrnal <mhabrnal@redhat.com>
8065018
Date: Tue, 14 Mar 2017 12:55:25 +0100
8065018
Subject: [PATCH] reporter-s-journal: add journal default entries
8065018
8065018
This commit adds 3 new fields into journal logs. All of them are in the
8065018
NONE dump.
8065018
8065018
The new fields are:
8065018
PROBLEM_DIR - Represents absolute file system path of problem directory.
8065018
    The full path is needed because that is the way with which are
8065018
    problems identified in DBus Problems2API.
8065018
PROBLEM_UUID - Represents uuid
8065018
PROBLEM_DUPHASH - Represents duphash
8065018
8065018
These new fields were needed for ABRT in Cockpit for connecting problems
8065018
with journal entries. All three are needed, because the problem directory
8065018
might be removed at the time of reading journal but a dupe can be
8065018
present there and the dupe can be identified based on DUPHASH or UUID.
8065018
8065018
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
8065018
---
8065018
 src/plugins/reporter-systemd-journal.c | 10 ++++++++++
8065018
 1 file changed, 10 insertions(+)
8065018
8065018
diff --git a/src/plugins/reporter-systemd-journal.c b/src/plugins/reporter-systemd-journal.c
8065018
index 8df5ac7..957002b 100644
8065018
--- a/src/plugins/reporter-systemd-journal.c
8065018
+++ b/src/plugins/reporter-systemd-journal.c
8065018
@@ -102,6 +102,7 @@ static void msg_content_free(msg_content_t *msg_c)
8065018
 #define BINARY_NAME "binary"
8065018
 #define SYSLOG_ID   "SYSLOG_IDENTIFIER"
8065018
 #define MESSAGE_ID  "MESSAGE_ID"
8065018
+#define DUMPDIR_PATH "DIR"
8065018
 
8065018
 enum {
8065018
     DUMP_NONE      = 1 << 0,
8065018
@@ -122,6 +123,9 @@ static const char *const fields_default[] = {
8065018
     FILENAME_EXCEPTION_TYPE ,
8065018
     FILENAME_REASON             ,
8065018
     FILENAME_CRASH_FUNCTION     ,
8065018
+    DUMPDIR_PATH                ,
8065018
+    FILENAME_UUID               ,
8065018
+    FILENAME_DUPHASH            ,
8065018
     NULL
8065018
 };
8065018
 
8065018
@@ -302,6 +306,12 @@ int main(int argc, char **argv)
8065018
     if (binary_name)
8065018
         problem_data_add_text_noteditable(problem_data, BINARY_NAME, binary_name);
8065018
 
8065018
+    /* add problem dir path into problem data */
8065018
+    char *abspath = realpath(dump_dir_name, NULL);
8065018
+    if (abspath)
8065018
+        problem_data_add_text_noteditable(problem_data, DUMPDIR_PATH, abspath);
8065018
+    free(abspath);
8065018
+
8065018
     /* crash_function element is neeeded by systemd journal messages, save ??, if it doesn't exist */
8065018
     const char *crash_function = problem_data_get_content_or_NULL(problem_data, FILENAME_CRASH_FUNCTION);
8065018
     if (!crash_function)
8065018
-- 
8065018
2.9.3
8065018