<p>I am working with logs in my system.<br />
I want to use a log sidecar to collect business container's log.</p>
<p>And my business container's log will write to its <strong>STDOUT</strong>.</p>
<p>So I want to redirect this STDOUT to pod's volume file, because in a pod all containers share the same volume, so my sidecar can collect log from volume.</p>
<p>How should I configuer this?<br />
I mean maybe I should write some configuration in my k8s yaml so k8s will automaticlly redirect the container's <strong>STDOUT</strong> to pod's volume?</p>

elon_musk
<p>Adding this <code>2&gt;&amp;1 &gt; /&lt;your_path_to_volume_inside_pod&gt;/file.log</code> to your <code>command</code> would redirect <code>STDOUT</code> and <code>STDERR</code> to a file</p>
