Format LogRecord as a
RFC5424-compliant syslog message.
Fields of syslog message are:
- priority (facility * 8 + priority)
- version (constant "1" for now)
- timestamp (format derived from RFC3339, we use LogRecord's timestamp)
- hostname (InetAddress.getLocalHost().getHostName() with AM_SERVER_HOST system property as a default)
- app-name (device or application id, we use the constant "OpenAM" value)
- proc-id (change of this value indicates discontinuity in logs and groups records from the same process, we use
hash code of the SyslogFormatter class)
- msg id (type of message, LogConstants.MESSAGE_ID from info map or - (nil-value))
- structured data (keys and values from info map, expressed as one SD-ELEMENT with "logRecord@36733" as SD-ID.
36733 is IANA enterpriseId of Forgerock AS)
- log message.
As the structured data field is capable of expressing all the key-value pairs from info map, we include all keys
except those that are listed in allFields configuration option and not in selectedFields. If
iplanet-am-logging-syslog-add-unlisted-fields is not checked, only fields in allFields are included.
NB: Current syslog daemons (both rsyslog and syslog-ng) need additional configuration to allow logging via UDP (or
TCP) and to log structured data.