2008年9月25日 星期四

How-to: 改變Asterisk的Log檔位置

1. How to change the directory of log file of asterisk?

--> change asterisk.conf:

[directories]
astetcdir => /etc/asterisk
astspooldir => /var/spool/asterisk
astvarlibdir => /var/lib/asterisk
astdatadir => /var/lib/asterisk
astlogdir => /var/log/asterisk ; the directory of Asterisk log files, just assign it to the directory we want
astagidir => /var/lib/asterisk/agi-bin
astrundir => /var/run
astmoddir => /usr/lib/asterisk/modules

2. If you want to change the name of log file:

--> change logger.conf:

[logfiles] section

debug => debug
console => notice,warning,error
messages => notice,warning,error
;At present the name of log file is messages. if we want to replace the filesname, just remove this line and replace with a line with different filename, the format is: filename => [log levels] . legal log levels includes: notice, warning, error, debug, verbose .
full => notice,warning,error,verbose
syslog.local0 => notice,warning,error



















LevelDescription
verboseGeneral 'chatter' about what is
happening on the system.
Verbosity levels greater than 3
display dialplan commands as
they are executed. This generates lots of log information
debugDebug messages, normally only
used by programmers to extract
extended information
noticeNon urgent alert messages
warningWarning alert messages,
something happened that might
be bad. Some tell you how badthe warning is
errorError messages, something bad
happened – These should be rare.


3. If you want to rotate the log:

You can rotate logs by running "logger rotate" on the CLI.
You can do this from cron by putting the following in a cron job:
/usr/sbin/asterisk -r -x 'logger rotate'


References:
1. The Little Asterisk Handbook
http://www.automated.it/asterisk/lah-3-6-05_5.html

沒有留言: