<p>As part of kubernetes 1.19, <a href="https://kubernetes.io/blog/2020/09/04/kubernetes-1-19-introducing-structured-logs/" rel="nofollow noreferrer">structured logging</a> has been implemented.</p>
<p>I've <a href="https://kubernetes.io/docs/concepts/cluster-administration/system-logs/" rel="nofollow noreferrer">read</a> that kubernetes log's engine is <code>klog</code> and structured logs are following this format :</p>
<pre><code>&lt;klog header&gt; &quot;&lt;message&gt;&quot; &lt;key1&gt;=&quot;&lt;value1&gt;&quot; &lt;key2&gt;=&quot;&lt;value2&gt;&quot; ...
</code></pre>
<p>Cool ! But even better, you apparently can pass a <code>--logging-format=json</code> flag to <code>klog</code> so logs are generated in <code>json</code> directly !</p>
<pre><code>{
   &quot;ts&quot;: 1580306777.04728,
   &quot;v&quot;: 4,
   &quot;msg&quot;: &quot;Pod status updated&quot;,
   &quot;pod&quot;:{
      &quot;name&quot;: &quot;nginx-1&quot;,
      &quot;namespace&quot;: &quot;default&quot;
   },
   &quot;status&quot;: &quot;ready&quot;
}
</code></pre>
<p>Unfortunately, I haven't been able to find out how and where I should specify that <code>--logging-format=json</code> flag.</p>
<p>Is it a <code>kubectl</code> command? I'm using Azure's aks.</p>

Will
<p><code>--logging-format=json</code> is a flag which need to be set on all Kuberentes System Components ( Kubelet, API-Server, Controller-Manager &amp; Scheduler). You can check all flags <a href="https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet/" rel="nofollow noreferrer">here</a>.</p>
<p>Unfortunately you cant do it right now with AKS as you have the managed control plane from Microsoft.</p>
