1

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

GamerAtmos
  • 119
  • 1
  • 7
  • Where are you running your container? – guillaume blaquiere Sep 09 '20 at 19:40
  • I hope documentation [1] could be helpful for you from where we are getting step by step procedures: [1] https://cloud.google.com/community/tutorials/docker-gcplogs-driver – Shafiq I Sep 09 '20 at 21:05
  • @guillaumeblaquiere running the container in COS – GamerAtmos Sep 10 '20 at 03:44
  • @ShafiqI I tried with this documentation. It gives me this error : `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.` – GamerAtmos Sep 10 '20 at 03:46
  • Can you share the configuration of your COS VM? perform a `gcloud compute instances describe --zone=yourZone instanceName` – guillaume blaquiere Sep 10 '20 at 07:56
  • 1
    @GamerAtmos: We need to have listed access scopes [1] in VM levels: [1] https://cloud.google.com/logging/docs/access-control#scopes – Shafiq I Sep 12 '20 at 14:59
  • @ShafiqI Thanks! This solved the problem for me. If you locked down the default GCE service account like me, you'll need to explicitly add the "Logs Writer" role. – kennysong Jul 25 '21 at 14:36

0 Answers0