chiark / gitweb /
journal: handle multiline syslog messages
authorHarald Hoyer <harald@redhat.com>
Thu, 1 Aug 2013 10:14:02 +0000 (12:14 +0200)
committerHarald Hoyer <harald@redhat.com>
Tue, 6 Aug 2013 10:58:17 +0000 (12:58 +0200)
commit04fefcddb8e71e87abeb0faff0f547eb8ae88a64
treee0ef726c3b2ca085331dc5d9315146bf2f5bfad6
parent9cfda9644094e8d0fdd9f8b74ade9868514a6a70
journal: handle multiline syslog messages

Since the journal can handle multiple lines just well natively,
and rsyslog can be configured to handle them as well, there is no need
to truncate messages from syslog() after the first newline.

Reproducer:

1. Add following four lines to /etc/rsyslog.conf

   ----------
   $EscapeControlCharactersOnReceive off
   $ActionFileDefaultTemplate RSYSLOG_SysklogdFileFormat
   $SpaceLFOnReceive on
   $DropTrailingLFOnReception off
   ----------

3. Restart rsyslog
  # service rsyslog restart

4. Compile and run the following program

   ----------
   #include <stdio.h>
   #include <syslog.h>

   int main()
   {
    syslog(LOG_INFO, "aaa%caaa", '\n');
    return 0;
   }
   ----------

Actual results:
Below message appears in /var/log/messages.

   ----------
   Sep  7 19:19:39 localhost test2: aaa
   ----------

Expected results:
Below message, which worked prior to systemd-journald
appears in /var/log/messages.

   ----------
   Sep  7 19:19:39 localhost test2: aaa aaa

https://bugzilla.redhat.com/show_bug.cgi?id=855313
src/journal/journald-server.c