GoogleCloudPlatform / cloud-logging-data-source-plugin

https://grafana.com/grafana/plugins/googlecloud-logging-datasource/
Apache License 2.0
17 stars 12 forks source link

Support local gcloud default credentials #44

Open Stono opened 1 year ago

Stono commented 1 year ago

I'm struggling to run grafana locally and use this data source. Ideally i'd like it to use my gcloud auth default credentials. The two configuration options at the moment look to be json (which i want to avoid) and gce (which isn't relevant locally).

It'd be great if this just transparently worked, like gcloud client libraries.

xiangshen-dk commented 11 months ago

You can try to specify the auth type as gce in the configuration file. As you can see in the code, for gce auth the plugin uses application default credentials with client library.

Below is an example of the config file:

sudo cat /etc/grafana/provisioning/datasources/logging.yaml

# # config file version
apiVersion: 1

datasources:
  - name: Google Cloud Logging
    type: googlecloud-logging-datasource
    access: proxy
    editable: true
    jsonData:
      authenticationType: gce
      gceDefaultProject: shenxiang-gcp-solutions-test1