I'm running a Docker container on a GCE instance under the Container-optimizes OS. I've followed this manual https://cloud.google.com/container-optimized-os/docs/how-to/logging and added the google-logging-enabled
metadata value to enable sending containers' logs to Cloud Logging:
But it doesn't work. I can't see containers' logs in the Cloud Logging:
While I have a lot of container logs in reality:
How to make it working and really send containers' logs to Cloud Logging?
Update
The log filter is the default one: (resource.type="gce_instance" AND resource.labels.instance_id="***") OR (resource.type="global" AND jsonPayload.instance.id="***")
that means that all types of logs from the current instance should be shown.
My issue was that my service account associated with the instance had no the
Logs Writer
permission. I found that by running thesudo systemctl status stackdriver-logging
command which shown the following:By googling the error message I found the answer in the GitHub issue https://github.com/GoogleCloudPlatform/fluent-plugin-google-cloud/issues/295
The following answer also helped me to diagnose the problem: https://stackoverflow.com/a/65768214/8016720
Now I have all the logs I want in Cloud Logging.