Support custom log formatters across openstack charms (especially JSONFormatter) to improve parsing by log collection tools
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Charm Helpers |
Triaged
|
Wishlist
|
Unassigned | ||
OpenStack Ceilometer Charm |
Triaged
|
Wishlist
|
Unassigned | ||
OpenStack Cinder Charm |
Triaged
|
Wishlist
|
Unassigned | ||
OpenStack Glance Charm |
Triaged
|
Wishlist
|
Unassigned | ||
OpenStack Heat Charm |
Triaged
|
Wishlist
|
Unassigned | ||
OpenStack Keystone Charm |
Triaged
|
Wishlist
|
Unassigned | ||
OpenStack Neutron API Charm |
Triaged
|
Wishlist
|
Unassigned | ||
OpenStack Neutron Gateway Charm |
Triaged
|
Wishlist
|
Unassigned | ||
OpenStack Nova Cloud Controller Charm |
Triaged
|
Wishlist
|
Unassigned |
Bug Description
Currently our logging.conf files look as follows across different charms:
https:/
This may be fine for single-line messages like that:
(keystone.
But not for multi-line tracebacks:
(keystone): 2017-10-22 05:00:02,293 CRITICAL DBNonExistentTable: (sqlite3.
25',)]
Traceback (most recent call last):
File "/usr/bin/
sys.
... <MANY LINES HERE>
File "/usr/lib/
... <EVEN MORE LINES>
File "/usr/lib/
cursor.
DBNonExistentTable: (sqlite3.
http://
For example, without additional configuration, FileBeat will collect each line in a traceback as a separate message (see the screenshot attached).
Multi-line processing in tools such as FileBeat or logstash could be used to properly parse traceback and send it for storage as a single data point but this is an additional burden.
Instead, custom formatters like JSONFormatter or FluentFormatter could be used to present structured output.
JSONFormatter specifically seems to pre-process a traceback and put it into a single value in a json message:
https:/
https:/
It would be useful to have a generic mechanism to render a custom logging.conf file or just allow passing your own jinja2 template.
https:/
https:/
[loggers]
keys=<comma-
[handlers]
keys=<comma-
[formatters]
keys=<comma-
[logger_
level = <level-string>
handlers = <handler-string>
qualname = <qualname-string>
[handler_
class = <handler-
args = <handler-tuple>
formatter = <formatter-name> # e.g. <class-formatter> or <format-formatter>
[formatter_
class = <formatter-
# e.g class = oslo_log.
[formatter_
format = <format-
An accompanying unit test can be used as a reference for validation & supported keys reference to a certain extent.
https:/
=====
Ideas:
* allow specifying a map of handlers to be enabled at any given moment (e.g. /var/log/
* allow overriding default loggers and handlers: one might want to disable a default handler but also to override it
+1 on making this automatic if the openstack charms are deployed with log monitoring tools that want this feature - this would require updating the log config if filebeat or suchlike is related to the charm.
That makes this foolproof, rather than plugging in via configuration options which is never nice IMHO.