<p>Our setup:</p>

<p>We are using kubernetes in GCP.
We have pods that write logs to a shared volume, with a sidecar container that sucks up our logs for our logging system.
We cannot just use stdout instead for this process.</p>

<p>Some of these pods are long lived and are filling up disk space because of no log rotation.</p>

<p>Question:
What is the easiest way to prevent the disk space from filling up here (without scheduling pod restarts)?</p>

<p>I have been attempting to install logrotate using: <code>RUN apt-get install -y logrotate</code> in our Dockerfile and placing a logrotate config file in <code>/etc/logrotate.d/dynamicproxy</code> but it doesnt seem to get run. <code>/var/lib/logrotate/status</code> never gets generated.</p>

<p>I feel like I am barking up the wrong tree or missing something integral to getting this working. Any help would be appreciated.</p>

<p>We ended up writing our own daemonset to properly collect the logs from the nodes instead of the container level. We then stopped writing to shared volumes from the containers and logged to stdout only.</p>

<p>We used fluentd to the logs around.</p>

<p><a href="https://github.com/splunk/splunk-connect-for-kubernetes/tree/master/helm-chart/splunk-kubernetes-logging" rel="nofollow noreferrer">https://github.com/splunk/splunk-connect-for-kubernetes/tree/master/helm-chart/splunk-kubernetes-logging</a></p>
