GoogleCloudPlatform / cloud-logging-data-source-plugin

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

Ability to set projectId on the dataSource #43

Open Stono opened 1 year ago

Stono commented 1 year ago

Hi, It'd be great if i could select the projectId on the datasource during provisioning. For context; we run a grafana instance per environment, each environment for us (eg testing, dev, preprod, prod, bcp) is also a separate GCP project.

Ta

xiangshen-dk commented 1 year ago

You should be able to use the plugin config file to specify the default project.

Below is an example:

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
      authenticationType: jwt
      defaultProject: shenxiang-gcp-solution
      ClientEmail: "grafana-test@shenxiang-gcp-solution.iam.gserviceaccount.com"
    secureJsonData:
      privateKey: "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADA.........X+q2g=\n-----END PRIVATE KEY-----\n"