Open amyangfei opened 8 years ago
found this for anyone curious https://success.trendmicro.com/solution/TP000086250-What-are-Syslog-Facilities-and-Levels
The priority value is calculated using the formula (Priority = Facility * 8 + Level). For example, a kernel message (Facility=0) with a Severity of Emergency (Severity=0) would have a Priority value of 0. Also, a "local use 4" message (Facility=20) with a Severity of Notice (Severity=5) would have a Priority value of 165.
When using rsyslog plugin I found the document(logging-to-remote-syslog) tells
I found the syslog plugin supports the option
facility name
such as:--logger rsyslog:12.34.56.78:12345,uwsgi1234,local2
The facility name will be translated to its corresponding int value defined in
syslog.h
. But the rsyslog plugin doesn't support this, an integer value must be used to represent the facility.Besides as we know the syslog protocol starts with
<priority>:msg
,priority = facility | level
. If we pass an integer value we can config an arbitrarypriority
for rsyslog plugin, while the syslog plugin uses the following hard code for log level, and the rsyslog plugin uses 29 (LOG_DAEMON | LOG_NOTICE) as default priority if priority integer not provided.Maybe rsyslog plugin could support facility configuration with a human-readable name the same as syslog plugin, while preserving the mechanism that using an integer to represent priority.