<p>I am new to kubernetes and want to follow the logs for two pods at the same time. But to do that i have to open two terminals and use the following command</p>
<pre class="lang-sh prettyprint-override"><code>kubectl logs -f &lt;POD_NAME&gt; -n namespace
</code></pre>
<p>I was wondering if there was some better way to get the logs without opening multiple terminals as this creates a serious problem if the number of pods increase.</p>
<p>I am not looking for some logging tool but some easy to set up way which can help me in achieving this.</p>
<p>Thanks in advance.</p>

DockerNaughty
<p>As already explained in the previous you can use the labels if the pods shares any. If you have multiple containers in a pod you can use this command:</p>
<pre><code>kubectl logs -n &lt;namespace&gt; -f deployment/&lt;app-name&gt;
--all-containers=true
</code></pre>
<p>If you are looking for some simple tool you have couple of options:</p>
<ul>
<li><a href="https://github.com/stern/stern" rel="nofollow noreferrer">Stern</a></li>
</ul>
<p>Stern allows you to tail multiple pods on Kubernetes and multiple containers within the pod. Each result is color coded for quicker debugging. The query is a regular expression so the pod name can easily be filtered and you don't need to specify the exact id (for instance omitting the deployment id). If a pod is deleted it gets removed from tail and if a new pod is added it automatically gets tailed.</p>
<p>With a simple command like this:</p>
<pre><code>stern -n &lt;namespace&gt; &lt;app-name&gt; -t --since 30m
</code></pre>
<p>Stern will tail logs from the given namespace for that app name since last 30 minutes.</p>
<ul>
<li><a href="https://github.com/johanhaleby/kubetail" rel="nofollow noreferrer">Kubetail</a></li>
</ul>
<p>It`s a bash script that enables you to aggregate (tail/follow) logs from multiple pods into one stream. This is the same as running &quot;kubectl logs -f &quot; but for multiple pods.</p>
<ul>
<li><a href="https://github.com/boz/kail" rel="nofollow noreferrer">Kail</a></li>
</ul>
<p>Streams logs from all containers of all matched pods. Match pods by service, replicaset, deployment, and others. Adjusts to a changing cluster - pods are added and removed from logging as they fall in or out of the selection.</p>
<ul>
<li><a href="https://github.com/dtan4/k8stail" rel="nofollow noreferrer">k8stail</a></li>
</ul>
<p>It`s tail -f experience for Kubernetes Pods</p>
