chiark / gitweb /
journald: include audit message type number in MESSAGE= string
authorLennart Poettering <lennart@poettering.net>
Tue, 4 Nov 2014 00:00:50 +0000 (01:00 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 4 Nov 2014 00:00:50 +0000 (01:00 +0100)
src/journal/journald-audit.c

index 76f6f3f..f543732 100644 (file)
@@ -345,7 +345,7 @@ static void process_audit_string(Server *s, int type, const char *data, size_t s
         char id_field[sizeof("_AUDIT_ID=") + DECIMAL_STR_MAX(uint64_t)],
              type_field[sizeof("_AUDIT_TYPE=") + DECIMAL_STR_MAX(int)],
              source_time_field[sizeof("_SOURCE_REALTIME_TIMESTAMP=") + DECIMAL_STR_MAX(usec_t)];
-        const char *m;
+        char *m;
 
         assert(s);
 
@@ -396,7 +396,8 @@ 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);
 
-        m = strappenda("MESSAGE=audit: ", p);
+        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);
 
         z = n_iov;