<p>I have developed a web microservice in Golang. I have used zap logger to log the application log in a file at location <strong>/var/log/myapp/myapp.log</strong>.</p>
<p><strong>I want to see log information in file myapp.log through below command:</strong></p>
<p><em>#kubectl logs mayappPod</em></p>
<p>But it is not working as by default STDOUT and STDERR output is redirected to kubectl logs command.</p>
<p><strong>So my question is what exactly I am supposed to do to see the /var/log/myapp/myapp.log log through kubectl logs command.</strong></p>
<p>Thanks,
Rohit</p>

Rohit
<p><code>kubectl logs</code> command just show you logs from container(s) you specified. And container got logs from <code>STDOUT</code> and <code>STDERR</code>.</p>
<p>The recommended way is to setup your logging library to write logs to <code>STDOUT</code>. But as a workaround you can create symlink from <code>/var/log/myapp/myapp.log</code> to <code>/dev/stdout</code> in your docker container.</p>
<p>Another option is not use <code>kubectl logs</code> at all. You could copy this log file from your pod using <code>kubectl cp &lt;some-namespace&gt;/&lt;some-pod&gt;:/tmp/foo /tmp/bar</code> <a href="https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#cp" rel="nofollow noreferrer">see</a></p>
