Set proper rabbitmq filenames for logging

Add right options to rsyslog for catching rabbitmq messages
properly.

Change-Id: I825ec437673bed40c88e06af500e2804f0f126b7
Closes-Bug: #1541397
This commit is contained in:
Stanislaw Bogatkin 2016-02-03 18:32:33 +03:00 committed by Matthew Mosesohn
parent f770677736
commit 4a7313e401
3 changed files with 58 additions and 40 deletions

View File

@ -19,24 +19,25 @@
# (rabbit does not support syslog, imfile is used for log capturing)
#
class openstack::logging (
$role = 'client',
$log_remote = true,
$log_local = false,
$log_auth_local = false,
$rotation = 'daily',
$keep = '7',
$minsize = '10M',
$maxsize = '100M',
$rservers = [{'remote_type'=>'udp', 'server'=>'master', 'port'=>'514'},],
$port = '514',
$proto = 'udp',
$show_timezone = false,
$virtual = false,
$rabbit_log_level = 'NOTICE',
$production = 'prod',
$escapenewline = false,
$debug = false,
$ironic_collector = false,
$role = 'client',
$log_remote = true,
$log_local = false,
$log_auth_local = false,
$rotation = 'daily',
$keep = '7',
$minsize = '10M',
$maxsize = '100M',
$rservers = [{'remote_type'=>'udp', 'server'=>'master', 'port'=>'514'},],
$port = '514',
$proto = 'udp',
$show_timezone = false,
$virtual = false,
$rabbit_log_level = 'NOTICE',
$rabbit_fqdn_prefix = '',
$production = 'prod',
$escapenewline = false,
$debug = false,
$ironic_collector = false,
) {
validate_re($proto, 'tcp|udp|both')
@ -71,14 +72,14 @@ class openstack::logging (
# Configure logging templates for rsyslog client side
# Rabbitmq does not support syslogging, use imfile
::rsyslog::imfile { "04-rabbitmq" :
file_name => "/var/log/rabbitmq/rabbit@${hostname}.log",
file_name => "/var/log/rabbitmq/rabbit@${rabbit_fqdn_prefix}${hostname}.log",
file_tag => "rabbitmq",
file_facility => "syslog",
file_severity => $rabbit_log_level,
}
::rsyslog::imfile { "04-rabbitmq-sasl" :
file_name => "/var/log/rabbitmq/rabbit@${hostname}-sasl.log",
file_name => "/var/log/rabbitmq/rabbit@${rabbit_fqdn_prefix}${hostname}-sasl.log",
file_tag => "rabbitmq-sasl",
file_facility => "syslog",
file_severity => $rabbit_log_level,
@ -91,6 +92,13 @@ class openstack::logging (
file_severity => "ERROR",
}
::rsyslog::imfile { "04-rabbitmq-startup_log" :
file_name => "/var/log/rabbitmq/startup_log",
file_tag => "rabbitmq-startup_log",
file_facility => "syslog",
file_severity => $rabbit_log_level,
}
::rsyslog::imfile { "04-rabbitmq-shutdown_err" :
file_name => "/var/log/rabbitmq/shutdown_err",
file_tag => "rabbitmq-shutdown_err",
@ -98,6 +106,13 @@ class openstack::logging (
file_severity => "ERROR",
}
::rsyslog::imfile { "04-rabbitmq-shutdown_log" :
file_name => "/var/log/rabbitmq/shutdown_log",
file_tag => "rabbitmq-shutdown_log",
file_facility => "syslog",
file_severity => $rabbit_log_level,
}
::rsyslog::imfile { '05-apache2-error':
file_name => '/var/log/apache2/error.log',
file_tag => 'apache2_error',

View File

@ -39,8 +39,10 @@ describe 'openstack::logging' do
should contain_class('rsyslog::params')
should contain_rsyslog__imfile('04-rabbitmq')
should contain_rsyslog__imfile('04-rabbitmq-sasl')
should contain_rsyslog__imfile('04-rabbitmq-shutdown_err')
should contain_rsyslog__imfile('04-rabbitmq-startup_err')
should contain_rsyslog__imfile('04-rabbitmq-startup_log')
should contain_rsyslog__imfile('04-rabbitmq-shutdown_err')
should contain_rsyslog__imfile('04-rabbitmq-shutdown_log')
should contain_rsyslog__imfile('05-apache2-error')
should contain_rsyslog__imfile('11-horizon_access')
should contain_rsyslog__imfile('11-horizon_error')

View File

@ -1,10 +1,10 @@
notice('MODULAR: logging.pp')
$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))
$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))
$rabbit_fqdn_prefix = hiera('node_name_prefix_for_messaging', 'messaging-')
##################################################
$base_syslog_rserver = {
@ -41,26 +41,27 @@ if $use_syslog {
}
class { '::openstack::logging':
role => 'client',
show_timezone => true,
role => 'client',
show_timezone => true,
# log both locally include auth, and remote
log_remote => true,
log_local => true,
log_auth_local => true,
log_remote => true,
log_local => true,
log_auth_local => true,
# keep four weekly log rotations,
# force rotate if 300M size have exceeded
rotation => 'weekly',
keep => '4',
minsize => '10M',
maxsize => '100M',
rotation => 'weekly',
keep => '4',
minsize => '10M',
maxsize => '100M',
# remote servers to send logs to
rservers => $rservers,
rservers => $rservers,
# should be true, if client is running at virtual node
virtual => str2bool($::is_virtual),
virtual => str2bool($::is_virtual),
rabbit_fqdn_prefix => $rabbit_fqdn_prefix,
# Rabbit doesn't support syslog directly
rabbit_log_level => 'NOTICE',
debug => $debug,
ironic_collector => $ironic_collector,
rabbit_log_level => 'NOTICE',
debug => $debug,
ironic_collector => $ironic_collector,
}
class { '::cluster::haproxy::rsyslog': }