Asterisk Voip

Logging in Asterisk



Sometimes, when debugging an issue, it’s useful to see and log extra information and at other times, you want logging to be minimal.
Asterisk has different types of message that can be logged. These are:
  • debug
  • notice
  • warning
  • error
  • verbose
  • dtmf
  • fax

logger.conf

Asterisk provides a number of ways of logging information. The logger.conf file (Location: /etc/asterisk/logger.conf) contains the configuration elements for logging.
;
; Logging Configuration
;
[general]
;
[logfiles]
debug => debug
messages => warning,error
console => notice,warning,error,debug,verbose,dtmf,fax
Arrow The first line tells Asterisk to log debug messages (the right side of the =>) to a file called debug (the left side of the =>) located in /var/log/asterisk/.
Arrow The second line tells Asterisk to log warning and error messages to a file called messages located in /var/log/asterisk/.
Arrow The third line tells Asterisk to send all messages to the CLI console.

asterisk.conf

The log directory can be changed by modifying the line astlogdir => /var/log/asterisk to point to the desired directory in the asterisk.conf file (Location: /etc/asterisk/asterisk.conf).
There are various levels of verbosity and debugging. Use set verbose or set debug followed by a numerical value to change them. Useful values range from 0 (disabled) to 10 (maximum) for verbosity and debugging levels.
To change verbosity and debugging levels, run the following commands in a CLI console:
core set verbose 10
; This sets verbosity at level 10
core set debug 10
; This sets debugging at level 10
You can also increase (but not decrease) the verbosity level when you connect to the Asterisk CLI from the Linux prompt, by using one or more -v parameters to the asterisk application.
To connect to the Asterisk CLI and set the verbosity level to three (because there are three -v parameters), run the following command in a console:
asterisk -vvvr
You can also increase (but not decrease) the debugging level when you connect to the Asterisk CLI from the Linux prompt, by using one or more -d parameters to the asterisk application.
To connect to the Asterisk CLI and set the debug level to three (because there are three -d parameters), run the following command in a console:
asterisk -dddr
It is also possible to activate other types of debug system: (see asterisk CLI command)
  • core set debug channel <all|channel> [off]
  • agi set debug [on|off]
  • iax2 set debug {on|off|peer}
  • sip set debug {on|off|ip|peer}
Rotating logs
Rotate logs by running the following command in the CLI console:
  • logger rotate
You can also do by putting the following command in a cron job:
  • /usr/sbin/asterisk -rx ‘logger rotate’
http://asteriskvoipsystem.org/logging-in-asterisk/


Title Post: Logging in Asterisk
Rating:
5/5 5

: We on G+

Thanks for read this post.

Post a Comment

 
Return to top of page Copyright © 2013