Merge "[Ironic] Add ironic logs collector"

This commit is contained in:
Jenkins 2015-11-02 15:22:42 +00:00 committed by Gerrit Code Review
commit 5f800ff6c0
5 changed files with 37 additions and 1 deletions

View File

@ -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":

View File

@ -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

View File

@ -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

View File

@ -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,
}
}

View File

@ -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