Google Certified Associate Cloud Engineer 2020

Sign Up Free or Log In to participate!

how to read logs using gcloud command from CLI

How to read logs using gcloud command from CLI? It’s advanced challenge. 
I tried next command 
gcloud logging read "resource.type=gce_instance and resource.labels.instance_id=3427236251988272773" –limit 100 –format text
with various format type, but didn’t get success.

3 Answers

I would try the format:  "gcloud logging read "resource.type=cloud_run_revision AND resource.labels.service_name=SERVICE" –project PROJECT-ID –limit 10". For details, see: https://cloud.google.com/run/docs/logging

we can also use "gsutil cat" command, like this:

gsutil cat gs://challengelabvm01-bucket/machine-challengelabvm01-finished.txt

Thanks for sharing this information.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?