text
stringlengths
0
152
persistent, optimistic, and tough.
Asterisk could be a useful component in a future-ready VoIP environment, serving at
least as a bridge between next-generation WebRTC products and old-school
telecommunications.
350
|
Chapter 20: WebRTC
CHAPTER 21
System Monitoring and Logging
Chaos is inherent in all compounded things. Strive on with diligence.
—The Buddha
Asterisk comes with several subsystems that allow you to obtain detailed information
about the workings of your system. Whether for troubleshooting or for tracking
usage for billing or staffing purposes, Asterisk’s various monitoring modules can help
you keep tabs on the inner workings of your system.
logger.conf
When troubleshooting issues in your Asterisk system, you will find it very helpful to
refer to some sort of historical record of what was going on in the system at the time
the reported issue occurred. The parameters for the storing of this information are
defined in /etc/asterisk/logger.conf.
Ideally, you might want the system to store a record of each and every thing it does.
However, there is a cost to doing this. On a busy system, with full debug logging
enabled, a large amount of data will be generated. Although storage is far cheaper
today than it was when Asterisk was young, it may still be necessary to achieve a bal‐
ance between detail and storage requirements.
The /etc/asterisk/logger.conf file allows you to define all sorts of different levels of log‐
ging, to multiple files if desired. This flexibility is excellent, but it can also be
confusing.
The format of an entry in the logger.conf file is as follows:
filename => type[,type[,type[,...]]]
351
We have already been working with the logger.conf file, so you will already have
entries in it similar to the following:
[general]
exec_after_rotate=gzip -9 ${filename}.2;
[logfiles]
;debug => debug
;console => notice,warning,error,verbose
console => notice,warning,error,debug
messages => notice,warning,error
full => notice,warning,error,debug,verbose,dtmf,fax
;full-json => [json]debug,verbose,notice,warning,error,dtmf,fax
;syslog keyword : This special keyword logs to syslog facility
;syslog.local0 => notice,warning,error
If you make any changes to this file, you will need to reload the logger by issuing the
following command from the shell:
$ sudo touch full messages
$ chown asterisk:asterisk /var/log/asterisk/*
$ asterisk -rx 'logger reload'
or from the Asterisk CLI:
*CLI> logger reload
Verbose Logging: Useful but Dangerous
We struggled with whether to recommend adding the following line to your log‐
ger.conf file:
verbose => notice,warning,error,verbose
This is quite possibly one of the most useful debugging tools you have when building
and troubleshooting a dialplan, and therefore it is highly recommended. The danger
comes from the fact that if you forget to disable this when you are done with your
debugging, you will have left a ticking time bomb in your Asterisk system, which will
slowly fill up the hard drive and kill your system one day, several months or years
from now, when you are least expecting it.
Use it. It’s fantastic. Just remember that you will need to manage your storage to
ensure your logfiles don’t fill up your drive!
You can specify any filename you want, but the special filename console will in fact
print the output to the Asterisk CLI, and not to any file on the hard drive. All other
filenames will be stored in the filesystem in the directory /var/log/asterisk. The log‐
ger.conf types are outlined in Table 21-1.
352
|
Chapter 21: System Monitoring and Logging