Closed
Description
I have a web api deployed with docker image on GCP GCE. However failed to output any log to stackdriver logging under the tag which my VM stands for.
Most importantly, the same api deployed in my dev env (IDC) can sent log to GCP stackdriver logging successfully, which can be seen in stackdriver logging under the tag 'global'. Of course, with GOOGLE_APPLICATION_CREDENTIALS included.
Environment details
- Python 3.6.7
- ubuntu 18.04
- Cloud API access scopes: Allow full access to all Cloud APIs
- google related module
google-api-core==1.9.0
google-auth==1.6.3
google-cloud-core==0.29.1
google-cloud-logging==1.10.0
googleapis-common-protos==1.5.9
- the service account creating this VM has the role Logs Writer added.
Steps to reproduce
- deploy api with docker-compose within that GCE
Code example
- this is how i prepare my cloud handler
client = google.cloud.logging.Client()
cloud_handler = CloudLoggingHandler(client, name='cloud')
logging.getLogger('cc').addHandler(cloud_handler)
Really appreciate any support. Let me know if further info are needed.