<p>i have a question, similar as describe here: <a href="https://stackoverflow.com/questions/53305955/gke-kubernetes-container-stdout-logs-format-changed">GKE kubernetes container stdout logs format changed</a></p>

<p>in old version of stackdriver i had 1 sink with filter like this:</p>

<pre><code>resource.type=container,
resource.namespace_id=[NAMESPACE_NAME] 
resource.pod_id=[POD_NAME]
</code></pre>

<p>and logs was stored in bucket pretty well, like this:</p>

<pre><code>logName=projects/[PROJECT-NAME]/logs/[CONTAINER-NAME]
</code></pre>

<p>...so i had folders whith logs for each container.</p>

<p>But now i updated my stackdriver logging+monitoring to last version and now i have 2 folders stdout\stderr which contains all logs for all containers!</p>

<pre><code>logName=projects/[PROJECT-NAME]/logs/stdout
logName=projects/[PROJECT-NAME]/logs/stderr
</code></pre>

<p>All logs from many containers stored in this single folders! This is pretty uncomfortable =(</p>

<p>I'v read about this in docs: <a href="https://cloud.google.com/monitoring/kubernetes-engine/migration#changes_in_log_entry_contents" rel="nofollow noreferrer">https://cloud.google.com/monitoring/kubernetes-engine/migration#changes_in_log_entry_contents</a></p>

<blockquote>
  <p>The logName field might change. Stackdriver Kubernetes Engine Monitoring log entries use stdout or stderr in their log names whereas Legacy Stackdriver used a wider variety of names, including the container name. The container name is still available as a resource label.</p>
</blockquote>

<p>...but i can't find solution! Please, help me, how to make container per folder logging, like it was in old version of stackdriver?</p>

<p>Here is a workaround that has been suggested:</p>

<ol>
<li>Create a different sink for each of your containers filtered by
resource.labels.container_name </li>
<li>Export each sink to a different
bucket</li>
</ol>

<p><strong>Note</strong>: If you configure each separate sink to the same bucket the logs will be combined.</p>

<p>More details at <a href="https://b.corp.google.com/issues/149300373" rel="nofollow noreferrer">Google Issue Tracker</a> </p>
