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

# Loki

> Connect Grafana Loki to give ewake access to your log aggregation for real-time log analysis.

<Info>
  **What you'll get:** ewake can query your Loki instance to retrieve logs from any service, correlate log patterns with alerts, and surface relevant log lines during investigations, without requiring manual LogQL queries.
</Info>

***

## Prerequisites

* A Loki instance (Grafana Cloud or self-hosted)
* Your Loki endpoint URL
* An API key or bearer token if your instance requires authentication

***

## Configuration

<Steps>
  <Step title="Get your Loki endpoint URL">
    **Grafana Cloud:** Go to your Grafana Cloud portal → **My Account** → **Grafana Cloud Stack** → **Loki details**. Copy the URL under **Loki Logs URL**.

    **Self-hosted:** Your Loki URL follows the format `http://loki.your-domain.com:3100`.
  </Step>

  <Step title="Generate an API key (Grafana Cloud)">
    In Grafana Cloud, go to **My Account** → **Access Policies** → **Create access policy**.

    Grant it `logs:read` scope, then generate a token and copy it immediately.

    <Note>
      For self-hosted Loki with no authentication, leave the API Key field empty.
    </Note>
  </Step>

  <Step title="Open the Loki integration in ewake">
    In your ewake dashboard, go to **Integrations** → **Loki** → click **Configure**.

    <img src="https://mintcdn.com/ewakeai/M1QmRrA-jDM2VkcE/images/integrations/observability/loki/connect-modal.png?fit=max&auto=format&n=M1QmRrA-jDM2VkcE&q=85&s=79424d073f73b8c4263998f3247e46f2" alt="Connect to Loki modal in ewake" style={{ maxHeight: "320px", objectFit: "cover", objectPosition: "top", borderRadius: "8px" }} width="931" height="342" data-path="images/integrations/observability/loki/connect-modal.png" />
  </Step>

  <Step title="Enter your credentials">
    | Field             | Value                                        |
    | ----------------- | -------------------------------------------- |
    | **Loki Base URL** | Your Loki endpoint URL                       |
    | **API Key**       | Your token (leave empty if no auth required) |
  </Step>

  <Step title="Test and save">
    Click **Test Configuration** to verify the connection, then click **Save**.

    <Check>
      Loki is connected. Ewake can now query your logs during investigations.
    </Check>
  </Step>
</Steps>

***

<Note>
  Ewake queries logs in **read-only** mode using LogQL. It never writes to or modifies your Loki instance.
</Note>
