-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rsyslog: Add the option of a second rsyslog server
You can now create multiple rsyslog central log servers to send your logs to. Some centOS7 compatibility is still maintained
- Loading branch information
Showing
4 changed files
with
146 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
# rsyslog 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 #### | ||
$MaxMessageSize 32k | ||
# The imjournal module below is now used as a message source instead of imuxsock. | ||
$ModLoad imuxsock # provides support for local system logging (e.g. via logger command) | ||
$ModLoad imjournal # provides access to the systemd journal | ||
#$ModLoad imklog # reads kernel messages (the same are read from journald) | ||
$ModLoad immark # provides --MARK-- message capability | ||
|
||
## Adjust Ratelimit | ||
$imjournalRatelimitInterval 30 | ||
$imjournalRatelimitBurst 20000 | ||
|
||
#### GLOBAL DIRECTIVES #### | ||
|
||
# Where to place auxiliary files | ||
$WorkDirectory /var/lib/rsyslog | ||
|
||
# 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 | ||
|
||
# Turn off message reception via local log socket; | ||
# local messages are retrieved through imjournal now. | ||
$OmitLocalLogging on | ||
|
||
# File to store the position in the journal | ||
$IMJournalStateFile imjournal.state | ||
# MARK messages | ||
$ActionWriteAllMarkMessages on | ||
$MarkMessagePeriod 600 | ||
|
||
$PreserveFQDN on | ||
# Order is important here: First the templates, then rules, then listerers, then forwarders | ||
{% if 'sysloghost' in group_names %} | ||
# This directory contains templates for a central syslog host | ||
$IncludeConfig /etc/rsyslog.d/templates/*.conf | ||
{% endif %} | ||
|
||
#### RULES #### | ||
# The rules below make sure all local logging is also logged on local machines | ||
# 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;local6.none /var/log/messages | ||
|
||
# The authpriv file has restricted access. | ||
authpriv.* /var/log/secure | ||
|
||
# Log all the mail messages in one place. | ||
mail.* -/var/log/maillog | ||
# Log cron stuff | ||
cron.* /var/log/cron | ||
|
||
# Everybody gets emergency messages | ||
*.emerg :omusrmsg:* | ||
|
||
# Save news errors of level crit and higher in a special file. | ||
uucp,news.crit /var/log/spooler | ||
|
||
# Save boot messages also to boot.log | ||
local7.* /var/log/boot.log | ||
|
||
{% if 'sysloghost' in group_names %} | ||
# Make the logs readable | ||
$DirCreateMode 0775 | ||
$FileCreateMode 0640 | ||
$FileOwner root | ||
$FileGroup {{ rsyslog_read_group }} | ||
$DirOwner root | ||
$DirGroup root | ||
|
||
# This directory contains all rulesets on the central syslog host | ||
$IncludeConfig /etc/rsyslog.d/rulesets/*.conf | ||
{% endif %} | ||
# Default listener for localhost | ||
module(load="imudp") | ||
input(type="imudp" port="514") | ||
|
||
|
||
{% if 'sysloghost' in group_names %} | ||
# Now we include all the listeners | ||
module(load="imrelp" ) | ||
$IncludeConfig /etc/rsyslog.d/listeners/*.conf | ||
{% endif %} | ||
|
||
# ### 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) | ||
# | ||
|
||
{% for syslogserver in relp_remote %} | ||
# Logs are forwarded to {{ syslogserver.name }} | ||
module(load="omrelp") | ||
action(type="omrelp" | ||
target="{{ syslogserver.host }}" | ||
port="{{ syslogserver.port }}" | ||
tls="on" | ||
tls.caCert="/etc/pki/rsyslog/rsyslogclientca.crt" | ||
tls.MyCert="/etc/pki/rsyslog/rsyslogclient.crt" | ||
tls.MyPrivKey="/etc/pki/rsyslog/rsyslogclient.key" | ||
tls.authmode="name" | ||
tls.permittedpeer=["{{ syslogserver.peer }}"] | ||
queue.type="LinkedList" | ||
queue.filename="{{ syslogserver.name }}" | ||
queue.spoolDirectory="/var/spool/rsyslog" | ||
queue.maxdiskspace="1G" | ||
queue.saveonshutdown="on" | ||
action.resumeRetryCount="-1" | ||
action.resumeInterval="5" | ||
action.writeAllMarkMessages="on") | ||
{% endfor %} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters