The Google Cloud Logging Data Source is a backend data source plugin for Grafana, which allows users to query and visualize their Google Cloud logs in Grafana.
Download this plugin to the machine Grafana is running on, either using git clone or simply downloading it as a ZIP file. For the purpose of this guide, we'll assume the user "alice" has downloaded it into their local directory "/Users/alice/grafana/". If you are running the Grafana server using a user such as grafana, make sure the user has access to the directory.
You need to enable the resource manager API. Otherwise, your cloud projects will not be displayed in the dropdown menu.
You can follow the steps to enable it:
- Navigate to the cloud resource manager API page in GCP and select your project
- Press the
Enablebutton
- If you don't have gcp project, add a new gcp project. link
- Open the Credentials page in the Google API Console
- Click Create Credentials then click Service account
- On the Create service account page, enter the Service account details
- On the
Create service accountpage, fill in theService account detailsand then clickCreate and Continue - On the
Grant this service account access to projectsection, select theLogs Viewerrole underLoggingto the service account. ClickDone - In the next step, click the service account you just created. Under the
Keystab and selectAdd keyandCreate new key - Choose key type
JSONand clickCreate. A JSON key file will be created and downloaded to your computer
If you want to access logs in multiple cloud projects, you need to ensure the service account has permission to read logs from all of them.
- With Grafana restarted, navigate to
Configuration -> Data sources(or the route/datasources) - Click "Add data source"
- Select "Google Cloud Logging"
- Provide credentials in a JWT file, either by using the file selector or pasting the contents of the file.
- If desired, provide a regional Cloud Logging service endpoint in order to only collect logs from a specific log bucket region
- Click "Save & test" to test that logs can be queried from Cloud Logging.
Cloud Logging Logo (src/img/logo.svg) is from Google Cloud's Official icons and sample diagrams
As commented, JWTForm and JWTConfigEditor are largely based on Apache-2.0 licensed grafana-google-sdk-react

