Logs instance as data source in Grafana
Prerequisites
Section titled “Prerequisites”- You have a STACKIT Logs Instance: Create your first STACKIT Logs instance
- You have credentials with read permission for the STACKIT Logs Instance: Retrieve credentials for STACKIT Logs instance
- You have a Grafana instance running: e.g. Grafana instance with Docker
Configure Loki DataSource in Grafana
Section titled “Configure Loki DataSource in Grafana”To connect Grafana to Logs instance, you need to create a new Loki data source connection in Grafana server. This guide shows the steps to perform for making the connection.
Get Loki URL from STACKIT portal
Section titled “Get Loki URL from STACKIT portal”- Visit the STACKIT Portal.
- On the sidebar click on Logs.
- Select the Logs instance you want to connect.
- On the sidebar click on API.
- Under Info copy/note the URL from Data source.
- Then the value of token under Access tokens with read permissions.
Create Loki Data source and authentication
Section titled “Create Loki Data source and authentication”- Visit the Grafana server with Admin access.
- On the sidebar click on Connections.
- Then under Connections, click Data sources.
- Click Add new data source.
- Select Loki from the list to create a new source.
- Set the name of the source.
- Under Connection, set the URL value taken from Logs instance in STACKIT Portal.
- Scroll down and look for HTTP Headers section, click on it.
- Click Add header, it will show two text fields.
- In Header field write Authorization.
- In Value field for Authorization header, put the value as
Bearer <Token value from Logs instance Access Token>. For exampleBearer eyJhbGc.... - Scroll down and click Save & Test.
If everything is configured correctly in the data source, the data source will be created successfully. You can now use this data source to view the logs in Grafana Explore section