sys-logger: Optionally support mapping strongSwan loglevels to syslog levels

strongSwan logs all syslog messages using LOG_INFO for historical reasons,
regardless of the strongSwan loglevel used producing the log message.

In some setups with advanced logging infrastructure, it may be feasible
to be more verbose when logging in strongSwan, but then filter messages
on the syslog server. While this may be possible by custom syslog filtering
rules matching the log level included with the log_level setting, this is
not super convenient.

So add a new map_level setting, which can map strongSwan loglevels to
syslog loglevels. By default this is disabled, keeping the existing
behavior. If enabled, it maps strongSwan loglevels to syslog loglevels
at a given syslog loglevel offset.

Closes strongswan/strongswan#859
This commit is contained in:
Martin Willi
2022-01-24 17:33:02 +01:00
committed by Tobias Brunner
parent e3d1766aff
commit 9877ce6c56
4 changed files with 38 additions and 6 deletions
+11
View File
@@ -70,3 +70,14 @@ charon.syslog.<facility>.ike_name = no
charon.syslog.<facility>.log_level = no
Add the log level of each message after the subsystem (e.g. [IKE2]).
charon.syslog.<facility>.map_level = -1
Map strongSwan specific loglevels to syslog loglevels.
The default setting of -1 passes all messages to syslog using a log
level of LOG_INFO. A non-negative value maps the strongSwan specific
loglevels (0..4) to the syslog level starting at the specified number.
For example, a value of 5 (LOG_NOTICE) maps strongSwan loglevel 0 to
LOG_NOTICE, level 1 to LOG_INFO, and levels 2, 3 and 4 to LOG_DEBUG.
This allows (additional) filtering of log messages on the syslog
server.