Push RFC 5424 message format from logmsg() into fprintlog().


Push RFC 5424 message format from logmsg() into fprintlog().

Now that all of parsemsg() parses both RFC 3164 and 5424 messages and
hands them to logmsg(), alter the latter to properly forward all RFC
5424 message attributes to fprintlog(). While there, make some minor
cleanups to this code:

  • Instead of extending the existing code that compares hostnames and message bodies for deduplication, print all of the relevant message fields into a single string that we can compare ('saved').
  • No longer let the behaviour of fprintflog() depend on whether 'msg == NULL' to print repetition messages, Simply decompose this function into fprintlog_first() and fprintlog_successive(). This makes the interpretation of function arguments less magical and also allows us to get consistent behaviour across RFC 3164 and 5424 when adding support for the RFC 5424 output format.
  • As RFC 5424 syslog messages have a dedicated application name field, alter the repetition messages to be printed on behalf of syslogd on the current system. Change these messages to use the local hostname, so that it's obvious which syslogd instance detected the repetition. Remove f_prevhost, as it has now become unnecessary.
  • Remove a useless strdup(). Deconsting the message string is safe in this specific case.


edAuthored on
rS332117: Pat the watchdog less while producing a coredump. Prior to this change,