Kamailio Advanced Training
Click here for more details!

Learn how to build RTC services with Kamailio!

Thursday, October 16, 2008

Asynchronous syslogging

Courtesy of Henning Westerholt, Kamailio (OpenSER) development version has now support for non-blocking logging. This was implemented using the syslog-async functionality from the dnsmasq server [1] from Simon Kelley.

The standard Unix syslog() library routine can block waiting for the syslog daemon. On some systems, using a datagram socket for /dev/log avoids endless waits, but on Linux, even this does not work. Try typing:

killall -SIGSTOP $pid_of_syslog

into a root terminal on a non-critical machine. Then generate traffic to get some logs, eventually, the server will stop. This blocking of the syslog daemon can happens because of bugs, or if the daemon waits for external events, like DNS lookups.

Instead of blocking, log-lines are buffered in memory. The buffer size is limited and if the buffer overflows log lines are lost. When lines are lost this fact is logged with a message.

This functionality can be enabled with setting the define SYSLOG_ASYNC in the Makefile.defs file. The default is the normal log functionality from the system library, nothing changed if the define is not set.

You can get the code from the svn repository:

svn co https://openser.svn.sourceforge.net/svnroot/openser/trunk kamailio

Debian packages for several debian releases are available at: devel.kamailio.org.

[1] http://www.thekelleys.org.uk/dnsmasq/doc.html

No comments:

Post a Comment