FreePBX syslog setup

Here is how to setup FreePBX to log to a syslog server. In my case I am using graylog with a syslog UDP input at port 1514.

Modify /etc/asterisk/logger_logfiles_custom.conf to add the desired items to be logged:

syslog.local0 => notice,warning,error,security

Modify /etc/rsyslog.conf and add the following line, matching the above destination:

local0.*                                  /var/log/asterisk/syslog

To forward to graylog I also uncommented the following in rsyslog.conf:

# ### begin forwarding rule ###
# The statement between the begin ... end define a SINGLE forwarding
# rule. They belong together, do NOT split them. If you create multiple
# forwarding rules, duplicate the whole block!
# Remote Logging (we use TCP for reliable delivery)
# An on-disk queue is created for this action. If the remote host is
# down, messages are spooled to disk and sent when it is up again.
$ActionQueueFileName fwdRule1 # unique name prefix for spool files
$ActionQueueMaxDiskSpace 1g   # 1gb space limit (use as much as possible)
$ActionQueueSaveOnShutdown on # save messages to disk on shutdown
$ActionQueueType LinkedList   # run asynchronously
$ActionResumeRetryCount -1    # infinite retries if host is down
# remote host is: name/ip:port, e.g., port optional
*.* @
# ### end of the forwarding rule ###

Finally restart the asterisk logger and rsyslog:

asterisk -rx "logger reload"
service rsyslog restart

The following resources were helpful in getting this setup:

ViaCar Sensors

ViaCar SensorsA quick picture: a group of sensors for ViaCar(NatCar) I made during my last year at UCSD. More to come when I get the chance to photograph everything, check out the projects page in coming weeks!



I have to apologize for the lack of posts for the past few months. I have been collecting a good chunk of content but haven’t uploaded it. Expect more in future weeks, I have more time on weekends now to write posts!