Add logging class for controller nodes

As the first step to expose logs, we'll be using apache to server them
over HTTP.

Change-Id: I569b4fc58bae8aba4d3451f9eb544304cef89e5d
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2016-02-24 16:52:50 -05:00
parent 40e037ec7b
commit e0bce42ecf
3 changed files with 60 additions and 0 deletions

View File

@ -348,4 +348,7 @@ class infracloud::controller(
class { '::nova::scheduler':
enabled => true,
}
### Logging ###
class { '::infracloud::logs': }
}

38
manifests/logs.pp Normal file
View File

@ -0,0 +1,38 @@
# class: OpenStack Infra Logs
class infracloud::logs(
$port = '80',
$vhost_name = $::fqdn,
$docroot = '/var/www/logs',
) {
include ::apache
file { $docroot:
ensure => directory,
require => Class['::apache'],
}
# Allow everybody to read neutron logs.
file { '/var/log/neutron':
ensure => directory,
group => adm,
mode => '0644',
owner => neutron,
require => Class['::neutron'],
}
file { "${docroot}/neutron":
ensure => link,
target => '/var/log/neutron',
group => root,
owner => root,
require => [
File[$docroot],
File['/var/log/neutron'],
],
}
::apache::vhost::custom { $vhost_name:
ensure => present,
content => template('infracloud/logs.vhost.erb'),
}
}

19
templates/logs.vhost.erb Normal file
View File

@ -0,0 +1,19 @@
# ************************************
# Managed by Puppet
# ************************************
<VirtualHost <%= vhost_name %>:<%= @port %>>
DocumentRoot <%= @docroot %>
<Directory <%= @docroot %>>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Require all granted
</Directory>
ErrorLog /var/log/<%= scope.lookupvar("::apache::params::apache_name") %>/<%= @name %>_error.log
LogLevel warn
CustomLog /var/log/<%= scope.lookupvar("::apache::params::apache_name") %>/<%= @name %>_access.log combined
ServerSignature Off
AddType text/plain .log
</VirtualHost>