Merge "Let fluentd not create /etc/rsyslog.d/fluentd.conf file"

This commit is contained in:
Zuul 2019-05-13 15:35:31 +00:00 committed by Gerrit Code Review
commit e32f2ef8aa
2 changed files with 22 additions and 12 deletions

View File

@ -93,6 +93,10 @@
# [*service_names*]
# (Optional) List of services enabled on the current role. This is used
# to obtain per-service configuration information.
#
# [*fluentd_managed_rsyslog*]
# (Optional, default false) Let fluentd configure and restart rsyslog
# service
class tripleo::profile::base::logging::fluentd (
$step = Integer(hiera('step')),
$fluentd_sources = undef,
@ -112,7 +116,8 @@ class tripleo::profile::base::logging::fluentd (
$fluentd_monitoring = true,
$fluentd_monitoring_bind = '127.0.0.1',
$fluentd_monitoring_port = 24220,
$service_names = hiera('service_names', [])
$service_names = hiera('service_names', []),
$fluentd_managed_rsyslog = false
) {
if $step >= 4 {
warning('Service fluentd is deprecated. Please take in mind, that it going to be removed in T release.')
@ -234,14 +239,16 @@ class tripleo::profile::base::logging::fluentd (
}
}
file { '/etc/rsyslog.d/fluentd.conf':
content => "*.* @127.0.0.1:${fluentd_syslog_port}",
owner => 'root',
group => 'root',
mode => '0644',
} ~> exec { 'reload rsyslog':
command => '/bin/systemctl restart rsyslog',
refreshonly => true,
if $fluentd_managed_rsyslog {
file { '/etc/rsyslog.d/fluentd.conf':
content => "*.* @127.0.0.1:${fluentd_syslog_port}",
owner => 'root',
group => 'root',
mode => '0644',
} ~> exec { 'reload rsyslog':
command => '/bin/systemctl restart rsyslog',
refreshonly => true,
}
}
}

View File

@ -55,9 +55,7 @@ describe 'tripleo::profile::base::logging::fluentd' do
) }
it { is_expected.to contain_fluentd__config('110-system-sources.conf') }
it { is_expected.to contain_file('/etc/rsyslog.d/fluentd.conf').with_content(
"*.* @127.0.0.1:42185"
) }
it { is_expected.to_not contain_file('/etc/rsyslog.d/fluentd.conf') }
it { is_expected.to contain_file('/etc/fluentd/config.d/110-system-sources.conf').with_content(
"# This file is managed by Puppet, do not edit manually.
<source>
@ -72,6 +70,7 @@ describe 'tripleo::profile::base::logging::fluentd' do
context 'step greater than 3 and a fluentd source' do
let(:params) { {
:step => 4,
:fluentd_managed_rsyslog => true,
:fluentd_sources => [ {
'format' => '/(?<time>\\d{4}-\\d{2}-\\d{2} \\d{2} =>\\d{2}:\\d{2}.\\d+) (?<pid>\\d+) (?<priority>\\S+) (?<message>.*)$/',
'path' => '/var/log/keystone/keystone.log',
@ -91,6 +90,10 @@ describe 'tripleo::profile::base::logging::fluentd' do
'source' => params[:fluentd_sources]
}
) }
it { is_expected.to contain_fluentd__config('110-system-sources.conf') }
it { is_expected.to contain_file('/etc/rsyslog.d/fluentd.conf').with_content(
"*.* @127.0.0.1:42185"
) }
it { is_expected.to contain_file('/etc/fluentd/config.d/100-openstack-sources.conf').with_content(
/^\s*path \/var\/log\/keystone\/keystone\.log$/
) }