<p>I want to continuously log from kubernetes pod where my application is running to a custom path/file. Is this possible and how to do it without some 3rd party logging processors?</p>

deckard cain
<p>Kubernetes by itself provides only basic logging like in <a href="https://kubernetes.io/docs/concepts/cluster-administration/logging/#basic-logging-in-kubernetes" rel="nofollow noreferrer">this</a> tutorial.</p>

<p>However in my attempt I was unsuccessful in writing any logs from default nginx container by using custom echo commands from cli using this technique. Only pre-configured nginx logs were working.</p>

<p>According to Kubernetes documentation this can't be done without using <a href="https://docs.docker.com/config/containers/logging/configure/" rel="nofollow noreferrer">logging driver</a>.</p>

<blockquote>
  <p>While Kubernetes does not provide a native solution for cluster-level
  logging, there are several common approaches you can consider. Here
  are some options:</p>
  
  <ul>
  <li>Use a node-level logging agent that runs on every node.</li>
  <li>Include a dedicated sidecar container for logging in an application pod.</li>
  <li>Push logs directly to a backend from within an application.</li>
  </ul>
</blockquote>

<p>Which is basically using 3rd party logging processors.</p>

<blockquote>
  <p>Kubernetes doesn’t specify a logging agent, but two optional logging agents are packaged with the Kubernetes release: <a href="https://kubernetes.io/docs/user-guide/logging/stackdriver" rel="nofollow noreferrer">Stackdriver Logging</a> for use with Google Cloud Platform, and <a href="https://kubernetes.io/docs/user-guide/logging/elasticsearch" rel="nofollow noreferrer">Elasticsearch</a>. You can find more information and instructions in the dedicated documents. Both use <a href="http://www.fluentd.org/" rel="nofollow noreferrer">fluentd</a> with custom configuration as an agent on the node.</p>
</blockquote>

<p>Intercepting stdout and stderr without logging driver also had negative results.
Simplest solution is to use logging agent.</p>
