naccyde / rpms / systemd

Forked from rpms/systemd a year ago
Clone
65878a
From 7f85c4184fc45c3dd2c76b4867ab252c3530f84d Mon Sep 17 00:00:00 2001
65878a
From: Michal Sekletar <msekleta@redhat.com>
65878a
Date: Fri, 25 Jul 2014 14:38:22 +0200
65878a
Subject: [PATCH] journald: always add syslog facility for messages coming from
65878a
 kmsg
65878a
65878a
Set SYSLOG_FACILITY field for kernel log messages too. Setting only
65878a
SYSLOG_IDENTIFIER="kernel" is not sufficient and tools reading journal
65878a
maybe confused by missing SYSLOG_FACILITY field for kernel log messages.
65878a
65878a
(cherry picked from commit 36dd072cdf03dcac0fcd2d6b42f261444dc7ac88)
65878a
65878a
Resolves: #1113215
65878a
---
65878a
 src/journal/journald-kmsg.c | 6 +++---
65878a
 1 file changed, 3 insertions(+), 3 deletions(-)
65878a
65878a
diff --git a/src/journal/journald-kmsg.c b/src/journal/journald-kmsg.c
65878a
index 9895808..e393cb7 100644
65878a
--- a/src/journal/journald-kmsg.c
65878a
+++ b/src/journal/journald-kmsg.c
65878a
@@ -274,6 +274,9 @@ static void dev_kmsg_record(Server *s, char *p, size_t l) {
65878a
         if (asprintf(&syslog_priority, "PRIORITY=%i", priority & LOG_PRIMASK) >= 0)
65878a
                 IOVEC_SET_STRING(iovec[n++], syslog_priority);
65878a
 
65878a
+        if (asprintf(&syslog_facility, "SYSLOG_FACILITY=%i", LOG_FAC(priority)) >= 0)
65878a
+                IOVEC_SET_STRING(iovec[n++], syslog_facility);
65878a
+
65878a
         if ((priority & LOG_FACMASK) == LOG_KERN)
65878a
                 IOVEC_SET_STRING(iovec[n++], "SYSLOG_IDENTIFIER=kernel");
65878a
         else {
65878a
@@ -295,9 +298,6 @@ static void dev_kmsg_record(Server *s, char *p, size_t l) {
65878a
                         if (syslog_pid)
65878a
                                 IOVEC_SET_STRING(iovec[n++], syslog_pid);
65878a
                 }
65878a
-
65878a
-                if (asprintf(&syslog_facility, "SYSLOG_FACILITY=%i", LOG_FAC(priority)) >= 0)
65878a
-                        IOVEC_SET_STRING(iovec[n++], syslog_facility);
65878a
         }
65878a
 
65878a
         message = cunescape_length_with_prefix(p, pl, "MESSAGE=");