# rsyslog v5 configuration file

# For more information see /usr/share/doc/rsyslog-*/rsyslog_conf.html
# If you experience problems, see http://www.rsyslog.com/doc/troubleshoot.html

#### MODULES ####

$ModLoad imuxsock.so # provides support for local system logging (e.g. via logger command)
$ModLoad imklog.so   # provides kernel logging support (previously done by rklogd)
$ModLoad immark.so  # provides --MARK-- message capability

# Provides UDP syslog reception
$ModLoad imudp.so
$UDPServerAddress 0.0.0.0
$UDPServerRun 514

# Provides TCP syslog reception
$ModLoad imtcp.so
$InputTCPServerRun 514
$ModLoad ommail
#*:FROMHOST-IP, isequal,"172.17.53.13" /syslog/prdn-frs2.log
#*.*    "/logs/syslog/%HOSTNAME%/%PROGRAMNAME%.log"
$template FILENAME,"/logs/syslog/%fromhost-ip%/messages-%$YEAR%-%$MONTH%-%$DAY%.log"
*.* ?FILENAME
&~
#$template TmplAuth, "/logs/syslog/%HOSTNAME%/%PROGRAMNAME%.log"
#authpriv.*   ?TmplAuth
#*.info,mail.none,authpriv.none,cron.none   ?TmplMsg

$ModLoad ommysql.so
#$ModLoad ommysql.so

$template SystemEvents,"insert into SystemEvents (Message, Facility, FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag) values (\'%msg%\', %syslogfacility%, \'%HOSTNAME%\', %syslogpriority%, \'%timereported:::date-mysql%\', \'%timegenerated:::date-mysql%\', %iut%, \'%syslogtag%\')",SQL
#*.info;mail.none;authpriv.none;cron.none :ommysql:localhost,rsysdb,rsysdb,dlb@1234
*.* :ommysql:127.0.0.1,rsysdb,rsysdb,dlb@1234

#### 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 all kernel messages to the console.
# Logging much else clutters up the screen.
kern.*                                                 /dev/console

# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
*.info;mail.none;authpriv.none;cron.none                /logs/syslog/messages

# The authpriv file has restricted access.
authpriv.*                                              /logs/syslog/secure

# Log all the mail messages in one place.
mail.*                                                  /logs/syslog/maillog