Grafana — Logs
Connect Grafana to xScaler as a Loki-compatible data source to explore and visualise your logs using LogQL.
Works with Grafana 9+ — both self-hosted and Grafana Cloud.
Step 1 — Add a Loki data source
- In Grafana, navigate to Connections → Data Sources.
- Click Add new data source.
- Select Loki.
Step 2 — Set the server URL
In the URL field, enter:
https://euw1-01.l.xscalerlabs.com
Use the host root only — Grafana appends query paths automatically. Do not add any path suffix.
Step 3 — Add authentication headers
Scroll down to the HTTP Headers section and add two custom headers:
| Header Name | Header Value |
|---|---|
Authorization | Bearer <token> |
X-Scope-OrgID | <tenant-id> |
:::danger Do not use Basic Auth or the Authentication section
xScaler uses token-based authentication via the Authorization: Bearer header. Do not fill in the Basic Auth username/password fields — use custom HTTP headers only as shown above.
:::
Step 4 — Save & Test
Click Save & Test. A successful connection displays:
Data source connected and labels found.
If you see an error, verify:
- The URL is
https://euw1-01.l.xscalerlabs.com(no path suffix) Authorizationvalue is exactlyBearer <token>(capital B, space before token)X-Scope-OrgIDvalue matches your tenant ID
Exploring logs in Grafana
Browse by label
- Open Explore and select the Logs data source.
- Use the Label browser to pick a
joborservicelabel. - Grafana generates the stream selector automatically:
{job="app"}.
Filter and search
# Lines containing a string
{job="app"} |= "error"
# Parse JSON and filter on a field
{job="api"} | json | status >= 500
# Parse logfmt
{job="worker"} | logfmt | level="error"
# Regex match
{job="app"} |~ "timeout|refused"
Log volume panel
Add a Logs panel or a Time series panel with a metric query to visualise log volume over time:
# Log lines per second by job
sum by (job) (rate({job=~".+"}[5m]))
# Error rate
sum by (service) (rate({job="app"} |= "error" [5m]))
Live tail
In Explore, enable the Live toggle to stream new log lines in real time as they are ingested.
Correlating logs and metrics
With both the Prometheus (metrics) and Loki (logs) data sources configured, you can use Grafana Correlations to jump from a metric spike directly to the related log lines.
- Navigate to Administration → Correlations.
- Create a correlation from the Prometheus data source to the Loki data source.
- Set the target query to
{job="${job}"}and map thejoblabel from the metric series.
Troubleshooting
"Bad Gateway" on Save & Test
- Verify the URL is
https://euw1-01.l.xscalerlabs.com(HTTPS, host root only — no path suffix). - Check both
AuthorizationandX-Scope-OrgIDare in the HTTP Headers section.
"Data source connected" but no labels
- No logs have been ingested yet for this tenant. Send some logs first using Grafana Alloy or the OTel Collector.
- Check the time range — the label browser only shows labels active within the selected window.
"Forbidden" error
- Your token may be
write-scoped. Generate areadorread+writetoken from the xScaler portal.
"X-Scope-OrgID" error in query
- The
X-Scope-OrgIDheader must be set in the data source HTTP Headers, not in the query itself.