Logging sent to STDOUT/STDERR on Google Container Engine pods not showing in Cloud Logging

3/20/2016

From what I understand any output sent to STDOUT/STDERR from the Docker processes running in a GKE pod should show up in Cloud Logging if enabled.

My Ruby on Rails app is configured to print to STDOUT which I have verified by running kubectl logs <POD_NAME> and seen the values for each HTTP request as I expect. However even though I have ensured that I have enabled Cloud Logging I do not see these same values in Logging. Is there another step necessary?

SSH-ing into the container I see gcr.io/google_containers/fluentd-gcp:1.15 running as well as a pause container PORTS k8s_POD.6d00e006_fluentd-cloud-logging-gke-web.

Version of the pod running the Rails app:

...  MASTER_VERSION  MASTER_IP       MACHINE_TYPE      NODE_VERSION  NUM_NODES  STATUS
...  1.1.8           104.196.24.206  g1-small          1.1.8         1          RUNNING
-- Jared S
google-kubernetes-engine

1 Answer

3/20/2016

Sorry if you already have, but did you switch the service selector in the logs viewer to the "Container Engine" option? It's the dropdown labeled with the number 3 in this screenshot. Container Engine logs won't be shown if it's set to any other service.

If you've already set that properly and aren't seeing any logs, then could you check the logs for the fluentd container and let me know what they have in them? You can either run docker logs <container-id> on the node or kubectl logs <pod-name> --namespace=kube-system.

-- Alex Robinson
Source: StackOverflow