Configuring Grafana Datasource for Logz.io Metrics
Request Metric API Endpoint Enablement
To enable Metric API access for your accounts, contact your account manager or the Logz.io support team with your Metric Account ID.
Create API Token for the Metrics Account
Create an API Token:
Generate an API token from your Main Log Management account or Log Management sub-account. You will need this token as theX-API-TOKEN
header in the next step.Generate a Metric Account Token:
Use the Create a sub-account API token endpoint to generate a new token for the metrics account. Include the Metrics Account ID in the request body.
Configure Logz.io Metric Endpoint as a Local Grafana Datasource
To configure the Logz.io metric endpoint as a Prometheus datasource in your Grafana instance:
Navigate to Data Source Configuration:
Add a new datasource of type Prometheus.Configure the Datasource:
- URL: Set the URL to
https://api.logz.io/v1/metrics/prometheus
(adjust according to your region). - Access: Select Server (default) as the access type.
- Custom Headers: Add a custom header named
X-API-TOKEN
and set its value to the Metric Account API token generated in the previous step.
- URL: Set the URL to
Query and Create Dashboards
Once the datasource is configured, you can start creating queries and dashboards.
To use the Prometheus Query API, utilize the endpoints (according to your region) provided under {LOGZIO_API_URL}/v1/metrics/prometheus
. The supported query APIs are:
Instant Queries:
Supports both GET and POST requests to{LOGZIO_API_URL}/v1/metrics/prometheus/api/v1/query
.Range Queries:
Supports both GET and POST requests to{LOGZIO_API_URL}/v1/metrics/prometheus/api/v1/query_range
.Series Queries:
Supports both GET and POST requests to{LOGZIO_API_URL}/v1/metrics/prometheus/api/v1/series
.Getting Label Names:
Supports both GET and POST requests to{LOGZIO_API_URL}/v1/metrics/prometheus/api/v1/labels
.Getting Label Values:
Supports GET requests to{LOGZIO_API_URL}/v1/metrics/prometheus/api/v1/label/<label_name>/values
.