Re: [asterisk-users] Problems sending log to rsyslog

2013-09-27 Thread Mauricio Tavares
On Thu, Sep 26, 2013 at 11:16 AM, Gareth Blades
mailinglist+aster...@dns99.co.uk wrote:
 On 26/09/13 15:25, Mauricio Tavares wrote:

So I have asterisk 1.8.23 and want to send my logs to rsyslog. I
 tell asterisk to use syslog in addition to messages:

 root@voip:~# tail -10 /etc/asterisk/logger.conf
 ;debug =  debug
 console =  notice,warning,error
 ;console =  notice,warning,error,debug
 messages =  notice,warning,error
 ;full =  notice,warning,error,debug,verbose,dtmf,fax

 ;syslog keyword : This special keyword logs to syslog facility
 ;
 syslog.local0 =  notice,warning,error
 ;
 root@voip:~#

 After reloading (asterisk -rx 'logger reload') the logger, it seems
 that Asterisk is happy:

 root@voip:~# asterisk -rx 'logger show channels'
 Channel Type StatusConfiguration
 ---  ---
 syslog.local0   Syslog   Enabled- NOTICE WARNING
 ERROR
 /var/log/asterisk/messages  File Enabled- NOTICE WARNING
 ERROR
  Console  Enabled- NOTICE WARNING
 ERROR
 root@voip:~#

 So I set rsyslog:

 root@voip:~# fgrep asterisk /etc/rsyslog.d/50-default.conf
 local0.*   /var/log/asterisk/messages.log
 root@voip:~#

 and restart it. And then check the asterisk log directory:

 root@voip:~# ls -lh /var/log/asterisk/
 total 3.7M
 drwxr-xr-x 2 asterisk asterisk 4.0K Jul 22 20:57 cdr-csv
 drwxr-xr-x 2 asterisk asterisk 4.0K Jun 28 14:16 cdr-custom
 -rw-rw 1 asterisk asterisk 252K Sep 26 09:37 messages
 -rw-rw 1 asterisk asterisk 248K Sep 22 05:14 messages.1
 -rw-r- 1 syslog   adm 0 Sep 26 06:47 messages.log
 -rw-rw 1 asterisk asterisk  118 Sep 26 10:07 queue_log
 root@voip:~#

 It does not seem like much is being written to messages.log compared
 to messages. Anything I missed?

 Have you checked the /var/log/asterisk directory permissions?

 I dont know how rsyslog is setup on your system but its possible it gets
 started as root, sees the destination file doesnt exist so creates it and
 sets the file permissions, and then drops down to running as the syslog
 user. At this point it doesnt have write permission to the /var/log/asterisk
 directory so cannot append to the file.

  And you were absolutely right:

root@voip:~# sudo -u syslog touch /var/log/asterisk/my_nose
touch: cannot touch `/var/log/asterisk/my_nose': Permission denied
root@voip:~# ls -lhd /var/log/asterisk
drwxr-xr-x 4 asterisk asterisk 4.0K Sep 26 10:10 /var/log/asterisk
root@voip:~# getent group asterisk
asterisk:x:114:www-data
root@voip:~#

So, I decided to be lazy and add syslog to the asterisk group:

root@voip:~# id syslog
uid=101(syslog) gid=103(syslog) groups=114(asterisk),103(syslog)
root@voip:~# chmod g+w /var/log/asterisk
root@voip:~# sudo -u syslog touch /var/log/asterisk/my_nose
root@voip:~#

Thanks!

 --
 _
 -- Bandwidth and Colocation Provided by http://www.api-digital.com --
 New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

 asterisk-users mailing list
 To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


[asterisk-users] Problems sending log to rsyslog

2013-09-26 Thread Mauricio Tavares
  So I have asterisk 1.8.23 and want to send my logs to rsyslog. I
tell asterisk to use syslog in addition to messages:

root@voip:~# tail -10 /etc/asterisk/logger.conf
;debug = debug
console = notice,warning,error
;console = notice,warning,error,debug
messages = notice,warning,error
;full = notice,warning,error,debug,verbose,dtmf,fax

;syslog keyword : This special keyword logs to syslog facility
;
syslog.local0 = notice,warning,error
;
root@voip:~#

After reloading (asterisk -rx 'logger reload') the logger, it seems
that Asterisk is happy:

root@voip:~# asterisk -rx 'logger show channels'
Channel Type StatusConfiguration
---  ---
syslog.local0   Syslog   Enabled- NOTICE WARNING ERROR
/var/log/asterisk/messages  File Enabled- NOTICE WARNING ERROR
Console  Enabled- NOTICE WARNING ERROR
root@voip:~#

So I set rsyslog:

root@voip:~# fgrep asterisk /etc/rsyslog.d/50-default.conf
local0.*   /var/log/asterisk/messages.log
root@voip:~#

and restart it. And then check the asterisk log directory:

root@voip:~# ls -lh /var/log/asterisk/
total 3.7M
drwxr-xr-x 2 asterisk asterisk 4.0K Jul 22 20:57 cdr-csv
drwxr-xr-x 2 asterisk asterisk 4.0K Jun 28 14:16 cdr-custom
-rw-rw 1 asterisk asterisk 252K Sep 26 09:37 messages
-rw-rw 1 asterisk asterisk 248K Sep 22 05:14 messages.1
-rw-r- 1 syslog   adm 0 Sep 26 06:47 messages.log
-rw-rw 1 asterisk asterisk  118 Sep 26 10:07 queue_log
root@voip:~#

It does not seem like much is being written to messages.log compared
to messages. Anything I missed?

-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Problems sending log to rsyslog

2013-09-26 Thread Gareth Blades

On 26/09/13 15:25, Mauricio Tavares wrote:

   So I have asterisk 1.8.23 and want to send my logs to rsyslog. I
tell asterisk to use syslog in addition to messages:

root@voip:~# tail -10 /etc/asterisk/logger.conf
;debug =  debug
console =  notice,warning,error
;console =  notice,warning,error,debug
messages =  notice,warning,error
;full =  notice,warning,error,debug,verbose,dtmf,fax

;syslog keyword : This special keyword logs to syslog facility
;
syslog.local0 =  notice,warning,error
;
root@voip:~#

After reloading (asterisk -rx 'logger reload') the logger, it seems
that Asterisk is happy:

root@voip:~# asterisk -rx 'logger show channels'
Channel Type StatusConfiguration
---  ---
syslog.local0   Syslog   Enabled- NOTICE WARNING ERROR
/var/log/asterisk/messages  File Enabled- NOTICE WARNING ERROR
 Console  Enabled- NOTICE WARNING ERROR
root@voip:~#

So I set rsyslog:

root@voip:~# fgrep asterisk /etc/rsyslog.d/50-default.conf
local0.*   /var/log/asterisk/messages.log
root@voip:~#

and restart it. And then check the asterisk log directory:

root@voip:~# ls -lh /var/log/asterisk/
total 3.7M
drwxr-xr-x 2 asterisk asterisk 4.0K Jul 22 20:57 cdr-csv
drwxr-xr-x 2 asterisk asterisk 4.0K Jun 28 14:16 cdr-custom
-rw-rw 1 asterisk asterisk 252K Sep 26 09:37 messages
-rw-rw 1 asterisk asterisk 248K Sep 22 05:14 messages.1
-rw-r- 1 syslog   adm 0 Sep 26 06:47 messages.log
-rw-rw 1 asterisk asterisk  118 Sep 26 10:07 queue_log
root@voip:~#

It does not seem like much is being written to messages.log compared
to messages. Anything I missed?


Have you checked the /var/log/asterisk directory permissions?

I dont know how rsyslog is setup on your system but its possible it gets 
started as root, sees the destination file doesnt exist so creates it 
and sets the file permissions, and then drops down to running as the 
syslog user. At this point it doesnt have write permission to the 
/var/log/asterisk directory so cannot append to the file.



--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
  http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users