Setup logging to rsyslog for swift

This makes it so Swift logs will be sent to /var/log/swift
instead of staying in journal/syslog

Change-Id: Iee7d5eac496a49b3776d0ded756159dfd821d9e9
This commit is contained in:
David Moreau-Simard 2016-07-15 14:48:19 -04:00 committed by Emilien Macchi
parent 4551005844
commit 927f0a0a74
2 changed files with 66 additions and 0 deletions

36
files/rsyslog-swift.conf Normal file
View File

@ -0,0 +1,36 @@
# https://github.com/openstack/swift/blob/9fc55ee2b4a0a9d86fd35127dafbeacfcbd6ed85/etc/swift-rsyslog.conf-sample
# Uncomment the following to have a log containing all logs together
#local.* /var/log/swift/all.log
# Uncomment the following to have hourly swift logs.
#$template HourlyProxyLog,"/var/log/swift/hourly/%$YEAR%%$MONTH%%$DAY%%$HOUR%"
#local0.* ?HourlyProxyLog
# Use the following to have separate log files for each of the main servers:
# account-server, container-server, object-server, proxy-server. Note:
# object-updater's output will be stored in object.log.
if $programname contains 'swift' then /var/log/swift/swift.log
if $programname contains 'account' then /var/log/swift/account.log
if $programname contains 'container' then /var/log/swift/container.log
if $programname contains 'object' then /var/log/swift/object.log
if $programname contains 'proxy' then /var/log/swift/proxy.log
# Uncomment the following to have specific log via program name.
#if $programname == 'swift' then /var/log/swift/swift.log
#if $programname == 'account-server' then /var/log/swift/account-server.log
#if $programname == 'account-replicator' then /var/log/swift/account-replicator.log
#if $programname == 'account-auditor' then /var/log/swift/account-auditor.log
#if $programname == 'account-reaper' then /var/log/swift/account-reaper.log
#if $programname == 'container-server' then /var/log/swift/container-server.log
#if $programname == 'container-replicator' then /var/log/swift/container-replicator.log
#if $programname == 'container-updater' then /var/log/swift/container-updater.log
#if $programname == 'container-auditor' then /var/log/swift/container-auditor.log
#if $programname == 'container-sync' then /var/log/swift/container-sync.log
#if $programname == 'object-server' then /var/log/swift/object-server.log
#if $programname == 'object-replicator' then /var/log/swift/object-replicator.log
#if $programname == 'object-updater' then /var/log/swift/object-updater.log
#if $programname == 'object-auditor' then /var/log/swift/object-auditor.log
# Use the following to discard logs that don't match any of the above to avoid
# them filling up /var/log/messages.
local1.* ~

View File

@ -2,6 +2,36 @@ class openstack_integration::swift {
include ::openstack_integration::config include ::openstack_integration::config
# Setup logging to /var/log/swift
# TODO: Move rsyslog implementation to something more generic
package { 'rsyslog':
ensure => present,
}
service { 'rsyslog':
ensure => running,
enable => true,
require => Package['rsyslog'],
}
file { '/var/log/swift':
ensure => directory,
mode => '0755',
}
file { '/etc/rsyslog.d/10-swift.conf':
ensure => present,
source => "puppet:///modules/${module_name}/rsyslog-swift.conf",
require => [Package['rsyslog'], File['/var/log/swift']],
notify => Service['rsyslog'],
}
# Ubuntu/Debian requires particular permissions for rsyslog to work
if $::osfamily == 'Debian' {
File<| title == '/var/log/swift' |> {
owner => 'syslog',
group => 'adm'
}
}
# TODO(emilien): deploy memcached in IPv6 # TODO(emilien): deploy memcached in IPv6
include ::memcached include ::memcached
class { '::swift': class { '::swift':