diff --git a/deployment/puppet/openstack/manifests/logging.pp b/deployment/puppet/openstack/manifests/logging.pp index fd325f7b60..6c24ac2aee 100644 --- a/deployment/puppet/openstack/manifests/logging.pp +++ b/deployment/puppet/openstack/manifests/logging.pp @@ -36,6 +36,7 @@ class openstack::logging ( $production = 'prod', $escapenewline = false, $debug = false, + $ironic_collector = false, ) { validate_re($proto, 'tcp|udp|both') @@ -237,7 +238,13 @@ class openstack::logging ( } file { "${::rsyslog::params::rsyslog_d}00-remote.conf": - content => template("${module_name}/00-remote.conf.erb"), + content => template("${module_name}/00-remote.conf.erb"), + } + + if $ironic_collector { + file { "${::rsyslog::params::rsyslog_d}70-ironic.conf": + content => template("${module_name}/70-ironic.conf.erb"), + } } class { "::rsyslog::client": diff --git a/deployment/puppet/openstack/templates/10-fuel.conf.erb b/deployment/puppet/openstack/templates/10-fuel.conf.erb index 17849c8ca2..de83e1348f 100644 --- a/deployment/puppet/openstack/templates/10-fuel.conf.erb +++ b/deployment/puppet/openstack/templates/10-fuel.conf.erb @@ -28,6 +28,7 @@ "/var/log/syslog" "/var/log/user.log" "/var/log/upstart/*.log" +"/var/log/remote/*.log" { # truncate file, do not delete & recreate copytruncate diff --git a/deployment/puppet/openstack/templates/70-ironic.conf.erb b/deployment/puppet/openstack/templates/70-ironic.conf.erb new file mode 100644 index 0000000000..7f0b910e3c --- /dev/null +++ b/deployment/puppet/openstack/templates/70-ironic.conf.erb @@ -0,0 +1,8 @@ +# Load UDP module +$ModLoad imudp +$UDPServerRun 514 + +$template RemoteLogIronic, "<%%pri%>%timestamp% %syslogtag:R,ERE,2,FIELD:(ironic/.<200b>*/)(.*<200b>)--end% %msg:::sp-if-no-1st-sp%%msg%\n" +$template RemoteLogFile, "/var/log/remote/%syslogtag:R,ERE,1,DFLT:([A-Za-z][A-Za-z0-9_./-]*)--end%.log" + +:FROMHOST, regex, "^[1-9]" -?RemoteLogFile;RemoteLogIronic diff --git a/deployment/puppet/osnailyfacter/modular/logging/logging.pp b/deployment/puppet/osnailyfacter/modular/logging/logging.pp index 6c734d2841..44bbab58be 100644 --- a/deployment/puppet/osnailyfacter/modular/logging/logging.pp +++ b/deployment/puppet/osnailyfacter/modular/logging/logging.pp @@ -4,6 +4,8 @@ $base_syslog_hash = hiera('base_syslog_hash') $syslog_hash = hiera('syslog_hash') $use_syslog = hiera('use_syslog', true) $debug = pick($syslog_hash['debug'], hiera('debug', false)) +$nodes_hash = hiera('nodes', {}) +$roles = node_roles($nodes_hash, hiera('uid')) ################################################## @@ -36,6 +38,10 @@ if $use_syslog { } } + if member($roles, 'ironic') { + $ironic_collector = true + } + class { '::openstack::logging': role => 'client', show_timezone => true, @@ -56,5 +62,6 @@ if $use_syslog { # Rabbit doesn't support syslog directly rabbit_log_level => 'NOTICE', debug => $debug, + ironic_collector => $ironic_collector, } } diff --git a/tests/noop/spec/hosts/logging/logging_spec.rb b/tests/noop/spec/hosts/logging/logging_spec.rb index d22c441915..5d187730bc 100644 --- a/tests/noop/spec/hosts/logging/logging_spec.rb +++ b/tests/noop/spec/hosts/logging/logging_spec.rb @@ -4,6 +4,10 @@ manifest = 'logging/logging.pp' describe manifest do shared_examples 'catalog' do + syslog_user = syslog_group = { + 'Ubuntu' => 'syslog', + 'CentOS' => 'root' + } it { if facts[:operatingsystem] == 'Ubuntu' should contain_file('/var/log').with( @@ -15,6 +19,15 @@ describe manifest do should_not contain_file('/var/log') end } + if Noop.hiera('node_role') == 'ironic' + it { + should contain_file('/etc/rsyslog.d/70-ironic.conf').with( + 'owner' => syslog_user[facts[:operatingsystem]], + 'group' => syslog_group[facts[:operatingsystem]], + 'mode' => '0640', + ) + } + end end test_ubuntu_and_centos manifest end