Example Configuration File for novaΒΆ

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

# nova_sample.conf
[loggers]
keys = root, nova

[handlers]
keys = stderr, stdout, watchedfile, syslog, fluent, null

[formatters]
keys = context, default, fluent

[logger_root]
level = WARNING
handlers = null

[logger_nova]
level = INFO
handlers = stderr
qualname = nova

[logger_amqp]
level = WARNING
handlers = stderr
qualname = amqp

[logger_amqplib]
level = WARNING
handlers = stderr
qualname = amqplib

[logger_sqlalchemy]
level = WARNING
handlers = stderr
qualname = sqlalchemy
# "level = INFO" logs SQL queries.
# "level = DEBUG" logs SQL queries and results.
# "level = WARNING" logs neither.  (Recommended for production systems.)

[logger_boto]
level = WARNING
handlers = stderr
qualname = boto

# NOTE(mikal): suds is used by the vmware driver, removing this will
# cause many extraneous log lines for their tempest runs. Refer to
# https://review.openstack.org/#/c/219225/ for details.
[logger_suds]
level = INFO
handlers = stderr
qualname = suds

[logger_eventletwsgi]
level = WARNING
handlers = stderr
qualname = eventlet.wsgi.server

[handler_stderr]
class = StreamHandler
args = (sys.stderr,)
formatter = context

[handler_stdout]
class = StreamHandler
args = (sys.stdout,)
formatter = context

[handler_watchedfile]
class = handlers.WatchedFileHandler
args = ('nova.log',)
formatter = context

[handler_syslog]
class = handlers.SysLogHandler
args = ('/dev/log', handlers.SysLogHandler.LOG_USER)
formatter = context

[handler_fluent]
class = fluent.handler.FluentHandler
args = ('openstack.nova', 'localhost', 24224)
formatter = fluent

[handler_null]
class = logging.NullHandler
formatter = default
args = ()

[formatter_context]
class = oslo_log.formatters.ContextFormatter

[formatter_default]
format = %(message)s

[formatter_fluent]
class = oslo_log.formatters.FluentFormatter

Two logger nodes are set up, root and nova.

[loggers]
keys = root, nova

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

[handlers]
keys = stderr, stdout, watchedfile, syslog, fluent, null

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.

[formatters]
keys = context, default, fluent

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.

[logger_root]
level = WARNING
handlers = null

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

[logger_nova]
level = INFO
handlers = stderr
qualname = nova

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.

[logger_amqp]
level = WARNING
handlers = stderr
qualname = amqp

[logger_amqplib]
level = WARNING
handlers = stderr
qualname = amqplib

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.

[logger_sqlalchemy]
level = WARNING
handlers = stderr
qualname = sqlalchemy
# "level = INFO" logs SQL queries.
# "level = DEBUG" logs SQL queries and results.
# "level = WARNING" logs neither.  (Recommended for production systems.)

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

[logger_boto]
level = WARNING
handlers = stderr
qualname = boto

# NOTE(mikal): suds is used by the vmware driver, removing this will
# cause many extraneous log lines for their tempest runs. Refer to
# https://review.openstack.org/#/c/219225/ for details.
[logger_suds]
level = INFO
handlers = stderr
qualname = suds

[logger_eventletwsgi]
level = WARNING
handlers = stderr
qualname = eventlet.wsgi.server

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

[handler_stderr]
class = StreamHandler
args = (sys.stderr,)
formatter = context

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

[formatter_context]
class = oslo_log.formatters.ContextFormatter

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.

[handler_fluent]
class = fluent.handler.FluentHandler
args = ('openstack.nova', 'localhost', 24224)
formatter = fluent
[formatter_fluent]
class = oslo_log.formatters.FluentFormatter