Skip to content
Snippets Groups Projects
Commit 8756dafa authored by Thomas Bellman's avatar Thomas Bellman Committed by Hans Persson
Browse files

Refactor syslogging to central server setup.

Rsyslogd in EL-6 and later is set up to use a /etc/rsyslog.d directory
where you can drop files containing configuration fragments.  As we no
longer support EL-5 syslog clients, we can make use of that, instead
of modifying the /etc/rsyslog.conf file, to setup the forwarding of
logs to our central syslog server.

This was originally commit cd8c9399b62e in intserv.
parent 4ebb5750
No related branches found
No related tags found
No related merge requests found
......@@ -52,21 +52,21 @@ class central-syslog-client
include syslog-service__
$syslogaddr = resolve_ipnets($syslog::vars::logserver, 'ipv4', 'stable')
$cfg_d_file = '/etc/rsyslog.d/log-to-logserver.conf'
ensure_line {
syslog-central:
file => '/etc/rsyslog.conf',
line => "*.*\t\t\t\t\t@${syslogaddr[0]};RSYSLOG_ForwardFormat",
pattern => '^\s*\*\.\*\s.*',
file {
$cfg_d_file:
ensure => file, owner => 'root', group => 'root', mode => '0444',
content => "*.*\t\t@${syslogaddr[0]};RSYSLOG_ForwardFormat\n",
require => Package['rsyslog'],
before => Service['syslog'],
notify => Service['rsyslog'];
}
# Remove remnants of the old way we configured this
delete_lines {
old-syslog-central:
file => '/etc/rsyslog.conf',
pattern => '^\s*\S+\.\*\s+@130\.236\.101\.1\s*$',
require => Ensure_line['syslog-central'],
pattern => '^\s*[*a-zA-Z0-9]+\.\*\s+@.*',
require => File[$cfg_d_file],
notify => Service['rsyslog'];
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment