After creating a small, three node cluster with some pods on Google Container Engine I try to view pod logs in Cloud Logging.
I can see the pod logs just fine, but I have no way of separating log entries from pods with the same name in different namespaces.
There is an option to filter logs by Kubernetes namespace, but the list of namespaces is empty, despite the cluster having custom namespaces "prod" and "staging".
See screen shot of log filter drill down. Cloud Logging filter
Has anyone had any success in filtering logs by namespace? If not, are there any other way to separate logs from pods in different namespaces in GCL?
I would like to avoid adding namespace to pod name, as that seems to defeat the purpose of having namespaces in the first place.
The cluster is on Kubernetes version 1.1.1
This appears to be an issue with the log viewer. I'll update this once it's fixed, but in the meantime you should be able to use advanced filters to do what you want.
For example, for namespace "prod" in cluster "cluster-1", you could use the filter:
metadata.serviceName="container.googleapis.com"
metadata.labels."container.googleapis.com/cluster_name"="cluster-1"
metadata.labels."container.googleapis.com/namespace_name"="prod"
edit: The viewer has been fixed so that the workaround shouldn't be necessary, but advanced filters are still pretty great :)