Grafana: Read log data from STACKIT Logs
Last updated on
Log data stored in a STACKIT Logs instance can be read, queried, and visualized using Grafana. To connect Grafana to your STACKIT Logs instance, you need to configure a Loki data source connection in your Grafana server. This guide walks you through the steps to set up the connection.
Prerequisites
Section titled “Prerequisites”- You have a STACKIT Logs Instance: Create your first STACKIT Logs instance
- You have Instance Access Token with at least Read permission for the STACKIT Logs Instance: Retrieve credentials for STACKIT Logs instance
- Data source URL of the STACKIT Logs Instance: Retrieve API URL STACKIT Logs instance
- You have a Grafana instance running: e.g. Grafana instance with Docker
Configure Loki DataSource in Grafana with authentication
Section titled “Configure Loki DataSource in Grafana with 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 data source.
- Set the name of the source.
- Under Connection, set the URL value taken from “Data source URL” of Logs instance in STACKIT Portal.
- Scroll down and look for HTTP Headers section, click on it.
- Click Add header, which shows 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 is created successfully. You can now use this data source to view the logs in Grafana Explore section