I have created a custom level "ALERT" using org.apache.logging.log4j.Level function Level.forName
final Level ALERT = Level.forName("ALERT", 100);
I am generating log messages using this custom Level. e.g.
LOGGER.log(Level.getLevel("ALERT"), "Message Details: " + s);
Also, sending the logs to a syslog server using log4j2 syslog appender with below in the log4j properties.
appender.syslog.type = Syslog
appender.syslog.name = syslog
appender.syslog.host = rsyslog-server.hostname
appender.syslog.port = 2514
appender.syslog.facility = <nil>
appender.syslog.protocol = TCP
appender.syslog.layout.type = PatternLayout
appender.syslog.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] %marker%m%n
rootLogger.appenderRef.syslog.ref = syslog
rootLogger.level = info
Have configured the syslog server to store these logs alongwith syslogseverity. Example log in rsyslog:-
{"syslogseverity":"5","message":" {\"log\":{\"message\":}"}"}
Observed that every log is getting stored in the syslog server with syslogseverity of 5.
How to store the logs in syslog server with syslogseverity of 1 with my Custom Level "ALERT"