User Tools

Site Tools


tutorials:3.2.x:syslog

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
tutorials:3.2.x:syslog [2011/12/20 10:33]
85.178.76.94 created
tutorials:3.2.x:syslog [2022/03/23 09:55]
miconda [Log Rotate]
Line 1: Line 1:
 ====== Kamailio with Syslog and Log Rotate ====== ====== Kamailio with Syslog and Log Rotate ======
 +
 +<code>
 +Authors of initial tutorial:
 +Daniel-Constantin Mierla
 +  <miconda (at) gmail.com>
 +
 +Elena-Ramona Modroiu
 +  <ramona (at) asipto.com>
 +
 +</code>
  
 How-to about configuring syslog daemon to write the log messages from Kamailio SIP server in a dedicated file and rotate it when becomes too big. How-to about configuring syslog daemon to write the log messages from Kamailio SIP server in a dedicated file and rotate it when becomes too big.
  
 +This tutorial is updated for Kamailio v3.2.0 or newer (original tutorial written for [[http://www.kamailio.org/dokuwiki/doku.php/tutorials:debug-syslog-messages|older versions is here]]).
 ===== Syslog - Custom Log File ===== ===== Syslog - Custom Log File =====
  
Line 64: Line 75:
 Otherwise, add the piece of config above in **/etc/logrotate.conf**. Otherwise, add the piece of config above in **/etc/logrotate.conf**.
  
 +For **syslog-ng** the appropriate pid file has to be used, should be like:
 +
 +<code>
 +/var/log/kamailio.log {
 +    missingok
 +    size=50M
 +    create 0644 root root
 +    postrotate
 +    /bin/kill -HUP `cat /var/run/syslog-ng.pid 2> /dev/null` 2> /dev/null || true
 +    endscript
 +}
 +</code>
 +
 +You can test the existence of pid files before using kill, like:
 +
 +<code>
 +    if [ -f /var/run/syslog-ng.pid ]; then    \
 +        kill -HUP `cat /var/run/syslog-ng.pid`; \
 +    fi;
 +</code>
 +
 +
 +For **rsyslogd**:
 +
 +<code>
 +/var/log/kamailio.log {
 +        daily
 +        missingok
 +        rotate 14
 +        compress
 +        delaycompress
 +        create 0644 root adm
 +        postrotate
 +                /usr/lib/rsyslog/rsyslog-rotate
 +        endscript
 +}
 +</code>
tutorials/3.2.x/syslog.txt ยท Last modified: 2022/03/23 09:55 by miconda