blob: 6c7998239985d4723b451d5908f478bc16a89c78 [file] [log] [blame]
{%- set log_handlers = [] -%}
{%- set app_name = _data.logging.app_name -%}
{%- for log_handler_name, log_handler_attrs in _data.logging.log_handlers.items() %}
{%- if log_handler_attrs.get('enabled', False) %}
{%- do log_handlers.append(log_handler_name) -%}
{%- endif %}
{%- endfor %}
[loggers]
keys = root, {{ app_name }}
[handlers]
keys = {{ log_handlers | join(", ") }}
[formatters]
keys = context, default{% if _data.logging.log_handlers.get('fluentd', {}).get('enabled', False) %}, fluentd{% endif %}
[logger_root]
level = {{ _data.logging.get('loggers', {}).get('root', {}).get('level', 'WARNING') }}
handlers = {{ log_handlers | join(", ") }}
[logger_{{ app_name }}]
level = {{ _data.logging.get('loggers', {}).get('{{ app_name }}', {}).get('level', 'INFO') }}
handlers = {{ log_handlers | join(", ") }}
qualname = {{ app_name }}
propagate = 0
[logger_amqp]
level = {{ _data.logging.get('loggers', {}).get('amqp', {}).get('level', 'WARNING') }}
handlers = {{ log_handlers | join(", ") }}
qualname = amqp
[logger_amqplib]
level = {{ _data.logging.get('loggers', {}).get('amqplib', {}).get('level', 'WARNING') }}
handlers = {{ log_handlers | join(", ") }}
qualname = amqplib
[logger_sqlalchemy]
level = {{ _data.logging.get('loggers', {}).get('sqlalchemy', {}).get('level', 'WARNING') }}
handlers = {{ log_handlers | join(", ") }}
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 = {{ _data.logging.get('loggers', {}).get('boto', {}).get('level', 'WARNING') }}
handlers = {{ log_handlers | join(", ") }}
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 = {{ _data.logging.get('loggers', {}).get('suds', {}).get('level', 'INFO') }}
handlers = {{ log_handlers | join(", ") }}
qualname = suds
[logger_eventletwsgi]
level = {{ _data.logging.get('loggers', {}).get('eventletwsgi', {}).get('level', 'WARNING') }}
handlers = {{ log_handlers | join(", ") }}
qualname = eventlet.wsgi.server
{% if _data.logging.log_handlers.get('fluentd').get('enabled', False) -%}
[handler_fluentd]
class = fluent.handler.FluentHandler
args = ('openstack.{{ service_name | replace("-", ".", 1) }}', 'localhost', 24224)
formatter = fluentd
{%- endif %}
{% if _data.logging.log_handlers.watchedfile.enabled -%}
[handler_watchedfile]
class = handlers.WatchedFileHandler
args = ('/var/log/{{ app_name }}/{{ service_name }}.log',)
formatter = context
{%- endif %}
{% if _data.logging.log_handlers.get('ossyslog', {}).get('enabled', False) -%}
{%- set ossyslog_args = _data.logging.log_handlers.ossyslog.get('args', {}) -%}
[handler_ossyslog]
class = oslo_log.handlers.OSSysLogHandler
# the OSSysLogHandler uses 'syslog' lib, where the LOG_* facilities are already *8
# but in the context where the args are evaluated we have access only to Python's
# handlers.SysLogHandler.LOG_* constants that _ARE_NOT_ multiplied by 8.
# To not have a completely magic single int in the rendered template,
# we multiply it here.
args = ( 8 * handlers.SysLogHandler.{{ ossyslog_args.get('facility', 'LOG_USER') }}, )
formatter = context
{%- endif %}
[formatter_context]
class = oslo_log.formatters.ContextFormatter
[formatter_default]
format = %(message)s
{% if _data.logging.log_handlers.get('fluentd').get('enabled', False) -%}
[formatter_fluentd]
class = oslo_log.formatters.FluentFormatter
{%- endif %}