Skip to content

Instantly share code, notes, and snippets.

@stupidbodo
Forked from FZambia/rsyslog.conf
Created October 8, 2013 18:09
Show Gist options
  • Save stupidbodo/6888937 to your computer and use it in GitHub Desktop.
Save stupidbodo/6888937 to your computer and use it in GitHub Desktop.
# rsyslog v5 configuration file
#### MODULES ####
$ModLoad imuxsock # provides support for local system logging (e.g. via logger command)
$ModLoad imklog # provides kernel logging support (previously done by rklogd)
#$ModLoad immark # provides --MARK-- message capability
# Provides UDP syslog reception
$ModLoad imudp
$UDPServerRun 514
# Provides TCP syslog reception
#$ModLoad imtcp
#$InputTCPServerRun 514
#### GLOBAL DIRECTIVES ####
# Use default timestamp format
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
# File syncing capability is disabled by default. This feature is usually not required,
# not useful and an extreme performance hit
#$ActionFileEnableSync on
# Include all config files in /etc/rsyslog.d/
$IncludeConfig /etc/rsyslog.d/*.conf
#### RULES ####
# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
*.info;mail.none;authpriv.none;cron.none /var/log/messages
user.* /var/log/your_log_file
# Everybody gets emergency messages
#*.emerg *
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'formatters': {
'standard': {
'format' : "[YOUR_APPLICATION_NAME] [%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s",
'datefmt' : "%d/%b/%Y %H:%M:%S"
},
},
'handlers': {
'syslog': {
'class': 'logging.handlers.SysLogHandler',
'formatter': 'standard',
'facility': 'user',
# uncomment next line if rsyslog works with unix socket only (UDP reception disabled)
#'address': '/dev/log'
}
},
'loggers': {
'logger_name': {
'handlers': ['syslog'],
'level': 'DEBUG',
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment