<p>I am implementing a Kubernetes based solution where I am autoscaling a deployment based on a dynamic metric. I am running this deployment with autoscaling capabilities against a workload for 15 minutes. During this time, pods of this deployment are created and deleted dynamically as a result of the deployment autoscaling decisions.</p>
<p>I am interested in saving (for later inspection) of the logs of  each of the dynamically created (and potentially deleted) pods  occuring in the course of the autoscaling experiment.</p>
<p>If the deployment has a label like <strong>app=myapp</strong> ,  can I run the below command to store all the logs of my deployment?</p>
<pre><code>kubectl logs -l app=myapp  &gt; myfile.txt
</code></pre>
<p>Any other more reliable suggestion (without the overhead of manual central logging solution) ?  I am runnig on goole kubernetes engine GKE,  Does the GKE keep the logs of deleted pods?</p>
<p>Thank you.</p>

Mazen Ezzeddine
<p>Yes, by default GKE sends logs for <em>all</em> pods to Stackdriver and you can view/query them there.</p>
