How to proxy app log-level without using the one passed with fluentd? How to proxy app log-level without using the one passed with fluentd? kubernetes kubernetes

How to proxy app log-level without using the one passed with fluentd?


I afraid there is no way to do it by standard tools without adding a custom FluentD.

First of all, your FluentD in a cluster reading a container logs provided by Docker thru json-file logging driver:

By default, Fluentd reads from /var/log/messages and /var/log/containers/.log for system logs and container logs, respectively.

Even by using SystemD logging you will get the same result - logging level is set by Docker. Kubernetes also using that driver.

For Docker json-file driver you can set log-tags, which, theoretically, can help you filter logs. But it is impossible to set that options for a container in runtime by Kubernetes, so there are now way.

The only way I see how you can do it is to use sidecar container with custom logging agent. It will looks like that:

logging agent sidecar

Using sidecar, you can run FluentD with custom configuration inside it and parse a log of your application with any modification, including of using environment variables as a log level.