opensips and syslog facility/level

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

opensips and syslog facility/level

Oleksandr Kunytsia
Hello,

Logging of my opensips looks like the following:

----cut---- 
log_facility=LOG_LOCAL2
log_stderror=no
----cut----

Opensips sends logging information as LOCAL2.error messages,

How to configure to send messages with another log_level? e.g. local2.info?

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: opensips and syslog facility/level

shaheryarkh
You can set opensips log level using "debug" parameter.

http://www.opensips.org/Documentation/Script-CoreParameters-1-11#toc35

Also make sure your syslog service is configured to send local2.* logs to the log file(s) where you want to see them. i.e. to see all opensips logs file named opensips.log set /etc/rsyslog.conf to have entry like this,

local2.*  /var/log/opensips.log

Then restart the service.

Hope this helps.

Thank you.




On Wed, Aug 6, 2014 at 10:49 AM, Oleksandr Kunytsia <[hidden email]> wrote:
Hello,

Logging of my opensips looks like the following:

----cut---- 
log_facility=LOG_LOCAL2
log_stderror=no
----cut----

Opensips sends logging information as LOCAL2.error messages,

How to configure to send messages with another log_level? e.g. local2.info?

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: opensips and syslog facility/level

Liviu Chircu
In reply to this post by Oleksandr Kunytsia
Hello Oleksandr,

OpenSIPS should make use of all logging "levels" of syslog (man 3 syslog). Its entire logging system is actually based upon the actual levels of syslog itself. The only logging level which isn't used is LOG_EMERG.

If you are able to reproduce a unexpected behaviour (e.g. setting "log_level = 4" in the script, and OpenSIPS logs everything at local0.error), please post a report on the GitHub issues tracker [1].

[1]: https://github.com/OpenSIPS/opensips/issues

Best regards,
Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com
On 08/06/2014 08:49 AM, Oleksandr Kunytsia wrote:
Hello,

Logging of my opensips looks like the following:

----cut---- 
log_facility=LOG_LOCAL2
log_stderror=no
----cut----

Opensips sends logging information as LOCAL2.error messages,

How to configure to send messages with another log_level? e.g. local2.info?


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: opensips and syslog facility/level

Oleksandr Kunytsia
Hello, Liviu Chircu

Did I understand correct, that OpenSIPS should use logging level according to the situation?






On Wed, Aug 6, 2014 at 12:14 PM, Liviu Chircu <[hidden email]> wrote:
Hello Oleksandr,

OpenSIPS should make use of all logging "levels" of syslog (man 3 syslog). Its entire logging system is actually based upon the actual levels of syslog itself. The only logging level which isn't used is LOG_EMERG.

If you are able to reproduce a unexpected behaviour (e.g. setting "log_level = 4" in the script, and OpenSIPS logs everything at local0.error), please post a report on the GitHub issues tracker [1].

[1]: https://github.com/OpenSIPS/opensips/issues

Best regards,
Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com
On 08/06/2014 08:49 AM, Oleksandr Kunytsia wrote:
Hello,

Logging of my opensips looks like the following:

----cut---- 
log_facility=LOG_LOCAL2
log_stderror=no
----cut----

Opensips sends logging information as LOCAL2.error messages,

How to configure to send messages with another log_level? e.g. local2.info?


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: opensips and syslog facility/level

Liviu Chircu
Exactly. ERROR logs should go to local0.error, while INFO logs should go to local0.info, for example.
Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com
On 08/06/2014 05:46 PM, Oleksandr Kunytsia wrote:
Hello, Liviu Chircu

Did I understand correct, that OpenSIPS should use logging level according to the situation?






On Wed, Aug 6, 2014 at 12:14 PM, Liviu Chircu <[hidden email]> wrote:
Hello Oleksandr,

OpenSIPS should make use of all logging "levels" of syslog (man 3 syslog). Its entire logging system is actually based upon the actual levels of syslog itself. The only logging level which isn't used is LOG_EMERG.

If you are able to reproduce a unexpected behaviour (e.g. setting "log_level = 4" in the script, and OpenSIPS logs everything at local0.error), please post a report on the GitHub issues tracker [1].

[1]: https://github.com/OpenSIPS/opensips/issues

Best regards,
Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com
On 08/06/2014 08:49 AM, Oleksandr Kunytsia wrote:
Hello,

Logging of my opensips looks like the following:

----cut---- 
log_facility=LOG_LOCAL2
log_stderror=no
----cut----

Opensips sends logging information as LOCAL2.error messages,

How to configure to send messages with another log_level? e.g. local2.info?


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users




_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: opensips and syslog facility/level

Oleksandr Kunytsia
In reply to this post by shaheryarkh
on my config debug set to 0:
----

#
# GLOBALS
#
debug=0
log_facility=LOG_LOCAL2
log_stderror=no
------


I also configured rsyslog for saving LOCAL2 to file with specific template:
----
$template precise,"%pri-text%: %timegenerated% %HOSTNAME% %syslogtag%%msg%\n"  
local2.*                       -/var/log/sips.log;precise  
----

extract from  /var/log/sips.log:

local2.err<147>: Aug  6 17:18:52 r-sip opensips[5588]: new-int INVITE[PhoneNUM,PhoneNUM57]: SIP 404 after 19161ms from IP.ADD.RE.SS
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5612]: r-lt1 INVITE[+1PhoneNUM,PhoneNUM1]: SIP 180 after 25905ms from IP.ADD.RE.SS
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5592]: r-lt1 INVITE[+1PhoneNUM,PhoneNUM5]: relayed IP.ADD.RE.SS outbound to IP.ADD.RE.SS
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5600]: r-in1 INVITE[+1PhoneNUM,PhoneNUM7]: relayed IP.ADD.RE.SS outbound to IP.ADD.RE.SS
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5588]: new-int INVITE[PhoneNUM7,PhoneNUM]: relayed IP.ADD.RE.SS outbound to IP.ADD.RE.SS
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5560]: r-in1 INVITE[+PhoneNUM,PhoneNUM437]: SIP 100 after 3ms from IP.ADD.RE.SS
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5650]: r-lt1 INVITE[800PhoneNUM,PhoneNUM248]: relayed IP.ADD.RE.SS outbound to IP.ADD.RE.SS
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5622]: r-lt1 INVITE[+PhoneNUM,PhoneNUM015]: SIP 100 after 9ms from IP.ADD.RE.SS
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5624]: Broadvox BYE[PhoneNUM,PhoneNUM00] existing dialog
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5604]: r-in1 INVITE[80PhoneNUM,PhoneNUM213]: SIP 183 after 7270ms from IP.ADD.RE.SS


On Wed, Aug 6, 2014 at 11:17 AM, Muhammad Shahzad <[hidden email]> wrote:
You can set opensips log level using "debug" parameter.

http://www.opensips.org/Documentation/Script-CoreParameters-1-11#toc35

Also make sure your syslog service is configured to send local2.* logs to the log file(s) where you want to see them. i.e. to see all opensips logs file named opensips.log set /etc/rsyslog.conf to have entry like this,

local2.*  /var/log/opensips.log

Then restart the service.

Hope this helps.

Thank you.




On Wed, Aug 6, 2014 at 10:49 AM, Oleksandr Kunytsia <[hidden email]> wrote:
Hello,

Logging of my opensips looks like the following:

----cut---- 
log_facility=LOG_LOCAL2
log_stderror=no
----cut----

Opensips sends logging information as LOCAL2.error messages,

How to configure to send messages with another log_level? e.g. local2.info?

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: opensips and syslog facility/level

Liviu Chircu
I understand what's happening now. The thing is, if you use xlog() with only 1 parameter in your script, that message will simply go to syslog's LOG_ERR (it should be visible!).

You can control the logging level within your script with xlog("L_NOTICE", ".....") or xlog("L_DBG", "...") for example.

Best regards,
Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com
On 08/06/2014 08:29 PM, Oleksandr Kunytsia wrote:
on my config debug set to 0:
----

#
# GLOBALS
#
debug=0
log_facility=LOG_LOCAL2
log_stderror=no
------


I also configured rsyslog for saving LOCAL2 to file with specific template:
----
$template precise,"%pri-text%: %timegenerated% %HOSTNAME% %syslogtag%%msg%\n"  
local2.*                       -/var/log/sips.log;precise  
----

extract from  /var/log/sips.log:

local2.err<147>: Aug  6 17:18:52 r-sip opensips[5588]: new-int INVITE[PhoneNUM,PhoneNUM57]: SIP 404 after 19161ms from IP.ADD.RE.SS
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5612]: r-lt1 INVITE[+1PhoneNUM,PhoneNUM1]: SIP 180 after 25905ms from IP.ADD.RE.SS
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5592]: r-lt1 INVITE[+1PhoneNUM,PhoneNUM5]: relayed IP.ADD.RE.SS outbound to IP.ADD.RE.SS
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5600]: r-in1 INVITE[+1PhoneNUM,PhoneNUM7]: relayed IP.ADD.RE.SS outbound to IP.ADD.RE.SS
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5588]: new-int INVITE[PhoneNUM7,PhoneNUM]: relayed IP.ADD.RE.SS outbound to IP.ADD.RE.SS
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5560]: r-in1 INVITE[+PhoneNUM,PhoneNUM437]: SIP 100 after 3ms from IP.ADD.RE.SS
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5650]: r-lt1 INVITE[800PhoneNUM,PhoneNUM248]: relayed IP.ADD.RE.SS outbound to IP.ADD.RE.SS
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5622]: r-lt1 INVITE[+PhoneNUM,PhoneNUM015]: SIP 100 after 9ms from IP.ADD.RE.SS
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5624]: Broadvox BYE[PhoneNUM,PhoneNUM00] existing dialog
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5604]: r-in1 INVITE[80PhoneNUM,PhoneNUM213]: SIP 183 after 7270ms from IP.ADD.RE.SS


On Wed, Aug 6, 2014 at 11:17 AM, Muhammad Shahzad <[hidden email]> wrote:
You can set opensips log level using "debug" parameter.

http://www.opensips.org/Documentation/Script-CoreParameters-1-11#toc35

Also make sure your syslog service is configured to send local2.* logs to the log file(s) where you want to see them. i.e. to see all opensips logs file named opensips.log set /etc/rsyslog.conf to have entry like this,

local2.*  /var/log/opensips.log

Then restart the service.

Hope this helps.

Thank you.




On Wed, Aug 6, 2014 at 10:49 AM, Oleksandr Kunytsia <[hidden email]> wrote:
Hello,

Logging of my opensips looks like the following:

----cut---- 
log_facility=LOG_LOCAL2
log_stderror=no
----cut----

Opensips sends logging information as LOCAL2.error messages,

How to configure to send messages with another log_level? e.g. local2.info?

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users




_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: opensips and syslog facility/level

Oleksandr Kunytsia
Hello Liviu,

I've got local developer to test changes, so I can test now your suggestions:

I started with such change:

---------------------------

startup_route {
        #xlog("using localhost for routing");
        xlog("L_INFO"," L-INFO using localhost for routing");
        xlog("L_NOTICE"," L_NOTICE using localhost for routing");
        xlog(" no LEVEL using localhost for routing");

---------------------------

After I restarted opensips I got only one line in logs:

==> /var/log/sips.log <==
local2.err<147>: Aug 12 14:44:05 sip1 /usr/sbin/opensips[28615]:  no LEVEL using localhost for routing

--------

What is the reason of that?

# /usr/sbin/opensips -V
version: opensips 1.7.1-tls (x86_64/linux)
flags: STATS: Off, USE_IPV6, USE_TCP, USE_TLS, DISABLE_NAGLE, USE_MCAST, SHM_MEM, SHM_MMAP, PKG_MALLOC, F_MALLOC, FAST_LOCK-ADAPTIVE_WAIT
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
svnrevision: unknown
@(#) $Id: main.c 8537 2011-11-08 17:02:11Z bogdan_iancu $
main.c compiled on 22:15:48 Nov 23 2011 with gcc 4.1.2

/Oleksandr


On Thu, Aug 7, 2014 at 2:25 PM, Liviu Chircu <[hidden email]> wrote:
I understand what's happening now. The thing is, if you use xlog() with only 1 parameter in your script, that message will simply go to syslog's LOG_ERR (it should be visible!).

You can control the logging level within your script with xlog("L_NOTICE", ".....") or xlog("L_DBG", "...") for example.

Best regards,
Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com
On 08/06/2014 08:29 PM, Oleksandr Kunytsia wrote:
on my config debug set to 0:
----

#
# GLOBALS
#
debug=0
log_facility=LOG_LOCAL2
log_stderror=no
------


I also configured rsyslog for saving LOCAL2 to file with specific template:
----
$template precise,"%pri-text%: %timegenerated% %HOSTNAME% %syslogtag%%msg%\n"  
local2.*                       -/var/log/sips.log;precise  
----

extract from  /var/log/sips.log:

local2.err<147>: Aug  6 17:18:52 r-sip opensips[5588]: new-int INVITE[PhoneNUM,PhoneNUM57]: SIP 404 after 19161ms from IP.ADD.RE.SS
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5612]: r-lt1 INVITE[+1PhoneNUM,PhoneNUM1]: SIP 180 after 25905ms from IP.ADD.RE.SS
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5592]: r-lt1 INVITE[+1PhoneNUM,PhoneNUM5]: relayed IP.ADD.RE.SS outbound to IP.ADD.RE.SS
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5600]: r-in1 INVITE[+1PhoneNUM,PhoneNUM7]: relayed IP.ADD.RE.SS outbound to IP.ADD.RE.SS
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5588]: new-int INVITE[PhoneNUM7,PhoneNUM]: relayed IP.ADD.RE.SS outbound to IP.ADD.RE.SS
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5560]: r-in1 INVITE[+PhoneNUM,PhoneNUM437]: SIP 100 after 3ms from IP.ADD.RE.SS
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5650]: r-lt1 INVITE[800PhoneNUM,PhoneNUM248]: relayed IP.ADD.RE.SS outbound to IP.ADD.RE.SS
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5622]: r-lt1 INVITE[+PhoneNUM,PhoneNUM015]: SIP 100 after 9ms from IP.ADD.RE.SS
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5624]: Broadvox BYE[PhoneNUM,PhoneNUM00] existing dialog
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5604]: r-in1 INVITE[80PhoneNUM,PhoneNUM213]: SIP 183 after 7270ms from IP.ADD.RE.SS


On Wed, Aug 6, 2014 at 11:17 AM, Muhammad Shahzad <[hidden email]> wrote:
You can set opensips log level using "debug" parameter.

http://www.opensips.org/Documentation/Script-CoreParameters-1-11#toc35

Also make sure your syslog service is configured to send local2.* logs to the log file(s) where you want to see them. i.e. to see all opensips logs file named opensips.log set /etc/rsyslog.conf to have entry like this,

local2.*  /var/log/opensips.log

Then restart the service.

Hope this helps.

Thank you.




On Wed, Aug 6, 2014 at 10:49 AM, Oleksandr Kunytsia <[hidden email]> wrote:
Hello,

Logging of my opensips looks like the following:

----cut---- 
log_facility=LOG_LOCAL2
log_stderror=no
----cut----

Opensips sends logging information as LOCAL2.error messages,

How to configure to send messages with another log_level? e.g. local2.info?

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users




_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: opensips and syslog facility/level

Liviu Chircu
Hello Oleksandr,

By default, OpenSIPS should start with "debug = 2". So unless you've explicitly set a lower value within your script, all three messages should be logged.

To troubleshoot this, when doing this test, could you also run a "opensipsctl fifo debug" command and paste the output here?
(make sure to load the mi_fifo module if it's not already there)

Best regards,
Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com
On 08/13/2014 12:48 AM, Oleksandr Kunytsia wrote:
Hello Liviu,

I've got local developer to test changes, so I can test now your suggestions:

I started with such change:

---------------------------

startup_route {
        #xlog("using localhost for routing");
        xlog("L_INFO"," L-INFO using localhost for routing");
        xlog("L_NOTICE"," L_NOTICE using localhost for routing");
        xlog(" no LEVEL using localhost for routing");

---------------------------

After I restarted opensips I got only one line in logs:

==> /var/log/sips.log <==
local2.err<147>: Aug 12 14:44:05 sip1 /usr/sbin/opensips[28615]:  no LEVEL using localhost for routing

--------

What is the reason of that?

# /usr/sbin/opensips -V
version: opensips 1.7.1-tls (x86_64/linux)
flags: STATS: Off, USE_IPV6, USE_TCP, USE_TLS, DISABLE_NAGLE, USE_MCAST, SHM_MEM, SHM_MMAP, PKG_MALLOC, F_MALLOC, FAST_LOCK-ADAPTIVE_WAIT
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
svnrevision: unknown
@(#) $Id: main.c 8537 2011-11-08 17:02:11Z bogdan_iancu $
main.c compiled on 22:15:48 Nov 23 2011 with gcc 4.1.2

/Oleksandr


On Thu, Aug 7, 2014 at 2:25 PM, Liviu Chircu <[hidden email]> wrote:
I understand what's happening now. The thing is, if you use xlog() with only 1 parameter in your script, that message will simply go to syslog's LOG_ERR (it should be visible!).

You can control the logging level within your script with xlog("L_NOTICE", ".....") or xlog("L_DBG", "...") for example.

Best regards,
Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com
On 08/06/2014 08:29 PM, Oleksandr Kunytsia wrote:
on my config debug set to 0:
----

#
# GLOBALS
#
debug=0
log_facility=LOG_LOCAL2
log_stderror=no
------


I also configured rsyslog for saving LOCAL2 to file with specific template:
----
$template precise,"%pri-text%: %timegenerated% %HOSTNAME% %syslogtag%%msg%\n"  
local2.*                       -/var/log/sips.log;precise  
----

extract from  /var/log/sips.log:

local2.err<147>: Aug  6 17:18:52 r-sip opensips[5588]: new-int INVITE[PhoneNUM,PhoneNUM57]: SIP 404 after 19161ms from IP.ADD.RE.SS
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5612]: r-lt1 INVITE[+1PhoneNUM,PhoneNUM1]: SIP 180 after 25905ms from IP.ADD.RE.SS
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5592]: r-lt1 INVITE[+1PhoneNUM,PhoneNUM5]: relayed IP.ADD.RE.SS outbound to IP.ADD.RE.SS
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5600]: r-in1 INVITE[+1PhoneNUM,PhoneNUM7]: relayed IP.ADD.RE.SS outbound to IP.ADD.RE.SS
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5588]: new-int INVITE[PhoneNUM7,PhoneNUM]: relayed IP.ADD.RE.SS outbound to IP.ADD.RE.SS
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5560]: r-in1 INVITE[+PhoneNUM,PhoneNUM437]: SIP 100 after 3ms from IP.ADD.RE.SS
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5650]: r-lt1 INVITE[800PhoneNUM,PhoneNUM248]: relayed IP.ADD.RE.SS outbound to IP.ADD.RE.SS
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5622]: r-lt1 INVITE[+PhoneNUM,PhoneNUM015]: SIP 100 after 9ms from IP.ADD.RE.SS
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5624]: Broadvox BYE[PhoneNUM,PhoneNUM00] existing dialog
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5604]: r-in1 INVITE[80PhoneNUM,PhoneNUM213]: SIP 183 after 7270ms from IP.ADD.RE.SS


On Wed, Aug 6, 2014 at 11:17 AM, Muhammad Shahzad <[hidden email]> wrote:
You can set opensips log level using "debug" parameter.

http://www.opensips.org/Documentation/Script-CoreParameters-1-11#toc35

Also make sure your syslog service is configured to send local2.* logs to the log file(s) where you want to see them. i.e. to see all opensips logs file named opensips.log set /etc/rsyslog.conf to have entry like this,

local2.*  /var/log/opensips.log

Then restart the service.

Hope this helps.

Thank you.




On Wed, Aug 6, 2014 at 10:49 AM, Oleksandr Kunytsia <[hidden email]> wrote:
Hello,

Logging of my opensips looks like the following:

----cut---- 
log_facility=LOG_LOCAL2
log_stderror=no
----cut----

Opensips sends logging information as LOCAL2.error messages,

How to configure to send messages with another log_level? e.g. local2.info?

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users




_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users




_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: opensips and syslog facility/level

Oleksandr Kunytsia
Hello Liviu,

As I mentioned before, on my config
debug=0,
the same shows `opensipsctl fifo debug`
DEBUG:: 0

When I commented out debug parameter from config, on restart opensips logs the following:
-----------
==> /var/log/sips.log <==
local2.notice<149>: Aug 13 07:12:00 sip1 /usr/sbin/opensips[24117]: NOTICE:core:main: version: opensips 1.7.1-tls (x86_64/linux)
local2.notice<149>: Aug 13 07:12:00 sip1 /usr/sbin/opensips[24117]: NOTICE:signaling:mod_init: initializing module ...
local2.warn<148>: Aug 13 07:12:00 sip1 /usr/sbin/opensips[24117]: WARNING:core:mk_net: invalid network address/netmask combination fixed...
local2.notice<149>: Aug 13 07:12:00 sip1 /usr/sbin/opensips[24121]:  L_NOTICE using localhost for routing
local2.err<147>: Aug 13 07:12:00 sip1 /usr/sbin/opensips[24121]:  no LEVEL using localhost for routing
----------------------------

So only 2 of 3 messages have been logged. 

I found that it would prints all those 3 messages (as well as a lot of other INFO msgs :) if I put 'debug=3' on config file.


=========

 xlog([level,] format)

Print a formated message using LOG function.
Meaning of the parameters are as follows:
level - The level that will be used in LOG function. It can be:

L_ALERT - log level -3
L_CRIT - log level -2
L_ERR - log level -1
L_WARN - log level 1
L_NOTICE - log level 2
L_INFO - log level 3
L_DBG - log level 4
If the log level is higher than the “debug” global parameter, the message is not printed to syslog.
If this parameter is missing, the implicit log level is 'L_ERR'.
===========




On Wed, Aug 13, 2014 at 8:41 AM, Liviu Chircu <[hidden email]> wrote:
Hello Oleksandr,

By default, OpenSIPS should start with "debug = 2". So unless you've explicitly set a lower value within your script, all three messages should be logged.

To troubleshoot this, when doing this test, could you also run a "opensipsctl fifo debug" command and paste the output here?
(make sure to load the mi_fifo module if it's not already there)

Best regards,
Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com
On 08/13/2014 12:48 AM, Oleksandr Kunytsia wrote:
Hello Liviu,

I've got local developer to test changes, so I can test now your suggestions:

I started with such change:

---------------------------

startup_route {
        #xlog("using localhost for routing");
        xlog("L_INFO"," L-INFO using localhost for routing");
        xlog("L_NOTICE"," L_NOTICE using localhost for routing");
        xlog(" no LEVEL using localhost for routing");

---------------------------

After I restarted opensips I got only one line in logs:

==> /var/log/sips.log <==
local2.err<147>: Aug 12 14:44:05 sip1 /usr/sbin/opensips[28615]:  no LEVEL using localhost for routing

--------

What is the reason of that?

# /usr/sbin/opensips -V
version: opensips 1.7.1-tls (x86_64/linux)
flags: STATS: Off, USE_IPV6, USE_TCP, USE_TLS, DISABLE_NAGLE, USE_MCAST, SHM_MEM, SHM_MMAP, PKG_MALLOC, F_MALLOC, FAST_LOCK-ADAPTIVE_WAIT
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
svnrevision: unknown
@(#) $Id: main.c 8537 2011-11-08 17:02:11Z bogdan_iancu $
main.c compiled on 22:15:48 Nov 23 2011 with gcc 4.1.2

/Oleksandr


On Thu, Aug 7, 2014 at 2:25 PM, Liviu Chircu <[hidden email]> wrote:
I understand what's happening now. The thing is, if you use xlog() with only 1 parameter in your script, that message will simply go to syslog's LOG_ERR (it should be visible!).

You can control the logging level within your script with xlog("L_NOTICE", ".....") or xlog("L_DBG", "...") for example.

Best regards,
Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com
On 08/06/2014 08:29 PM, Oleksandr Kunytsia wrote:
on my config debug set to 0:
----

#
# GLOBALS
#
debug=0
log_facility=LOG_LOCAL2
log_stderror=no
------


I also configured rsyslog for saving LOCAL2 to file with specific template:
----
$template precise,"%pri-text%: %timegenerated% %HOSTNAME% %syslogtag%%msg%\n"  
local2.*                       -/var/log/sips.log;precise  
----

extract from  /var/log/sips.log:

local2.err<147>: Aug  6 17:18:52 r-sip opensips[5588]: new-int INVITE[PhoneNUM,PhoneNUM57]: SIP 404 after 19161ms from IP.ADD.RE.SS
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5612]: r-lt1 INVITE[+1PhoneNUM,PhoneNUM1]: SIP 180 after 25905ms from IP.ADD.RE.SS
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5592]: r-lt1 INVITE[+1PhoneNUM,PhoneNUM5]: relayed IP.ADD.RE.SS outbound to IP.ADD.RE.SS
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5600]: r-in1 INVITE[+1PhoneNUM,PhoneNUM7]: relayed IP.ADD.RE.SS outbound to IP.ADD.RE.SS
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5588]: new-int INVITE[PhoneNUM7,PhoneNUM]: relayed IP.ADD.RE.SS outbound to IP.ADD.RE.SS
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5560]: r-in1 INVITE[+PhoneNUM,PhoneNUM437]: SIP 100 after 3ms from IP.ADD.RE.SS
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5650]: r-lt1 INVITE[800PhoneNUM,PhoneNUM248]: relayed IP.ADD.RE.SS outbound to IP.ADD.RE.SS
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5622]: r-lt1 INVITE[+PhoneNUM,PhoneNUM015]: SIP 100 after 9ms from IP.ADD.RE.SS
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5624]: Broadvox BYE[PhoneNUM,PhoneNUM00] existing dialog
local2.err<147>: Aug  6 17:18:52 r-sip opensips[5604]: r-in1 INVITE[80PhoneNUM,PhoneNUM213]: SIP 183 after 7270ms from IP.ADD.RE.SS


On Wed, Aug 6, 2014 at 11:17 AM, Muhammad Shahzad <[hidden email]> wrote:
You can set opensips log level using "debug" parameter.

http://www.opensips.org/Documentation/Script-CoreParameters-1-11#toc35

Also make sure your syslog service is configured to send local2.* logs to the log file(s) where you want to see them. i.e. to see all opensips logs file named opensips.log set /etc/rsyslog.conf to have entry like this,

local2.*  /var/log/opensips.log

Then restart the service.

Hope this helps.

Thank you.




On Wed, Aug 6, 2014 at 10:49 AM, Oleksandr Kunytsia <[hidden email]> wrote:
Hello,

Logging of my opensips looks like the following:

----cut---- 
log_facility=LOG_LOCAL2
log_stderror=no
----cut----

Opensips sends logging information as LOCAL2.error messages,

How to configure to send messages with another log_level? e.g. local2.info?

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users




_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users




_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users