> ## Documentation Index
> Fetch the complete documentation index at: https://docs.traversal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Loki

> Connect Grafana Loki to query and analyze logs during investigations.

Connecting Loki lets Traversal query logs from your Grafana Loki instance during investigations.

## What Traversal reads

* **Logs**: queried via LogQL against your log streams
* **Labels**: stream label names and values used to scope queries to the right services

## Setup

> [tab] Direct connection (recommended)
>
> Use this if Traversal or a Traversal Connector can reach your Loki instance directly and you want to connect to it independently of Grafana.
>
> **1. Find your Loki URL**
>
> Use your Loki server's base URL, for example, `https://loki.yourcompany.com`.
>
> For a private or cluster-internal address, see [Private network access](#private-network-access). You can also use the Via Grafana option.
>
> **2. Configure authentication (if required)**
>
> If your Loki instance requires authentication, provide an API token. Leave blank if your instance is unauthenticated.
>
> **3. Note your org ID (multi-tenant only)**
>
> If your Loki deployment uses multi-tenancy, find your tenant/org ID. Traversal sends it as the `X-Scope-OrgID` header on every request.
>
> **4. Configure in Traversal**
>
> Go to **Integrations**, select **Loki**, and enter:
>
> * Loki URL
> * API token (optional)
> * Organization ID (optional, for multi-tenant deployments only)

> [tab] Via Grafana
>
> If Loki is configured as a datasource in your Grafana instance, Traversal can reach it through the Grafana datasource proxy. This is useful when Loki is only accessible internally (for example, within a cluster).
>
> No additional setup is needed beyond the [Grafana integration](https://docs.traversal.com/integrations/grafana.md). Traversal auto-discovers Loki and queries it using the same Grafana service account token.
>
> > [!NOTE]
> >
> > Multi-tenancy is handled automatically by Grafana when going through this path. You don't need to provide an org ID in Traversal.

## Private network access

If the service endpoint isn't directly reachable by Traversal (as is common with self-hosted services), deploy a [Traversal Connector](https://docs.traversal.com/architecture/connector.md) in a network that can reach it. When configuring the integration, select that connector under **Network Access Needed**. The service endpoint doesn't need public internet exposure.

See [Set up the Traversal Connector](https://docs.traversal.com/setup/connector.md) for deployment and network requirements.

## More information

* [Loki HTTP API](https://grafana.com/docs/loki/latest/reference/loki-http-api/)
* [Loki multi-tenancy](https://grafana.com/docs/loki/latest/operations/multi-tenancy/)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.