Skip to content

Instantly share code, notes, and snippets.

@ioggstream
Created December 3, 2014 22:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ioggstream/cdf3c40135a70d13c73c to your computer and use it in GitHub Desktop.
Save ioggstream/cdf3c40135a70d13c73c to your computer and use it in GitHub Desktop.
Use rsyslog to separate log levels (eg. for twisted apps)
#cat /etc/rsyslog.d/20-test.conf
# Define a new template to trace syslogseverity
$template TwistedTmpl,"%TIMESTAMP% %syslogtag% %syslogseverity-text%:%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n"
# Then split critical, error, warning, notice in test-rsyslog...
if $programname == 'twisted' and $syslogseverity <= 4 then /var/log/test-rsyslog.log;TwistedTmpl
& ~
# and debug, info in test-rsyslog-debug
if $programname == 'twisted' and $syslogseverity > 4 then /var/log/test-rsyslog-debug.log;TwistedTmpl
## Uncomment the following to stop logging anything that matches the last rule.
## normally containing kern.* messages (eg, /var/log/kern.log)
& ~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment