6. Custom Syslog File

In a Linux/Unix environment it is possible to configure syslog to write log messages to a separate file for a specific facility. It is possible to configure OpenSER to use a particular facility and then redirect that facility into a separate file. This can greatly improve the readability and manageability of OpenSER logs.

The default syslog file depends on your OS distribution. For example, in Debian Linux is “/var/log/syslog” and in RedHat Linux is “/var/log/messages”. To make OpenSER print log messages in another file you have to follow the next instructions.

Set option “log_facility=LOG_LOCAL0” in OpenSER configuration file. Then configure syslog to use a special file for log messages with facility “LOG_LOCAL0”. The configuration file of syslog can be usually found in “/etc/syslog.conf”. Example 5, “Changes in syslog.conf” shows a syslog configuration file modified to report OpenSER error messages into a separate file.

Example 5. Changes in syslog.conf

...
#
# don't log messages with LOG_LOCAL0 in /var/log/syslog anymore
*.*;auth,authpriv.none,local0.none		-/var/log/syslog

#
# log messages with LOG_LOCAL0 in /var/log/ser.log
local0.*			-/var/log/ser.log
...

NOTE: The '-' in front of "/var/log/ser.log" is to omit synchronizing the log file after every log message. If you choose to configure “syslog” in synchronous mode you must be aware that it has big impact over performances when the signaling traffic is high.