Commit e9f7195e authored by jaywink's avatar jaywink

Properly configure syslog logging

When using multiple Socialhome instances on the same server.
parent 23307b63
......@@ -58,3 +58,4 @@ socialhome_syslog_level: INFO
# Only relevant if socialhome_log_target is syslog
socialhome_loggly: false
socialhome_loggly_token:
socialhome_syslog_facility: local7
......@@ -9,10 +9,10 @@
notify:
- restart rsyslog
- name: Configure rsyslog for Django
- name: Configure rsyslog for Socialhome
template:
src: 21-django.conf
dest: /etc/rsyslog.d/21-django.conf
dest: /etc/rsyslog.d/21-{{ socialhome_domain }}.conf
notify:
- restart rsyslog
......
#provides UDP syslog reception
$ModLoad imudp
$UDPServerRun 514
#Add a tag for Django events
$template LogglyFormatDjango,"<%pri%>%protocol-version% %timestamp:::date-rfc3339% %HOSTNAME% %app-name% %procid% %msgid% [{{ socialhome_loggly_token }}@41058 tag=\"{{ socialhome_domain }}\"] %msg%\n"
$template LogglyFormat{{ socialhome_domain }},"<%pri%>%protocol-version% %timestamp:::date-rfc3339% %HOSTNAME% %app-name% %procid% %msgid% [{{ socialhome_loggly_token }}@41058 tag=\"{{ socialhome_domain }}\"] %msg%\n"
local7.* @@logs-01.loggly.com:514;LogglyFormatDjango
local7.* ~ #discards the messages so they don't end up in /var/log/syslog
{{ socialhome_syslog_facility }}.* @@logs-01.loggly.com:514;LogglyFormat{{ socialhome_domain }}
{{ socialhome_syslog_facility }}.* ~ #discards the messages so they don't end up in /var/log/syslog
......@@ -17,4 +17,8 @@ $ActionSendStreamDriverMode 1
$ActionSendStreamDriverAuthMode x509/name
$ActionSendStreamDriverPermittedPeer *.loggly.com
#provides UDP syslog reception
$ModLoad imudp
$UDPServerRun 514
#################END CONFIG FILE#########################
......@@ -37,6 +37,7 @@ SOCIALHOME_ROOT_PROFILE={{ socialhome_root_profile }}
SOCIALHOME_LOG_TARGET={{ socialhome_log_target }}
SOCIALHOME_LOGFILE=/home/{{ socialhome_os_user }}/logs/socialhome.log
SOCIALHOME_SYSLOG_LEVEL={{ socialhome_syslog_level }}
SOCIALHOME_SYSLOG_FACILITY={{ socialhome_syslog_facility }}
{% if socialhome_debug %}
DJANGO_DEBUG=True
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment