Merge "Fix fluentd multifile problem." into stable/rocky

This commit is contained in:
Zuul 2018-10-09 12:37:26 +00:00 committed by Gerrit Code Review
commit ab15b3468f
2 changed files with 31 additions and 2 deletions

View File

@ -38,10 +38,10 @@ define tripleo::profile::base::logging::fluentd::fluentd_service (
$values.filter|$index,$value|
{$index == 'path'}.reduce({})|$memo,$x| {$memo + {'path' => regsubst($x[1], $fluentd_transform[0], $fluentd_transform[1]) } } }
} else{
$new_source = {} + $all
$new_source = any2array($all)
}
} else {
$new_source = {} + $sources
$new_source = any2array($sources)
}
::fluentd::config { "100-openstack-${title}.conf":

View File

@ -223,6 +223,35 @@ describe 'tripleo::profile::base::logging::fluentd' do
end
context 'Multifiles -- horizon no transformation' do
let(:params) { {
:step => 4,
:fluentd_default_format => '/(?<time>\\d{4}-\\d{2}-\\d{2} \\d{2} =>\\d{2}:\\d{2}.\\d+) (?<pid>\\d+) (?<priority>\\S+) (?<message>.*)$/',
:fluentd_manage_groups => false,
:fluentd_pos_file_path => '/var/cache/fluentd/',
:service_names => [ 'horizon' ],
} }
it { is_expected.to contain_file('/etc/fluentd/config.d/100-openstack-horizon.conf').with_content (
"# This file is managed by Puppet, do not edit manually.
<source>
format /(?<time>\\d{4}-\\d{2}-\\d{2} \\d{2} =>\\d{2}:\\d{2}.\\d+) (?<pid>\\d+) (?<priority>\\S+) (?<message>.*)$/
path /var/log/horizon/test.log
pos_file /var/cache/fluentd/horizon-test.pos
tag openstack.horizon.test
@type tail
</source>
<source>
format /(?<time>\\d{4}-\\d{2}-\\d{2} \\d{2} =>\\d{2}:\\d{2}.\\d+) (?<pid>\\d+) (?<priority>\\S+) (?<message>.*)$/
path /var/log/horizon/access.log
pos_file /var/cache/fluentd//openstack.horizon.access.pos
tag openstack.horizon.access
@type tail
</source>
"
) }
end
context 'Groups by service -- ceilometer_agent_central added ceilometer' do
let(:params) { {
:step => 4,