Merge pull request #217 from thlapin/imjournal_fix

Only set im_journal_* params for Redhat 7 by default where imjournal is loaded.
This commit is contained in:
Steffen Zieger 2016-10-04 18:04:37 +02:00 коммит произвёл GitHub
Родитель e7813d08ec 1c5f73ce71
Коммит 6a7f0a8381
3 изменённых файлов: 207 добавлений и 155 удалений

Просмотреть файл

@ -13,19 +13,15 @@
#
class rsyslog::params {
$max_message_size = '2k'
$system_log_rate_limit_interval = '1'
$system_log_rate_limit_burst = '100'
$purge_rsyslog_d = false
$extra_modules = []
$default_template = undef
$msg_reduction = false
$non_kernel_facility = false
$preserve_fqdn = false
$im_journal_ratelimit_interval = '600'
$im_journal_ratelimit_burst = '20000'
$im_journal_ignore_previous_messages = 'off'
$im_journal_statefile = false
$max_message_size = '2k'
$system_log_rate_limit_interval = '1'
$system_log_rate_limit_burst = '100'
$purge_rsyslog_d = false
$extra_modules = []
$default_template = undef
$msg_reduction = false
$non_kernel_facility = false
$preserve_fqdn = false
case $::osfamily {
'Debian': {
@ -41,77 +37,93 @@ class rsyslog::params {
$run_group = 'syslog'
}
}
$rsyslog_package_name = 'rsyslog'
$relp_package_name = 'rsyslog-relp'
$mysql_package_name = 'rsyslog-mysql'
$pgsql_package_name = 'rsyslog-pgsql'
$gnutls_package_name = 'rsyslog-gnutls'
$package_status = 'present'
$rsyslog_d = '/etc/rsyslog.d/'
$rsyslog_conf = '/etc/rsyslog.conf'
$rsyslog_default = '/etc/default/rsyslog'
$default_config_file = 'rsyslog_default'
$log_group = 'adm'
$log_style = 'debian'
$umask = false
$perm_file = '0640'
$perm_dir = '0755'
$spool_dir = '/var/spool/rsyslog'
$service_name = 'rsyslog'
$client_conf = 'client'
$server_conf = 'server'
$ssl = false
$modules = [
$rsyslog_package_name = 'rsyslog'
$relp_package_name = 'rsyslog-relp'
$mysql_package_name = 'rsyslog-mysql'
$pgsql_package_name = 'rsyslog-pgsql'
$gnutls_package_name = 'rsyslog-gnutls'
$package_status = 'present'
$rsyslog_d = '/etc/rsyslog.d/'
$rsyslog_conf = '/etc/rsyslog.conf'
$rsyslog_default = '/etc/default/rsyslog'
$default_config_file = 'rsyslog_default'
$log_group = 'adm'
$log_style = 'debian'
$umask = false
$perm_file = '0640'
$perm_dir = '0755'
$spool_dir = '/var/spool/rsyslog'
$service_name = 'rsyslog'
$client_conf = 'client'
$server_conf = 'server'
$ssl = false
$modules = [
'$ModLoad imuxsock # provides support for local system logging',
'$ModLoad imklog # provides kernel logging support (previously done by rklogd)',
'#$ModLoad immark # provides --MARK-- message capability',
]
$service_hasrestart = true
$service_hasstatus = true
$omit_local_logging = false
$service_hasrestart = true
$service_hasstatus = true
$omit_local_logging = false
$im_journal_ratelimit_interval = undef
$im_journal_ratelimit_burst = undef
$im_journal_ignore_previous_messages = undef
$im_journal_statefile = undef
}
'RedHat': {
if $::operatingsystem == 'Amazon' {
$rsyslog_package_name = 'rsyslog'
$mysql_package_name = 'rsyslog-mysql'
$pgsql_package_name = 'rsyslog-pgsql'
$gnutls_package_name = 'rsyslog-gnutls'
$relp_package_name = false
$default_config_file = 'rsyslog_default'
$modules = [
$rsyslog_package_name = 'rsyslog'
$mysql_package_name = 'rsyslog-mysql'
$pgsql_package_name = 'rsyslog-pgsql'
$gnutls_package_name = 'rsyslog-gnutls'
$relp_package_name = false
$default_config_file = 'rsyslog_default'
$modules = [
'$ModLoad imuxsock # provides support for local system logging',
'$ModLoad imklog # provides kernel logging support (previously done by rklogd)',
'#$ModLoad immark # provides --MARK-- message capability',
]
$omit_local_logging = false
$omit_local_logging = false
$im_journal_ratelimit_interval = undef
$im_journal_ratelimit_burst = undef
$im_journal_ignore_previous_messages = undef
$im_journal_statefile = undef
}
elsif versioncmp($::operatingsystemmajrelease, '5') == 0 {
$rsyslog_package_name = 'rsyslog'
$mysql_package_name = 'rsyslog-mysql'
$pgsql_package_name = 'rsyslog-pgsql'
$gnutls_package_name = 'rsyslog-gnutls'
$relp_package_name = false
$default_config_file = 'rsyslog_default'
$modules = [
$rsyslog_package_name = 'rsyslog'
$mysql_package_name = 'rsyslog-mysql'
$pgsql_package_name = 'rsyslog-pgsql'
$gnutls_package_name = 'rsyslog-gnutls'
$relp_package_name = false
$default_config_file = 'rsyslog_default'
$modules = [
'$ModLoad imuxsock # provides support for local system logging',
'$ModLoad imklog # provides kernel logging support (previously done by rklogd)',
'#$ModLoad immark # provides --MARK-- message capability',
]
$omit_local_logging = false
$omit_local_logging = false
$im_journal_ratelimit_interval = undef
$im_journal_ratelimit_burst = undef
$im_journal_ignore_previous_messages = undef
$im_journal_statefile = undef
}
elsif versioncmp($::operatingsystemmajrelease, '6') == 0 {
$rsyslog_package_name = 'rsyslog'
$mysql_package_name = 'rsyslog-mysql'
$pgsql_package_name = 'rsyslog-pgsql'
$gnutls_package_name = 'rsyslog-gnutls'
$relp_package_name = 'rsyslog-relp'
$default_config_file = 'rsyslog_default'
$modules = [
$rsyslog_package_name = 'rsyslog'
$mysql_package_name = 'rsyslog-mysql'
$pgsql_package_name = 'rsyslog-pgsql'
$gnutls_package_name = 'rsyslog-gnutls'
$relp_package_name = 'rsyslog-relp'
$default_config_file = 'rsyslog_default'
$modules = [
'$ModLoad imuxsock # provides support for local system logging',
'$ModLoad imklog # provides kernel logging support (previously done by rklogd)',
'#$ModLoad immark # provides --MARK-- message capability',
]
$omit_local_logging = false
$omit_local_logging = false
$im_journal_ratelimit_interval = undef
$im_journal_ratelimit_burst = undef
$im_journal_ignore_previous_messages = undef
$im_journal_statefile = undef
}
elsif versioncmp($::operatingsystemmajrelease, '7') >= 0 {
$rsyslog_package_name = 'rsyslog'
@ -127,19 +139,27 @@ class rsyslog::params {
'#$ModLoad immark # provides --MARK-- message capability',
]
$omit_local_logging = true
$im_journal_ratelimit_interval = '600'
$im_journal_ratelimit_burst = '20000'
$im_journal_ignore_previous_messages = 'off'
$im_journal_statefile = false
} else {
$rsyslog_package_name = 'rsyslog5'
$mysql_package_name = 'rsyslog5-mysql'
$pgsql_package_name = 'rsyslog5-pgsql'
$gnutls_package_name = 'rsyslog5-gnutls'
$relp_package_name = 'librelp'
$default_config_file = 'rsyslog_default'
$modules = [
$rsyslog_package_name = 'rsyslog5'
$mysql_package_name = 'rsyslog5-mysql'
$pgsql_package_name = 'rsyslog5-pgsql'
$gnutls_package_name = 'rsyslog5-gnutls'
$relp_package_name = 'librelp'
$default_config_file = 'rsyslog_default'
$modules = [
'$ModLoad imuxsock # provides support for local system logging',
'$ModLoad imklog # provides kernel logging support (previously done by rklogd)',
'#$ModLoad immark # provides --MARK-- message capability',
]
$omit_local_logging = false
$omit_local_logging = false
$im_journal_ratelimit_interval = undef
$im_journal_ratelimit_burst = undef
$im_journal_ignore_previous_messages = undef
$im_journal_statefile = undef
}
$package_status = 'present'
$rsyslog_d = '/etc/rsyslog.d/'
@ -162,102 +182,115 @@ class rsyslog::params {
$service_hasstatus = true
}
'Suse': {
$rsyslog_package_name = 'rsyslog'
$relp_package_name = false
$mysql_package_name = false
$pgsql_package_name = false
$gnutls_package_name = false
$package_status = 'present'
$rsyslog_d = '/etc/rsyslog.d/'
$rsyslog_conf = '/etc/rsyslog.conf'
$rsyslog_default = '/etc/sysconfig/syslog'
$default_config_file = 'rsyslog_default_suse'
$run_user = 'root'
$run_group = 'root'
$log_user = 'root'
$log_group = 'root'
$log_style = 'debian'
$umask = false
$perm_file = '0600'
$perm_dir = '0750'
$spool_dir = '/var/spool/rsyslog/'
$service_name = 'syslog'
$client_conf = 'client'
$server_conf = 'server'
$modules = [
$rsyslog_package_name = 'rsyslog'
$relp_package_name = false
$mysql_package_name = false
$pgsql_package_name = false
$gnutls_package_name = false
$package_status = 'present'
$rsyslog_d = '/etc/rsyslog.d/'
$rsyslog_conf = '/etc/rsyslog.conf'
$rsyslog_default = '/etc/sysconfig/syslog'
$default_config_file = 'rsyslog_default_suse'
$run_user = 'root'
$run_group = 'root'
$log_user = 'root'
$log_group = 'root'
$log_style = 'debian'
$umask = false
$perm_file = '0600'
$perm_dir = '0750'
$spool_dir = '/var/spool/rsyslog/'
$service_name = 'syslog'
$client_conf = 'client'
$server_conf = 'server'
$modules = [
$im_journal_ignore_previous_messages = undef
'$ModLoad imuxsock # provides support for local system logging',
'$ModLoad imklog # provides kernel logging support (previously done by rklogd)',
'#$ModLoad immark # provides --MARK-- message capability',
]
$omit_local_logging = false
$omit_local_logging = false
$im_journal_ratelimit_interval = undef
$im_journal_ratelimit_burst = undef
$im_journal_ignore_previous_messages = undef
$im_journal_statefile = undef
}
'FreeBSD': {
$rsyslog_package_name = 'sysutils/rsyslog8'
$relp_package_name = false
$mysql_package_name = false
$pgsql_package_name = false
$gnutls_package_name = false
$package_status = 'present'
$rsyslog_d = '/usr/local/etc/rsyslog.d/'
$rsyslog_conf = '/usr/local/etc/rsyslog.conf'
$rsyslog_default = '/etc/defaults/syslogd'
$default_config_file = 'rsyslog_default'
$run_user = 'root'
$run_group = 'wheel'
$log_user = 'root'
$log_group = 'wheel'
$log_style = 'freebsd'
$umask = false
$perm_file = '0640'
$perm_dir = '0755'
$spool_dir = '/var/spool/rsyslog'
$service_name = 'rsyslogd'
$client_conf = 'client'
$server_conf = 'server'
$ssl = false
$modules = [
$rsyslog_package_name = 'sysutils/rsyslog8'
$relp_package_name = false
$mysql_package_name = false
$pgsql_package_name = false
$gnutls_package_name = false
$package_status = 'present'
$rsyslog_d = '/usr/local/etc/rsyslog.d/'
$rsyslog_conf = '/usr/local/etc/rsyslog.conf'
$rsyslog_default = '/etc/defaults/syslogd'
$default_config_file = 'rsyslog_default'
$run_user = 'root'
$run_group = 'wheel'
$log_user = 'root'
$log_group = 'wheel'
$log_style = 'freebsd'
$umask = false
$perm_file = '0640'
$perm_dir = '0755'
$spool_dir = '/var/spool/rsyslog'
$service_name = 'rsyslogd'
$client_conf = 'client'
$server_conf = 'server'
$ssl = false
$modules = [
'$ModLoad imuxsock # provides support for local system logging',
'$ModLoad imklog # provides kernel logging support (previously done by rklogd)',
'#$ModLoad immark # provides --MARK-- message capability',
]
$service_hasrestart = true
$service_hasstatus = true
$omit_local_logging = false
$service_hasrestart = true
$service_hasstatus = true
$omit_local_logging = false
$im_journal_ratelimit_interval = undef
$im_journal_ratelimit_burst = undef
$im_journal_ignore_previous_messages = undef
$im_journal_statefile = undef
}
default: {
case $::operatingsystem {
'Gentoo': {
$rsyslog_package_name = 'app-admin/rsyslog'
$relp_package_name = false
$mysql_package_name = 'rsyslog-mysql'
$pgsql_package_name = 'rsyslog-pgsql'
$gnutls_package_name = false
$package_status = 'present'
$rsyslog_d = '/etc/rsyslog.d/'
$rsyslog_conf = '/etc/rsyslog.conf'
$rsyslog_default = '/etc/conf.d/rsyslog'
$default_config_file = 'rsyslog_default_gentoo'
$run_user = 'root'
$run_group = 'root'
$log_user = 'root'
$log_group = 'adm'
$log_style = 'debian'
$umask = false
$perm_file = '0640'
$perm_dir = '0755'
$spool_dir = '/var/spool/rsyslog'
$service_name = 'rsyslog'
$client_conf = 'client'
$server_conf = 'server'
$ssl = false
$modules = [
$rsyslog_package_name = 'app-admin/rsyslog'
$relp_package_name = false
$mysql_package_name = 'rsyslog-mysql'
$pgsql_package_name = 'rsyslog-pgsql'
$gnutls_package_name = false
$package_status = 'present'
$rsyslog_d = '/etc/rsyslog.d/'
$rsyslog_conf = '/etc/rsyslog.conf'
$rsyslog_default = '/etc/conf.d/rsyslog'
$default_config_file = 'rsyslog_default_gentoo'
$run_user = 'root'
$run_group = 'root'
$log_user = 'root'
$log_group = 'adm'
$log_style = 'debian'
$umask = false
$perm_file = '0640'
$perm_dir = '0755'
$spool_dir = '/var/spool/rsyslog'
$service_name = 'rsyslog'
$client_conf = 'client'
$server_conf = 'server'
$ssl = false
$modules = [
'$ModLoad imuxsock # provides support for local system logging',
'$ModLoad imklog # provides kernel logging support (previously done by rklogd)',
'#$ModLoad immark # provides --MARK-- message capability',
]
$service_hasrestart = true
$service_hasstatus = true
$omit_local_logging = false
$service_hasrestart = true
$service_hasstatus = true
$omit_local_logging = false
$im_journal_ratelimit_interval = undef
$im_journal_ratelimit_burst = undef
$im_journal_ignore_previous_messages = undef
$im_journal_statefile = undef
}
default: {
fail("The ${module_name} module is not supported on ${::osfamily}/${::operatingsystem}.")

Просмотреть файл

@ -103,6 +103,25 @@ describe 'rsyslog', type: :class do
end
end
context 'osfamily = RedHat and operatingsystemmajrelease = 7' do
let :facts do
default_facts.merge!(
osfamily: 'RedHat',
operatingsystem: 'RedHat',
operatingsystemmajrelease: '7'
)
end
context 'default usage (osfamily = RedHat)' do
let(:title) { 'rsyslog-basic' }
it 'compiles' do
should contain_file('/etc/rsyslog.conf').with_content(%r{\$imjournalRatelimitBurst 20000})
should contain_file('/etc/rsyslog.d/')
end
end
end
context 'osfamily = Debian' do
let :facts do
default_facts.merge!(

Просмотреть файл

@ -68,18 +68,18 @@ $OmitLocalLogging on
<% end -%>
# Settings for imjournal (If supported)
<% if scope.lookupvar('rsyslog::im_journal_statefile') -%>
<% if scope.lookupvar('rsyslog::im_journal_statefile') != :undef -%>
$IMJournalStateFile <%=scope.lookupvar('rsyslog::im_journal_statefile') %>
<% end %>
<% if scope.lookupvar('rsyslog::im_journal_ignore_previous_messages') -%>
<% end -%>
<% if scope.lookupvar('rsyslog::im_journal_ignore_previous_messages') != :undef -%>
$ImjournalIgnorePreviousMessages <%=scope.lookupvar('rsyslog::im_journal_ignore_previous_messages') %>
<% end %>
<% if scope.lookupvar('rsyslog::im_journal_ratelimit_interval') -%>
<% end -%>
<% if scope.lookupvar('rsyslog::im_journal_ratelimit_interval') != :undef -%>
$imjournalRatelimitInterval <%=scope.lookupvar('rsyslog::im_journal_ratelimit_interval') %>
<% end %>
<% if scope.lookupvar('rsyslog::im_journal_ratelimit_burst') -%>
<% end -%>
<% if scope.lookupvar('rsyslog::im_journal_ratelimit_burst') != :undef -%>
$imjournalRatelimitBurst <%=scope.lookupvar('rsyslog::im_journal_ratelimit_burst') %>
<% end %>
<% end -%>
#
# Include all config files in <%= scope.lookupvar('rsyslog::rsyslog_d') %>