<p>I have joined a project where we deploy our apps on Azure cloud. The apps are in docker containers orchestrated by kubernetes.</p>
<p>We get the data from a POD log file with this command (YAML code below)</p>
<p>kubectl logs --namespace=app-prod <br />
deployment/app-fd-prod <br />
&gt; $(logFile)</p>
<p>where logFile is a variable</p>
<p>Now the problem is, yesterday the log file was 27MB. Today the log file is 2MB that means the old data got deleted some how.</p>
<p>I have read about logRotate but i dont think we have implemented that.</p>
<p>I want to know what can be the reason of deletion of yesterday's log file text ?</p>
<p>Any leads, helps would be appreciated.</p>

<p>pod logs get rotated for you as pointed out by @jordanm in the comments. You need a log aggregation tool like the ELK/EFK stack (Elastic + Logstash + kibana or Elastic + fluentd + kibana) or Promtail + loki + grafana. These stacks tail the logs of containers, do some fancy parsing / manipulation and ships it to persistent storage like S3.</p>
<p>Side note you can take a look at the <a href="https://github.com/banzaicloud/logging-operator" rel="nofollow noreferrer">logging operator</a> that makes the config of these things a little easier.</p>
