<p>I have been running a pod for more than a week and there has been no restart since started. But, still I am unable to view the logs since it started and it only gives logs for the last two days. Is there any log rotation policy for the container and how to control the rotation like based on size or date?</p>

<p>I tried the below command but shows only last two days logs.</p>

<pre><code>kubectl logs POD_NAME --since=0
</code></pre>

<p>Is there any other way?</p>

<blockquote>
  <p>Is there any log rotation policy for the container and how to control the rotation like based on size or date</p>
</blockquote>

<p>The log rotation is controlled by the docker <code>--log-driver</code> and <code>--log-opts</code> (or their <a href="https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file" rel="noreferrer"><code>daemon.json</code></a> equivalent), which for any sane system has file size and file count limits to prevent a run-away service from blowing out the disk on the docker host. <em>that answer also assumes you are using docker, but that's a fairly safe assumption</em></p>

<blockquote>
  <p>Is there any other way?</p>
</blockquote>

<p>I <strong>strongly</strong> advise something like <a href="https://github.com/kubernetes/kubernetes/tree/v1.10.4/cluster/addons/fluentd-elasticsearch" rel="noreferrer">fluentd-elasticsearch</a>, or <a href="https://github.com/Graylog2/graylog-docker#readme" rel="noreferrer">graylog2</a>, or Sumologic, or Splunk, or whatever in order to egress those logs from the hosts. No serious cluster would rely on infinite log disks nor on using <code>kubectl logs</code> in a <code>for</code> loop to search the output of Pods. To say nothing of egressing the logs from the kubernetes containers themselves, which is almost essential for keeping tabs on the health of the cluster.</p>
