gcloud: How to get specific field from pod log in Stackdriver?

10/23/2019

How can I get specific field of some log message using gcloud? I am currently using this command:

gcloud logging read "logName=projects/some_project/logs/stdout AND resource.type:k8s_container and resource.labels.cluster_name=testing AND resource.labels.namespace_name=test" --limit 10 --format json

I'm guessing this should be something related to SELECT (as read in gcloud's standard sql guide for bigquery: https://cloud.google.com/bigquery/docs/reference/standard-sql/query-syntax)

-- Mika R
gcloud
google-bigquery
google-kubernetes-engine

1 Answer

10/23/2019

OK so this seems to do the trick: --format="value(textPayload)"

-- Mika R
Source: StackOverflow