<p>I would love to have a way to use kubectl to filter exception from a bunch of pods.</p>
<p>For example, suppose I have the following pods:</p>
<pre><code>Service-1-1
Service-1-2
Service-1-3
Service-1-4
</code></pre>
<p>Until now I moved one by one and executed:</p>
<pre><code>k logs Service-1-1 | grep exception
k logs Service-1-2 | grep exception
k logs Service-1-3 | grep exception
k logs Service-1-4 | grep exception
</code></pre>
<p>Can I have a joined filtering for all of pods at once?</p>

dushkin
<p>If the pods have a subset of labels you can filter them with, then you can use a label selector to do so.</p>
<p>Let's say all 4 pods have the label: <code>app: service</code> (and no other pods have the same label) then you can run:</p>
<pre><code>kubectl logs -l app=service | grep exception
</code></pre>
<p>See documentation here: <a href="https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#logs" rel="nofollow noreferrer">https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#logs</a></p>
