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

Currently, when fluentd is configured to listen to syslogs, Fluentd
configures itself and also rsyslog creating the file
/etc/rsyslog.d/fluentd.conf. This generates an issue when
is deployed on RHEL BZ #1701726.

To avoid this issue, a fluentd_managed_rsyslog parameter is added so
fluentd can be configured to create the file or not.

Change-Id: I388180dc991926ff30f8bbc556f61447152f8dc9
This commit is contained in:
Juan Badia Payno 2019-05-06 13:26:08 -06:00
parent 2678a4c2b8
commit a87f8be7ef
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$/
) }