I'm using the SyslogAppender of log4j version 2.17.1 (package org.apache.logging.log4j.core.appender) in order to send syslog messages.
the message are sent in the next format:
Mar 23 17:32:24 se-demo {"id": 1,"type": "test-type","severity": "test-severity","severityScore": 50,"securityEventTimestamp": 10101,"msg": "test-description","cat": "test-category","url": "test-url","dstIps": "test-destinationIps","dstHosts": "test-destinationHosts","destinationAccount": "test-destinationAccount","destination": "test-destination","destinationType": "test-destinationType","accessedTables": "test-.accessedTables","numOfAccessedObjects": "test-numOfAccessedObjects","srcUsers": "test-sourceUsers","srcIps": "test-sourceIps","srcHosts": "test-sourceHosts","sourceApps": "test-sourceApps","userAction": "test-userAction","clusterNames": "test-clusterNames","clusterMemberNames": "test-clusterMemberNames","actionType": "test-statusType"}
I would like to remove the header for the message (remove the "Mar 23 17:32:24 se-demo") and send only the message itself.
My appender is built with java code:
private SyslogAppender createSyslogAppender(SyslogSendProtocolType protocol, SyslogFacilityType syslogFacilityType, String host, int port, boolean ignoreExceptions, String appenderName, Configuration config) {
return SyslogAppender.createAppender(
host,
port,
protocol.name(),
null,
5000,
2000,
true,
appenderName,
true,
ignoreExceptions,
Facility.toFacility(syslogFacilityType.name()),
null,
Rfc5424Layout.DEFAULT_ENTERPRISE_NUMBER,
true,
null,
null,
null,
true,
null,
appenderName,
null,
null,
null,
null,
null,
null,
config,
Charset.forName("UTF-8"),
null,
new LoggerFields[]{},
true);
}
I attached also a printscreen of the constructor above so you can the the description of each member
I cannot find any method on that appender that I can configure whether to remove the header or not. Any ideas?