~themue/clouddocs/009-openstack

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
Title: Logging - OpenStack
Status: In Progress

# Logging - OpenStack

## Introduction

**TODO**

## Scope

**TODO**

## Connecting to rsyslogd

By default OpenStack is writting its logging output into files into directories for each
component, like `/var/log/nova` or `/var/log/glance`. For the usage of `rsyslogd` the components
have to be configured to also log to `syslog`. When doing this also configure each component
to log into a different syslog facility. This will help you to split the logs into individual
components on the central logging server. So ensure the following settings:

**/etc/nova/nova.conf:**

````
use_syslog=True
syslog_log_facility=LOG_LOCAL0
````

**/etc/glance/glance-api.conf and /etc/glance/glance-registry.conf:**

````
use_syslog=True
syslog_log_facility=LOG_LOCAL1
````

**/etc/cinder/cinder.conf:**

````
use_syslog=True
syslog_log_facility=LOG_LOCAL2
````

**/etc/keystone/keystone.conf:**

````
use_syslog=True
syslog_log_facility=LOG_LOCAL3
````

The object storage Swift be fault already logs to syslog. So you now can tell the local
rsyslogd clients to pass the logged information to the logging server. You'll do this
by creating a `/etc/rsyslog.d/client.conf` containing the line like

````
*.* @192.16.1.10
````

where the IP address points to your rsyslogd server. Best is to choose a server that is
dedicated to this task only. Here you've got to create the file `/etc/rsyslog.d/server.conf`
contining the settings

````
# Enable UDP
$ModLoad imudp
# Listen on 192.168.1.10 only
$UDPServerAddress 192.168.1.10
# Port 514
$UDPServerRun 514
# Create logging templates for nova
$template NovaFile,"/var/log/rsyslog/%HOSTNAME%/nova.log"
$template NovaAll,"/var/log/rsyslog/nova.log"
# Log everything else to syslog.log
$template DynFile,"/var/log/rsyslog/%HOSTNAME%/syslog.log"
*.* ?DynFile
# Log various openstack components to their own individual file
local0.* ?NovaFile
local0.* ?NovaAll
& ~
````

This example only contains the settings for Nova only, the other OpenStack components
have to be added the same way. Using two templates per component, one containing the 
`%HOSTNAME%` variable and one without it enables a better splitting of the logged 
data. Think about the two example nodes `alpha.example.com` and `bravo.example.com`.
They will write their logging into the files

- `/var/log/rsyslog/alpha.example.com/nova.log` - only the data of alpha,
- `/var/log/rsyslog/bravo.example.com/nova.log` - only the data of bravo,
- `/var/log/rsyslog/nova.log` - the combined data of both.

This allows a quick overview over all nodes as well as the focussed analysis of an
individual node.