Merge "[Ironic] Add ironic logs collector"
This commit is contained in:
commit
5f800ff6c0
@ -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":
|
||||
|
@ -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
|
||||
|
8
deployment/puppet/openstack/templates/70-ironic.conf.erb
Normal file
8
deployment/puppet/openstack/templates/70-ironic.conf.erb
Normal 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
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user