Stop writing to /var/log/messages


#1

Hello all.

I can’not find the way how to stop Asterisk write to /var/log/messages.

CentOS Linux release 7.3.1611 (Core)
Asterisk 13.14.0 from https://tucny.com/telephony/asterisk-rpms

pbx ~ # asterisk -rx 'logger show channels'
Channel                                         Type     Status    Configuration
-------                                              ----     ------    -------------
/var/log/asterisk/messages.log      File     Enabled    - NOTICE WARNING ERROR 
                                      Console  Enabled    - NOTICE WARNING ERROR VERBOSE DTMF 
/var/log/asterisk/security.log          File     Enabled    - SECURITY 

logger.conf:

pbx ~ # grep -vE '^#|^$|^;' /etc/asterisk/logger.conf 
[general]
dateformat=%F %T       ; ISO 8601 date format
use_callids = yes
queue_log = no
queue_log_to_file = yes
rotatestrategy = rotate
exec_after_rotate=gzip -9 ${filename}.2

[logfiles]
security.log => security
console => notice,warning,error,dtmf,verbose
messages.log => notice,warning,error

rsyslog.conf:

$ModLoad imuxsock # provides support for local system logging (e.g. via logger command)
$ModLoad imjournal # provides access to the systemd journal
$WorkDirectory /var/lib/rsyslog
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
$IncludeConfig /etc/rsyslog.d/*.conf
$OmitLocalLogging on
$IMJournalStateFile imjournal.state
*.info;asterisk.none;mail.none;authpriv.none;cron.none                /var/log/messages
authpriv.*                                              /var/log/secure
mail.*                                                  -/var/log/maillog
cron.*                                                  /var/log/cron
*.emerg                                                 :omusrmsg:*
uucp,news.crit                                          /var/log/spooler
local7.*                                                /var/log/boot.log

I’ve already added ‘asterisk.none’ to the rsyslog.conf but nothing has changed. (Of course I reloaded daemons).


#2

Have you tried just comment above line ?


#3

Yes I tried, but it haven’t helped me.


#4

Did you do logger reload after commenting out above in logger.conf?

–Satish Barot


#5

sure. the entire Asterisk


#6

Hey Guys, I’m facing the same issue. Does Anyone have an idea?


#7

What issue exactly are you facing?

Details would be helpful.


#8

Hi Johnkiniston, I’m running Asterisk 13.17.1 in Centos 7.4. I commented the line ;messages => notice,warning,error,dtmf,fax cause I don’t wanna messages log, however it still filling up. Maybe it is a linux configuration, no Asterisk, I’m not sure. Is it possible?


#9

Did you issue a ‘logger reload’ after changing the logger.conf file?

issue a ‘logger show channels’ on the console and paste the results here as preformatted text.


#10

Yes, I issued reload. Here is the output show channels;

vrt1165*CLI> logger show channels
Logger queue limit: 1000

Channel Type Status Configuration


/var/log/asterisk/full File Enabled - NOTICE WARNING ERROR
Console Enabled - NOTICE WARNING ERROR VERBOSE


#11

And you are seeing data still being written to /var/log/asterisk/messages specifically?

or is it being written to /var/log/asterisk/full ?


#12

Yes, I’m stll see the log increasing. Actually the log is in /var/log/

[root@vrt1165 log]# tail /var/log/messages
Jan 16 20:53:57 vrt1165 asterisk: #033[1;30m > #033[0m0x7f8c4400fdf0 – Probation passed - setting RTP source address to 192.168.25.2:46902


#13

That’s quite odd, It sounds like syslog is what’s writing the messages.

Also the formatting of your log output looks odd, are you getting the output in color? Those look like control codes.

You don’t have anything set up in logger.conf to log to SYSLOG do you?


#14

I’d check also /etc/asterisk/asterisk.conf, the verbose option


#15

@johnkiniston, when it comes to output of messages it is in color. In logger.conf everything about syslog is commented. Below is my current configuration;

[general]
[logfiles]
console => notice,warning,error,verbose
full => notice,warning,error

Others lines are commented.

@cerien.jean I checked my asterisk.conf, here is the configuration;

directories
astetcdir => /etc/asterisk
astmoddir => /usr/lib64/asterisk/modules
astvarlibdir => /var/lib/asterisk
astdbdir => /var/lib/asterisk
astkeydir => /var/lib/asterisk
astdatadir => /var/lib/asterisk
astagidir => /var/lib/asterisk/agi-bin
astspooldir => /var/spool/asterisk
astrundir => /var/run/asterisk
astlogdir => /var/log/asterisk
astsbindir => /usr/sbin

[options]
verbose = 15
debug = 4
maxfiles = 4096
documentation_language = en_US

[compat]
pbx_realtime=1.6
res_agi=1.6
app_set=1.6

Other lines are commented.


#16

OK, Let’s try something.

edit /usr/sbin/safe_asterisk

change CONSOLE=yes to CONSOLE=no

stop asterisk and start it again from init or upstart or whatever you use.


#17

johnkiniston thanks for response. I did as you told me, but it still increasing. Instead stop and start asterisk should I reboot linux?


#18

I don’t think a reboot would help.

I’m not sure what to suggest at this point in time, I have never seen Asterisk behave like this, it’s very strange.


#19

That’s because it’s not Asterisk behaving that way. It seems as though something else is trapping the messages from the Asterisk console and storing them. I vaguely recall some people have made their systemd unit files do this for Asterisk.


#20

Thanks for response guys! I’ll see in a lab and running some test.