Send logs to Google Logs Viewer

510 views
Skip to first unread message

Athreya N Patel

unread,
Sep 9, 2020, 9:22:55 AM9/9/20
to gce-discussion
To do: Send logs to Google Logs Viewer from docker container.

Faced Error I followed this article: https://docs.docker.com/config/containers/logging/gcplogs/ and executed docker run --log-driver=gcplogs nginx

docker: Error response from daemon: failed to initialize logging driver: unable to connect or authenticate with Google Cloud Logging: rpc error: code = PermissionDenied desc = The caller does not have permission.

OS: Container Optimized OS cos-81-12871-1196-0

I also tried this The Google Cloud Logging driver for Docker with service account with log.admin and log.writer role

How do I send the logs to Stackdriver/Google Cloud Logging?

Digil (Google Cloud Platform Support)

unread,
Sep 14, 2020, 11:26:40 AM9/14/20
to gce-discussion
Kindly note that gcplogs is a tool provided by a third-party and therefore not officially endorsed or supported by Google Cloud Platform. However, by looking at the error report, it seems like a permission issue is causing the issue. 

Since you installed the agent in a Google Compute Engine VM(please correct me if I am wrong), you need verify the access scope (I believe you already did) and default service account permission attached with the GCE VM. As explained in the 'Troubleshooting the Agent' article, it is highly possible that the service account is not possessing the right permission(or role) and thereby hindering the agent to push the logs towards Cloud Logging(Logs Viewer). If the issue didn't resolve even after updating the service account with adequate roles as mentioned here, you need to consider raising this issue with docker community for further assistance.

In the meantime, have you consider installing the Cloud Logging agent  and then use the "fluentd" Docker log driver to report the logs? It is a supported solution. You may refer this help center article for installing the Cloud Logging agent on a GCE VM. See if that helps you.


Reply all
Reply to author
Forward
0 new messages