From 7418cb3de0d96cc102f045526adc8e0113761d55 Mon Sep 17 00:00:00 2001 From: Marco Rodrigues Date: Mon, 21 Jan 2019 19:16:49 +0100 Subject: [PATCH] Align with the RHEL7 defaults. (#112) The ".so" is not required for default modules to load. --- spec/classes/init_spec.rb | 52 +++++++++++++++++++------------------- templates/rsyslog.conf.erb | 10 ++++---- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 9f111e1..542af86 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -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$/) } @@ -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$/) } @@ -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$/) } @@ -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 @@ -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 @@ -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 @@ -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 @@ -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| @@ -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 #### @@ -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$/) } @@ -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$/) } diff --git a/templates/rsyslog.conf.erb b/templates/rsyslog.conf.erb index 02edd6e..298c0f8 100644 --- a/templates/rsyslog.conf.erb +++ b/templates/rsyslog.conf.erb @@ -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 %>"