<p>Forgive me for asking a stupid question but I can't seem to find anywhere in the Kubernetes API reference how to query logs via the REST API if there's more than one container running inside the pod?</p>
<p><code>cURL -k -H Authorization: Bearer my-super-secret-token https://kubernetes/api/v1/namespaces/default/pods/my-app-1/log</code></p>
<p>Returns:</p>
<blockquote>
<p>{&quot;kind&quot;:&quot;Status&quot;,&quot;apiVersion&quot;:&quot;v1&quot;,&quot;metadata&quot;:{},&quot;status&quot;:&quot;Failure&quot;,&quot;message&quot;:&quot;a
container name must be specified for pod my-app-1,
choose one of: [nginx php-fpm]&quot;,&quot;reason&quot;:&quot;BadRequest&quot;,&quot;code&quot;:400}</p>
</blockquote>
<p>I tried:</p>
<p><code>cURL -k -H Authorization: Bearer my-super-secret-token https://kubernetes/api/v1/namespaces/default/pods/my-app-1/nginx/log</code></p>
<p>and it results in an error that the resource can't be found.</p>
<p>How do I specify the container name when making an HTTP request to the API?</p>

<p>Figured it out - I needed to add <strong>container</strong> using a query parameter:</p>
<p><em>?container=nginx</em></p>
<p><strong>Working Example:</strong></p>
<p><code>cURL -k -H Authorization: Bearer my-super-secret-token https://kubernetes/api/v1/namespaces/default/pods/my-app-1/log?container=nginx</code></p>
