Skip to content

How to collect stdout and stderr logs in sidecar mode? #6030

Answered by rfratto
edwardzjl asked this question in Q&A
Discussion options

You must be logged in to vote

The sidecar pattern isn't fully recommended because the overhead of each container can quickly add up and consume a lot of resources.

However, if you must use a sidecar pattern, there are two choices to collect logs from a container:

  1. The container to collect logs from must pipe stdout/stderr logs to a file accessible by the sidecar container
  2. A combination of the discovery.kubelet and loki.source.kubernetes components can be used to discover the other containers in the same pod and collect logs from it; this uses the Kubernetes API for collecting logs. discovery.kubernetes may be used in place of discovery.kubelet, but with discovery.kubernetes, many sidecar containers can cause too much …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@edwardzjl
Comment options

Answer selected by edwardzjl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants