<p>Is it possible to obtain Kubernetes logs for a dedicated time range?</p>
<p>All I can do right now is to make a dump of about the last-hour log for the single pod using <code>kubectl logs &gt; dump.log</code> cmd.</p>
<p>But for debugging reasons, it's necessary to obtain the logs for the last week. I was unable to find any abilities to do this in Kubernetes logs.</p>
<p>The only thought is to attach some external service like Kibana for the logs collection, but maybe built-in Kubernetes remedies allow to do this?</p>
<p>Thank you.</p>

Valerii Kulykov
<p><code>...the last-hour log for the single pod</code></p>
<p>To retrieve last 1 hour log you can do this <code>kubectl logs &lt;pod&gt; --since=1h</code>. Asserted from kubectl help for more options:</p>
<blockquote>
<p>--since=0s: Only return logs newer than a relative duration like 5s, 2m, or 3h. Defaults to all logs. Only one of since-time / since may be
used.</p>
<p>--since-time='': Only return logs after a specific date (RFC3339). Defaults to all logs. Only one of since-time / since may be used.</p>
<p>--tail=-1: Lines of recent log file to display. Defaults to -1 with no selector, showing all log lines otherwise 10, if a selector is
provided.</p>
</blockquote>
