File: example_nova.rst

package info (click to toggle)
python-oslo.log 7.2.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 820 kB
  • sloc: python: 3,815; makefile: 24; sh: 12
file content (102 lines) | stat: -rw-r--r-- 2,785 bytes parent folder | download | duplicates (5)
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
93
94
95
96
97
98
99
100
101
102
=========================================
 Example Configuration File for ``nova``
=========================================

This sample configuration file demonstrates how the OpenStack compute
service (nova) might be configured.

.. literalinclude:: nova_sample.conf
   :language: ini
   :prepend: # nova_sample.conf

Two logger nodes are set up, ``root`` and ``nova``.

.. literalinclude:: nova_sample.conf
   :language: ini
   :lines: 1-2

Several handlers are created, to send messages to different outputs.

.. literalinclude:: nova_sample.conf
   :language: ini
   :lines: 4-5

And two formatters are created to be used based on whether the logging
location will have OpenStack request context information available or
not.
A Fluentd formatter is also shown.

.. literalinclude:: nova_sample.conf
   :language: ini
   :lines: 7-8

The ``root`` logger is configured to send messages to the ``null``
handler, silencing most messages that are not part of the nova
application code namespace.

.. literalinclude:: nova_sample.conf
   :language: ini
   :lines: 10-12

The ``nova`` logger is configured to send messages marked as ``INFO``
and higher level to the standard error stream.

.. literalinclude:: nova_sample.conf
   :language: ini
   :lines: 14-17

The ``amqp`` and ``amqplib`` loggers, used by the module that connects
the application to the message bus, are configured to emit warning
messages to the standard error stream.

.. literalinclude:: nova_sample.conf
   :language: ini
   :lines: 19-27

The ``sqlalchemy`` logger, used by the module that connects the
application to the database, is configured to emit warning messages to
the standard error stream.

.. literalinclude:: nova_sample.conf
   :language: ini
   :lines: 29-35

Similarly, ``boto``, ``suds``, and ``eventlet.wsgi.server`` are
configured to send warnings to the standard error stream.

.. literalinclude:: nova_sample.conf
   :language: ini
   :lines: 37-53

The ``stderr`` handler, being used by most of the loggers above, is
configured to write to the standard error stream on the console.

.. literalinclude:: nova_sample.conf
   :language: ini
   :lines: 55-58

The ``stderr`` handler uses the ``context`` formatter, which takes its
configuration settings from ``oslo.config``.

.. literalinclude:: nova_sample.conf
   :language: ini
   :lines: 85-86

The ``stdout`` and ``syslog`` handlers are defined, but not used.

The ``fluent`` handler is useful to send logs to ``fluentd``.
It is a part of fluent-logger-python and you can install it as following.

::

    $ pip install fluent-logger

This handler is configured to use ``fluent`` formatter.

.. literalinclude:: nova_sample.conf
   :language: ini
   :lines: 75-78

.. literalinclude:: nova_sample.conf
   :language: ini
   :lines: 91-92