Skip to content

JSON format support for container logs #3955

@jchampet

Description

@jchampet

What is the problem you're trying to solve
Currently containerd uses supports text format for logs.

For example for /var/log/containers/coredns-*, the text log output would typically be in the format:
2020-01-10T18:10:40.01576219Z stdout F [INFO] plugin/reload: Running configuration MD5 = 4665410bf21c8b272fcfd562c482cb82

Describe the solution you'd like
I'd like the ability to configure containerd to write container logs using JSON format instead.

Re-using the example above of /var/log/containers/coredns-*, the JSON log format would be:
{"log":"[INFO] plugin/reload: Running configuration MD5 = 4665410bf21c8b272fcfd562c482cb82\n","stream":"stdout","time":"2020-01-10T17:22:50.838559221Z"}

Ideally, I'd like to use the configuration file at /etc/containerd/config.toml to switch between Text and JSON format for logs.

Additional context
This is for easy parsing by 3PP tools such as Elasticsearch and Splunk.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions