text
stringlengths
0
152
[Mar 11 …] VERBOSE[31362] logger.c: -- Hungup 'Zap/1-1'
This method does not guarantee that you will see everything relating to one call, since
a call could in theory spawn additional threads, but for basic dialplan debugging we
find this approach to be very useful when the call IDs from Asterisk 11 are not
available.
Logging to the Linux syslog Daemon
Linux contains a very powerful logging engine, which Asterisk can take advantage of.
While a discussion of all the various flavors of syslog and all the possible ways to
handle Asterisk logging would be beyond the scope of this book, suffice it to say that
if you want to have Asterisk send logs to the syslog daemon, you simply need to
specify the following in your /etc/asterisk/logger.conf file:
syslog.local0 => notice,warning,error ; or whatever type(s) you want to log
354
|
Chapter 21: System Monitoring and Logging
You will need a designation in your syslog configuration file1 named local0, which
should look something like:
local0.* /var/log/asterisk/syslog
You can use local0 through local7 for this, but check your
syslog.conf file to ensure that nothing else is using one of those
syslog channels.
The use of syslog2 allows for much more powerful logging, but it also requires more
knowledge than simply allowing Asterisk to log to files. It’s mostly going to be useful
if you’re already collecting other logs on the system into some centralized syslog
server.
Verifying Logging
You can view the status of all your logger.conf settings through the Asterisk CLI by
issuing the command:
*CLI> logger show channels
You should see output similar to:
Channel Type Status Configuration
------- ---- ------ -------------
syslog.local0 Syslog Enabled - NOTICE WARNING ERROR VERBOSE
/var/log/asterisk/verbose File Enabled - NOTICE WARNING ERROR VERBOSE
/var/log/asterisk/messages File Enabled - NOTICE WARNING ERROR
Console Enabled - NOTICE WARNING ERROR DTMF=
Log Rotation
There is some log rotation support built into Asterisk. Log rotation will be done in
the following cases:
• If you run the logger rotate Asterisk CLI command:
*CLI> logger rotate
• During a configuration reload if any existing logfiles are greater than 1 GB in size
• If Asterisk receives the SIGXFSZ signal, indicating that a file it was writing to is
too large
1 Which will normally be found at /etc/syslog.conf.
2 And rsyslog, syslog-ng, and what-all-else.
logger.conf
|
355
Call Detail Records
The CDR system in Asterisk is used to log the history of calls in the system. In some
deployments, these records are used for billing purposes. In others, call records are
used for analyzing call volumes over time. They can also be used as a debugging tool
by Asterisk administrators.
CDR Contents
A CDR has a number of fields that are included by default. Table 21-2 lists them.
Table 21-2. Default CDR fields
Option
accountcode
Value/example
12345
src
dst
12565551212
102
dcontext