> ## 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 allows Traversal to query and analyze logs from your Grafana Loki instance during incident 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

<Tabs>
  <Tab title="Direct connection (recommended)">
    Use this if your Loki instance is publicly accessible and you want to connect to it independently of Grafana.

    <Steps>
      <Step title="Find your Loki URL">
        Use your Loki server's base URL, e.g. `https://loki.yourcompany.com`.

        <Warning>
          If your Loki URL is a cluster-internal address (e.g. a Kubernetes service URL), it will not be reachable from Traversal. Use the Grafana proxy path instead.
        </Warning>
      </Step>

      <Step title="Configure authentication (if required)">
        If your Loki instance requires authentication, provide an API token. Leave blank if your instance is unauthenticated.
      </Step>

      <Step title="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.
      </Step>

      <Step title="Configure in Traversal">
        Go to **Company Knowledge → Integrations**, select **Loki**, and enter:

        * Loki URL
        * API token (optional)
        * Organization ID (optional, for multi-tenant deployments only)
      </Step>
    </Steps>
  </Tab>

  <Tab title="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 (e.g. within a cluster).

    No additional setup is needed beyond the [Grafana integration](/integrations/grafana). 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 do not need to provide an org ID in Traversal.
    </Note>
  </Tab>
</Tabs>

## 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/)
