blob: 90c55dda5928d530e2a03fb3f815811b3c5bed02 [file] [log] [blame]
sgarbuz2d8f8052018-07-13 13:04:54 +03001{%- set log_handlers = [] -%}
sgarbuzf7cc76c2018-07-18 10:43:37 +03002{%- set app_name = _data.app_name -%}
3{%- for log_handler_name, log_handler_attrs in _data.log_handlers.items() %}
sgarbuz2d8f8052018-07-13 13:04:54 +03004 {%- if log_handler_attrs.get('enabled', False) %}
5 {%- do log_handlers.append(log_handler_name) -%}
6 {%- endif %}
7{%- endfor %}
8
9[loggers]
10keys = root, {{ app_name }}
11
12[handlers]
13keys = {{ log_handlers | join(", ") }}
14
15[formatters]
sgarbuzf7cc76c2018-07-18 10:43:37 +030016keys = context, default{% if _data.log_handlers.get('fluentd', {}).get('enabled', False) %}, fluentd{% endif %}
sgarbuz2d8f8052018-07-13 13:04:54 +030017
18[logger_root]
sgarbuzf7cc76c2018-07-18 10:43:37 +030019level = {{ _data.get('loggers', {}).get('root', {}).get('level', 'WARNING') }}
sgarbuz2d8f8052018-07-13 13:04:54 +030020handlers = {{ log_handlers | join(", ") }}
21
22[logger_{{ app_name }}]
sgarbuzf7cc76c2018-07-18 10:43:37 +030023level = {{ _data.get('loggers', {}).get('{{ app_name }}', {}).get('level', 'INFO') }}
sgarbuz2d8f8052018-07-13 13:04:54 +030024handlers = {{ log_handlers | join(", ") }}
25qualname = {{ app_name }}
26propagate = 0
27
28[logger_amqp]
sgarbuzf7cc76c2018-07-18 10:43:37 +030029level = {{ _data.get('loggers', {}).get('amqp', {}).get('level', 'WARNING') }}
sgarbuz2d8f8052018-07-13 13:04:54 +030030handlers = {{ log_handlers | join(", ") }}
31qualname = amqp
32
33[logger_amqplib]
sgarbuzf7cc76c2018-07-18 10:43:37 +030034level = {{ _data.get('loggers', {}).get('amqplib', {}).get('level', 'WARNING') }}
sgarbuz2d8f8052018-07-13 13:04:54 +030035handlers = {{ log_handlers | join(", ") }}
36qualname = amqplib
37
38[logger_sqlalchemy]
sgarbuzf7cc76c2018-07-18 10:43:37 +030039level = {{ _data.get('loggers', {}).get('sqlalchemy', {}).get('level', 'WARNING') }}
sgarbuz2d8f8052018-07-13 13:04:54 +030040handlers = {{ log_handlers | join(", ") }}
41qualname = sqlalchemy
42# "level = INFO" logs SQL queries.
43# "level = DEBUG" logs SQL queries and results.
44# "level = WARNING" logs neither. (Recommended for production systems.)
45
46[logger_boto]
sgarbuzf7cc76c2018-07-18 10:43:37 +030047level = {{ _data.get('loggers', {}).get('boto', {}).get('level', 'WARNING') }}
sgarbuz2d8f8052018-07-13 13:04:54 +030048handlers = {{ log_handlers | join(", ") }}
49qualname = boto
50
51# NOTE(mikal): suds is used by the vmware driver, removing this will
52# cause many extraneous log lines for their tempest runs. Refer to
53# https://review.openstack.org/#/c/219225/ for details.
54[logger_suds]
sgarbuzf7cc76c2018-07-18 10:43:37 +030055level = {{ _data.get('loggers', {}).get('suds', {}).get('level', 'INFO') }}
sgarbuz2d8f8052018-07-13 13:04:54 +030056handlers = {{ log_handlers | join(", ") }}
57qualname = suds
58
59[logger_eventletwsgi]
sgarbuzf7cc76c2018-07-18 10:43:37 +030060level = {{ _data.get('loggers', {}).get('eventletwsgi', {}).get('level', 'WARNING') }}
sgarbuz2d8f8052018-07-13 13:04:54 +030061handlers = {{ log_handlers | join(", ") }}
62qualname = eventlet.wsgi.server
63
sgarbuzf7cc76c2018-07-18 10:43:37 +030064{% if _data.log_handlers.get('fluentd').get('enabled', False) -%}
sgarbuz2d8f8052018-07-13 13:04:54 +030065[handler_fluentd]
66class = fluent.handler.FluentHandler
sgarbuzeab0fe52018-09-10 18:55:36 +030067args = ("openstack.{{ service_name | replace("-", ".", 1) }}", 'localhost', 24224)
sgarbuz2d8f8052018-07-13 13:04:54 +030068formatter = fluentd
69{%- endif %}
70
sgarbuzf7cc76c2018-07-18 10:43:37 +030071{% if _data.log_handlers.watchedfile.enabled -%}
sgarbuz2d8f8052018-07-13 13:04:54 +030072[handler_watchedfile]
73class = handlers.WatchedFileHandler
sgarbuzeab0fe52018-09-10 18:55:36 +030074args = ("/var/log/{{ app_name }}/{{ service_name }}.log",)
sgarbuz2d8f8052018-07-13 13:04:54 +030075formatter = context
76{%- endif %}
77
sgarbuzf7cc76c2018-07-18 10:43:37 +030078{% if _data.log_handlers.get('ossyslog', {}).get('enabled', False) -%}
79{%- set ossyslog_args = _data.log_handlers.ossyslog.get('args', {}) -%}
sgarbuz2d8f8052018-07-13 13:04:54 +030080[handler_ossyslog]
81class = oslo_log.handlers.OSSysLogHandler
82# the OSSysLogHandler uses 'syslog' lib, where the LOG_* facilities are already *8
83# but in the context where the args are evaluated we have access only to Python's
84# handlers.SysLogHandler.LOG_* constants that _ARE_NOT_ multiplied by 8.
85# To not have a completely magic single int in the rendered template,
86# we multiply it here.
87args = ( 8 * handlers.SysLogHandler.{{ ossyslog_args.get('facility', 'LOG_USER') }}, )
88formatter = context
89{%- endif %}
90
91[formatter_context]
92class = oslo_log.formatters.ContextFormatter
93
94[formatter_default]
95format = %(message)s
96
sgarbuzf7cc76c2018-07-18 10:43:37 +030097{% if _data.log_handlers.get('fluentd').get('enabled', False) -%}
sgarbuz2d8f8052018-07-13 13:04:54 +030098[formatter_fluentd]
99class = oslo_log.formatters.FluentFormatter
100{%- endif %}