<p>I have a Pod with two containers.</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: test
spec:
  containers:
  - name: my-container
    image: google/my-container:v1
  - name: third-party
    image:  google/third-party:v1
</code></pre>

<p>One container is my image and the second is third-party image which I can’t control its stdout/stderr.<br>
I need that my-container will access logs written in third-party container.<br>
Inside "my-container" I want to collect all the stdout and stderr from the "third-party" container, add some metadata and write it with my logger.</p>

<p>I cant use a privileged container with volumeMounts.</p>

<p>If I could do something like this it was great.</p>

<pre><code> containers:
  - name: my-container
    image: google/my-container:v1
    volumeMounts:
    - name: varlog
      mountPath: /var/log

  - name: third-party
    image:  google/third-party:v1 
    stdout: /var/log/stdout
    stderr: /var/log/stderr

 volumes:
  - name: varlog
    emptyDir: {}

</code></pre>

<p>Based on the <a href="https://docs.docker.com/v17.09/engine/admin/logging/overview/" rel="nofollow noreferrer">logging driver</a> specified for docker, docker tracks the containers' logs. The default logging driver of docker is <code>json-file</code> which redirect the container's <code>stdout</code> and <code>stderr</code> logs to <code>/var/log/containers</code> folder in the host machine that runs docker.</p>

<p>In case of kubernetes, the logs will be available in the worker nodes <code>/var/log/containers</code> folder. </p>

<p>Probably, what you are looking for is <a href="https://github.com/fluent/fluentd-kubernetes-daemonset" rel="nofollow noreferrer">fluentd daemonset</a>, that creates a daemonset, which runs in each worker node and then help you move the logs to s3, cloudwatch or Elastic search. There are many sinks provided with fluentd. You can use one that suits your needs. I hope this is what you want to do with your <code>my-container</code>. </p>
