FreePBX | Register | Issues | Wiki | Portal | Support

Is it possible to export FreePBX logs to syslog?


(John) #1

I’ve been able to get system messages such as /var/log/messages to forward to my syslog server but is it possible to also forward some of the Freepbx and Asterisk logs such as:

/var/log/asterisk/full
/var/log/asterisk/fail2ban
/var/log/asterisk/freepbx.log
/var/log/asterisk/freepbx_security.log

It’s just easier for me to parse through them in syslog rather than the flat log files.

(FreePBX Distro 13)


#2

www.asteriskdocs.org/en/3rd_Edition/asterisk-book-html-chunk/Monitoring_id264504.html


(John) #3

Thanks @dicko! Your a wealth of knowledge and information.


(Wzkds) #4

That helped me, too, thought I’d add my 2cents.

(the part that I’m assuming, but adding for posterity):

edit /etc/rsyslog.conf

vi /etc/rsyslog.conf

Search for remote, uncoment the .@remotehost and change remotehost to the ip or fqdn of your syslog server.

If your syslog server is listening on udp/514:

 # remote host is: name/ip:port, e.g. 192.168.0.1:514, port optional    
 *.* @syslogd.domain.com:514 

If your syslog serber is listening on tcp/514

 # remote host is: name/ip:port, e.g. 192.168.0.1:514, port optional    
 *.* @@syslogd.domain.com:514 

Note that @@ will use tcp, while @ will use udp.

Add full to syslog:

edit the file:

vi /etc/logrotate.d/syslog

add:

/var/log/asterisk/full

Restart syslog service:

service rsyslog restart

Reload logger:

asterisk -rx "logger reload"