GKE kubernetes container stdout logs format changed

11/14/2018

before 1.11.2-gke.18 with legacy endpoint nodepools:

STDOUT logs from containers used be logged with

logName=projects/[PROJECT-NAME]/logs/[CONTAINER-NAME]

The resource object values used to be

resource.type=container,
resource.namespace_id=[NAMESPACE_NAME] 
resource.pod_id=[POD_NAME]

After upgrading to 1.11.2-gke.18, with a nodepool with legacy endpoints disabled:

STDOUT logs from containers are being logged with

logName=projects/[PROJECT-NAME]/logs/stdout

The resource object values are now

resource.type=k8s_container
resource.namespace_name=[NAMESPACE_NAME] 
resource.pod_name=[POD_NAME]

but the google cloud logging console basic viewer is not yet compatible with these changes:

selecting GKE Container > cluster_name > namespace_name, does not bring up these log entries - what could be the solution/fix to this problem, short of updating all my scripts to query?

-- Shanmuhanathan Thiagaraja
google-cloud-logging
google-cloud-stackdriver
google-kubernetes-engine

1 Answer

11/19/2018

If you go into the Log Viewer drop down list, you should see an option called "Kubernetes Container". This was introduced when you enable Stackdriver V2 beta on the GKE cluster. So to see these logs, you will go Kubernetes Container>Cluster_Name>namespace_name>container_name. You can read more about Stakdriver Kurbenetes here

-- Jason
Source: StackOverflow