[OpenSIPS-Users] Run Server in background with maximum debug to log file

Richard Revels rrevels at bandwidth.com
Sun Jan 11 14:38:12 CET 2009


Man Pages are your friend.  When you divert opensips messages to  
another logging file or destination you also need to stop them from  
going to the standard messages file.  Here are a couple of pertinent  
entries from a syslog-ng (gentoo) and rsyslog (CentOS) config.  The  
remote destination entries are looking for pkg_memory errors which are  
then forwarded to a syslog instance on a monitoring server.  If you  
are using something like Zenoss or Solarwinds these messages can  
trigger alerts and all that network monitoring type stuff.


syslog-ng.conf

#any message caught by filter local7 goes to file defined as openser- 
$YEAR-$MONTH
destination local7 { file( "/var/log/openser-$YEAR-$MONTH" ); };
#send pkg_memory errors to remote syslog
destination zenoss {udp("192.168.0.1" port(514));


#grab messages from opensips and keep them from also going to messages  
file.
filter local7_filter { facility( local7 ); };
filter messages_filter { not facility( local7 ); };

#grab messages dealing with memory
filter f_out_of_pkg_memory { match("out of pkg memory"); };
filter f_pkg_memory_allocation_failure { match("pkg memory allocation  
failure"); };
filter f_no_more_share_memory { match("no more share memory"); };
filter f_out_of_mem { match("out of mem"); };
filter f_no_shm_mem { match("no more shm mem"); };
filter f_no_pkg_mem { match("no more pkg mem"); };

#we've got sources, destinations, and filtered messages.  send them
log { source( src ); filter( local7_filter ); destination( local7 ); };
log { source(src); filter(f_out_of_pkg_memory); destination(zenoss); };
log { source(src); filter(f_pkg_memory_allocation_failure);  
destination(zenoss); };
log { source(src); filter(f_no_shm_mem); destination(zenoss); };
log { source(src); filter(f_no_pkg_mem); destination(zenoss); };
log { source(src); filter(f_no_more_share_memory);  
destination(zenoss); };

rsyslog is somewhat easier to deal with.

rsyslog.conf

#send lots of stuff to messages file but not local7 opensips stuff
*.info;mail.none;authpriv.none;cron.none;local7.none    /var/log/ 
messages

#log opensips messages to own log
local7.*						/var/log/opensips.log

#send some messages to zenoss
:msg, contains, "INFO:core:probe_max_receive_buffer"    @192.168.0.1:514
:msg, contains, "pkg"	@192.168.0.1:514

It should be noted that the rsyslog default on Cent uses facility 7  
for boot messages so you will either want to change to a different  
facility in the opensips config or change rsyslog.conf  to use  
something else for boot messages.

Richard





On Jan 11, 2009, at 12:21 AM, Wasin Thiengkunagrit wrote:

> Dear  Iñaki Baz Castillo,
>
> I'm running Opensips on Ubuntu 8.10. And I've found out that the log  
> appear on
> both /var/log/syslog and /var/log/opensips. The log messages are
> almost the same.
> I think that OpenSips forwarding all log to /var/log/opensips and some
> of the duplicate messages
> to /var/log/syslog.
>
> Wasin
>
>
>
> 2009/1/11 Iñaki Baz Castillo <ibc at aliax.net>:
>> El Domingo, 11 de Enero de 2009, Wasin Thiengkunagrit escribió:
>>> Additionally you can
>>> redirect the log result to another file (which is not syslog) by  
>>> doing
>>> this steps
>>> 1. Set the "log_facility=LOG_LOCAL7"
>>> 2. edit file /etc/syslog.conf  by adding this line to the end of the
>>> file "local7.* /var/log/opensips"
>>> 3. create the initial log file with command "$echo "" > /var/log/ 
>>> opensips"
>>> 4. restart syslog deamon with command "$/etc/init.d/sysklogd  
>>> restart"
>>> 5. restart your OpenSips again this should log every messages into
>>> /var/log/opensips file
>>
>> Those steps make OpenSIPS log appearing in /var/log/opensips, but  
>> still
>> remains appearing in /var/log/syslog, at least in Debian Etch  
>> following step
>> by step your explanation.
>>
>> This is something I've never got (logging OpenSIPS to any file but  
>> syslog).
>>
>> Regards.
>>
>> --
>> Iñaki Baz Castillo
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users




More information about the Users mailing list