<p>I'm using Azure Container Insights for an AKS cluster and want to filter some logs using Log Analytics and Kusto Query Language. I do it to provide a convenient dashboard and alerts.</p>
<p>What I'm trying to achieve is list only not ready pods. Listing the ones not Running is not enough. This can be easily filtered using kubectl e.g. following this post <a href="https://stackoverflow.com/questions/58992774/how-to-get-list-of-pods-which-are-ready">How to get list of pods which are &quot;ready&quot;?</a>
However this data is not avaiable when querying in Log analytics with Kusto as the containerStatuses seems to be only a string
<a href="https://i.stack.imgur.com/EP95b.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EP95b.png" alt="enter image description here" /></a></p>
<p>It should be somehow possible because Container Insights allow this filtering in Metrics section. However it's not fully satisfying because with metrics my filtering capabilities are much smaller.</p>

<p>You can do it for pods as below for last 1h.</p>
<pre><code>let endDateTime = now();
let startDateTime = ago(1h);
 
KubePodInventory
| where TimeGenerated &lt; endDateTime
| where TimeGenerated &gt;= startDateTime
| where PodStatus != &quot;Running&quot;
| distinct Computer, PodUid, TimeGenerated, PodStatus
</code></pre>
