chiark / gitweb /
journald: add syslog fields for audit messages
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 4 Mar 2015 15:31:42 +0000 (10:31 -0500)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 15 Mar 2015 03:03:45 +0000 (23:03 -0400)
Audit messages would be displayed as "unknown[1]".

Also specify AUTH as facility... This seems to be the closest match
(/* security/authorization messages */).

src/journal/journald-audit.c

index c2f1545cc9b0a2c89b2e3e92f1826bce31bd3f8c..46eb82fa34ff4f34a8a24cdad9a075bfdf05f807 100644 (file)
@@ -373,7 +373,7 @@ static void process_audit_string(Server *s, int type, const char *data, size_t s
         if (isempty(p))
                 return;
 
         if (isempty(p))
                 return;
 
-        n_iov_allocated = N_IOVEC_META_FIELDS + 5;
+        n_iov_allocated = N_IOVEC_META_FIELDS + 7;
         iov = new(struct iovec, n_iov_allocated);
         if (!iov) {
                 log_oom();
         iov = new(struct iovec, n_iov_allocated);
         if (!iov) {
                 log_oom();
@@ -392,6 +392,10 @@ static void process_audit_string(Server *s, int type, const char *data, size_t s
         sprintf(id_field, "_AUDIT_ID=%" PRIu64, id);
         IOVEC_SET_STRING(iov[n_iov++], id_field);
 
         sprintf(id_field, "_AUDIT_ID=%" PRIu64, id);
         IOVEC_SET_STRING(iov[n_iov++], id_field);
 
+        assert_cc(32 == LOG_AUTH);
+        IOVEC_SET_STRING(iov[n_iov++], "SYSLOG_FACILITY=32");
+        IOVEC_SET_STRING(iov[n_iov++], "SYSLOG_IDENTIFIER=audit");
+
         m = alloca(strlen("MESSAGE=<audit-") + DECIMAL_STR_MAX(int) + strlen("> ") + strlen(p) + 1);
         sprintf(m, "MESSAGE=<audit-%i> %s", type, p);
         IOVEC_SET_STRING(iov[n_iov++], m);
         m = alloca(strlen("MESSAGE=<audit-") + DECIMAL_STR_MAX(int) + strlen("> ") + strlen(p) + 1);
         sprintf(m, "MESSAGE=<audit-%i> %s", type, p);
         IOVEC_SET_STRING(iov[n_iov++], m);