Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align with the RHEL7 defaults. #112

Merged
merged 2 commits into from
Jan 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 26 additions & 26 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
it { should contain_file('rsyslog_config').with_content(/^#rsyslog v5 config file$/) }
it { should contain_file('rsyslog_config').with_content(/^\*.emerg\s*:omusrmsg:\*$/) }

it { should contain_file('rsyslog_config').without_content(/^\$ModLoad imudp.so$/) }
it { should contain_file('rsyslog_config').without_content(/^\$ModLoad imtcp.so$/) }
it { should contain_file('rsyslog_config').without_content(/^\$ModLoad imudp$/) }
it { should contain_file('rsyslog_config').without_content(/^\$ModLoad imtcp$/) }
it { should contain_file('rsyslog_config').without_content(/^\$template RemoteHost, "\/srv\/logs\/%HOSTNAME%\/%\$YEAR%-%\$MONTH%-%\$DAY%.log"$/) }
it { should contain_file('rsyslog_config').without_content(/^\$WorkDirectory \/var\/spool\/rsyslog # where to place spool files$/) }
it { should contain_file('rsyslog_config').without_content(/^\$ActionQueueFileName queue # unique name prefix for spool files$/) }
Expand Down Expand Up @@ -83,13 +83,13 @@
{ :is_log_server => value }
end
it { should contain_file('rsyslog_config').with_content(/^kern.\*\s+\/var\/log\/messages$/) }
it { should contain_file('rsyslog_config').with_content(/^\$ModLoad imtcp.so$/) }
it { should contain_file('rsyslog_config').with_content(/^\$ModLoad imtcp$/) }
it { should contain_file('rsyslog_config').with_content(/^\$template RemoteHost, "\/srv\/logs\/%HOSTNAME%\/%\$YEAR%-%\$MONTH%-%\$DAY%.log"$/) }
it { should contain_file('rsyslog_config').with_content(/^\$RuleSet remote$/) }
it { should contain_file('rsyslog_config').with_content(/^\*.\* \?RemoteHost$/) }
it { should contain_file('rsyslog_config').with_content(/^\$InputTCPServerBindRuleset remote$/) }
it { should contain_file('rsyslog_config').with_content(/^\$InputTCPServerRun 514$/) }
it { should contain_file('rsyslog_config').without_content(/^\$ModLoad imudp.so$/) }
it { should contain_file('rsyslog_config').without_content(/^\$ModLoad imudp$/) }
it { should contain_file('rsyslog_config').without_content(/^\*.\* @@log.defaultdomain:514/) }
it { should contain_file('rsyslog_config').without_content(/^\$InputUDPServerBindRuleset remote$/) }
it { should contain_file('rsyslog_config').without_content(/^\$UDPServerRun 514$/) }
Expand All @@ -108,13 +108,13 @@
{ :is_log_server => value }
end
it { should contain_file('rsyslog_config').with_content(/^kern.\*\s+\/var\/log\/messages$/) }
it { should contain_file('rsyslog_config').without_content(/^\$ModLoad imtcp.so$/) }
it { should contain_file('rsyslog_config').without_content(/^\$ModLoad imtcp$/) }
it { should contain_file('rsyslog_config').without_content(/^\$template RemoteHost, "\/srv\/logs\/%HOSTNAME%\/%\$YEAR%-%\$MONTH%-%\$DAY%.log"$/) }
it { should contain_file('rsyslog_config').without_content(/^\$RuleSet remote$/) }
it { should contain_file('rsyslog_config').without_content(/^\*.\* \?RemoteHost$/) }
it { should contain_file('rsyslog_config').without_content(/^\$InputTCPServerBindRuleset remote$/) }
it { should contain_file('rsyslog_config').without_content(/^\$InputTCPServerRun 514$/) }
it { should contain_file('rsyslog_config').without_content(/^\$ModLoad imudp.so$/) }
it { should contain_file('rsyslog_config').without_content(/^\$ModLoad imudp$/) }
it { should contain_file('rsyslog_config').without_content(/^\*.\* @@log.defaultdomain:514/) }
it { should contain_file('rsyslog_config').without_content(/^\$InputUDPServerBindRuleset remote$/) }
it { should contain_file('rsyslog_config').without_content(/^\$UDPServerRun 514$/) }
Expand All @@ -140,8 +140,8 @@
it { should contain_file('rsyslog_config').with_content(/^\*.\* \?RemoteHost$/) }
it { should contain_file('rsyslog_config').with_content(/^\$InputTCPServerBindRuleset remote$/) }
it { should contain_file('rsyslog_config').with_content(/^\$InputTCPServerRun 514$/) }
it { should contain_file('rsyslog_config').with_content(/^\$ModLoad imtcp.so$/) }
it { should contain_file('rsyslog_config').without_content(/^\$ModLoad imudp.so$/) }
it { should contain_file('rsyslog_config').with_content(/^\$ModLoad imtcp$/) }
it { should contain_file('rsyslog_config').without_content(/^\$ModLoad imudp$/) }
end

context 'with is_log_server enabled and transport_protocol=udp specified' do
Expand All @@ -157,8 +157,8 @@
it { should contain_file('rsyslog_config').with_content(/^\*.\* \?RemoteHost$/) }
it { should contain_file('rsyslog_config').with_content(/^\$InputUDPServerBindRuleset remote$/) }
it { should contain_file('rsyslog_config').with_content(/^\$UDPServerRun 514$/) }
it { should contain_file('rsyslog_config').without_content(/^\$ModLoad imtcp.so$/) }
it { should contain_file('rsyslog_config').with_content(/^\$ModLoad imudp.so$/) }
it { should contain_file('rsyslog_config').without_content(/^\$ModLoad imtcp$/) }
it { should contain_file('rsyslog_config').with_content(/^\$ModLoad imudp$/) }
end

context 'with is_log_server enabled and enable_tcp_server enabled and enable_udp_server enabled' do
Expand All @@ -177,8 +177,8 @@
it { should contain_file('rsyslog_config').with_content(/^\$InputTCPServerRun 514$/) }
it { should contain_file('rsyslog_config').with_content(/^\$InputUDPServerBindRuleset remote$/) }
it { should contain_file('rsyslog_config').with_content(/^\$UDPServerRun 514$/) }
it { should contain_file('rsyslog_config').with_content(/^\$ModLoad imtcp.so$/) }
it { should contain_file('rsyslog_config').with_content(/^\$ModLoad imudp.so$/) }
it { should contain_file('rsyslog_config').with_content(/^\$ModLoad imtcp$/) }
it { should contain_file('rsyslog_config').with_content(/^\$ModLoad imudp$/) }
end

context 'with remote_logging enabled' do
Expand Down Expand Up @@ -227,8 +227,8 @@
it { should contain_file('rsyslog_config').with_content(/^\$ActionQueueType LinkedList # run asynchronously$/) }
it { should contain_file('rsyslog_config').with_content(/^\$ActionResumeRetryCount -1 # infinite retries if host is down$/) }
it { should contain_file('rsyslog_config').with_content(/^\*.\* @@log.defaultdomain:514$/) }
it { should contain_file('rsyslog_config').without_content(/^\$ModLoad imtcp.so$/) }
it { should contain_file('rsyslog_config').without_content(/^\$ModLoad imudp.so$/) }
it { should contain_file('rsyslog_config').without_content(/^\$ModLoad imtcp$/) }
it { should contain_file('rsyslog_config').without_content(/^\$ModLoad imudp$/) }
end

context 'with remote_logging enabled and transport_protocol=udp specified' do
Expand All @@ -246,8 +246,8 @@
it { should contain_file('rsyslog_config').with_content(/^\$ActionQueueType LinkedList # run asynchronously$/) }
it { should contain_file('rsyslog_config').with_content(/^\$ActionResumeRetryCount -1 # infinite retries if host is down$/) }
it { should contain_file('rsyslog_config').with_content(/^\*.\* @log.defaultdomain:514$/) }
it { should contain_file('rsyslog_config').without_content(/^\$ModLoad imudp.so$/) }
it { should contain_file('rsyslog_config').without_content(/^\$ModLoad imtcp.so$/) }
it { should contain_file('rsyslog_config').without_content(/^\$ModLoad imudp$/) }
it { should contain_file('rsyslog_config').without_content(/^\$ModLoad imtcp$/) }
end

['logserver', %w(logserver1 logserver2)].each do |values|
Expand Down Expand Up @@ -447,13 +447,13 @@

#### MODULES ####
if value.to_i > 2
it { should contain_file('rsyslog_config').with_content(/^\$ModLoad imuxsock.so/) }
it { should contain_file('rsyslog_config').with_content(/^\$ModLoad imklog.so/) }
it { should contain_file('rsyslog_config').with_content(/^#\$ModLoad immark.so/) }
it { should contain_file('rsyslog_config').with_content(/^\$ModLoad imuxsock/) }
it { should contain_file('rsyslog_config').with_content(/^\$ModLoad imklog/) }
it { should contain_file('rsyslog_config').with_content(/^#\$ModLoad immark/) }
else
it { should contain_file('rsyslog_config').without_content(/\$ModLoad imuxsock.so/) }
it { should contain_file('rsyslog_config').without_content(/\$ModLoad imklog.so/) }
it { should contain_file('rsyslog_config').without_content(/\#\$ModLoad immark.so/) }
it { should contain_file('rsyslog_config').without_content(/\$ModLoad imuxsock/) }
it { should contain_file('rsyslog_config').without_content(/\$ModLoad imklog/) }
it { should contain_file('rsyslog_config').without_content(/\#\$ModLoad immark/) }
end

#### GLOBAL DIRECTIVES ####
Expand Down Expand Up @@ -498,8 +498,8 @@
end

if value.to_i > 2
it { should contain_file('rsyslog_config').with_content(/^\$ModLoad imudp.so$/) }
it { should contain_file('rsyslog_config').with_content(/^\$ModLoad imtcp.so$/) }
it { should contain_file('rsyslog_config').with_content(/^\$ModLoad imudp$/) }
it { should contain_file('rsyslog_config').with_content(/^\$ModLoad imtcp$/) }
it { should contain_file('rsyslog_config').with_content(/^\$template RemoteHost, "\/srv\/logs\/%HOSTNAME%\/%\$YEAR%-%\$MONTH%-%\$DAY%.log"$/) }
it { should contain_file('rsyslog_config').with_content(/^\$RuleSet remote$/) }
it { should contain_file('rsyslog_config').with_content(/^\*.\* \?RemoteHost$/) }
Expand All @@ -508,8 +508,8 @@
it { should contain_file('rsyslog_config').with_content(/^\$InputUDPServerBindRuleset remote$/) }
it { should contain_file('rsyslog_config').with_content(/^\$UDPServerRun 514$/) }
else
it { should contain_file('rsyslog_config').without_content(/^\$ModLoad imudp.so$/) }
it { should contain_file('rsyslog_config').without_content(/^\$ModLoad imtcp.so$/) }
it { should contain_file('rsyslog_config').without_content(/^\$ModLoad imudp$/) }
it { should contain_file('rsyslog_config').without_content(/^\$ModLoad imtcp$/) }
it { should contain_file('rsyslog_config').without_content(/^\$template RemoteHost, "\/srv\/logs\/%HOSTNAME%\/%\$YEAR%-%\$MONTH%-%\$DAY%.log"$/) }
it { should contain_file('rsyslog_config').without_content(/^\$RuleSet remote$/) }
it { should contain_file('rsyslog_config').without_content(/^\*.\* \?RemoteHost$/) }
Expand Down
10 changes: 5 additions & 5 deletions templates/rsyslog.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@
<% if @rsyslog_conf_version_real > 2 -%>
#### 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 imuxsock # provides support for local system logging (e.g. via logger command)
$ModLoad imklog # provides kernel logging support (previously done by rklogd)
<% if @mod_imjournal_real.to_s == 'true' -%>
$ModLoad imjournal # provides access to the systemd journal
<% end -%>
#$ModLoad immark.so # provides --MARK-- message capability
#$ModLoad immark # provides --MARK-- message capability

<% if @is_log_server_real.to_s == 'true' -%>
<% if @my_enable_udp_server.to_s == 'true' -%>
# Provides UDP syslog reception
$ModLoad imudp.so
$ModLoad imudp
<% end -%>
<% if @my_enable_tcp_server.to_s == 'true' -%>
# Provides TCP syslog reception
$ModLoad imtcp.so
$ModLoad imtcp
<% end -%>
# log every source in its own directory
$template RemoteHost, "<%= @log_dir %>/<%= @remote_template %>"
Expand Down