# Loki

## Overview

This section guides you through configuring and running the integration between **Grafana Loki** and **NCP**.

#### By following these steps, you'll enable NCP to:

* Connect to your Loki instance and ingest structured syslog streams
* Parsing and index logs for efficient retrieval and context-aware insights
* Allow users to query logs using natural language through NCP’s chat interface
* Enhance observability and streamline troubleshooting using real-time log analytics

{% hint style="warning" %}
NCP–Loki integration is limited to syslog input only at this time
{% endhint %}

#### Prerequisites

Before beginning, make sure you have:

* **Loki Endpoint URL:** Example: `http://loki.example.com:3100`
* **LogQL Query:** Used to filter logs from specific sources (e.g., `{job="network-agent"}`)
* **Log Limit:** Maximum number of log lines to fetch per query (e.g., `100`, `500`)

### Connect Grafana Loki as a Data Source in NCP

To connect NCP with your Loki instance:<br>

1. Log in to the **NCP GUI**
2. Navigate to **Settings → Data Connectors**, then click **Add Connector**<br>

   <figure><img src="https://content.gitbook.com/content/4CAWWzJyXXOO1e10en45/blobs/4zKfDNNOK0s7Y7YN2ABp/Screenshot%202026-02-10%20at%2010.49.06.png" alt=""><figcaption></figcaption></figure>
3. Select **Loki** from the list of available connectors\
   \
   ![](https://content.gitbook.com/content/4CAWWzJyXXOO1e10en45/blobs/GzjDNczwDZS7ORWDLFxn/Screenshot%202025-07-21%20at%208.59.09%E2%80%AFPM.png)
4. Fill in the required fields:

   * **Name**: A label for the Loki configuration (e.g., `Loki-Cluster`)
   * **Host**: The full URL of your Loki endpoint (e.g., `https://loki.example.com`)
   * **Query**: A LogQL query string (e.g., `{job="network-logs"}`)
   * **LogLimit**: The maximum number of logs to retrieve per query (e.g., `200`)

   <div align="left"><figure><img src="https://content.gitbook.com/content/4CAWWzJyXXOO1e10en45/blobs/ThjlhA4wRRfg2TBmTsoX/Screenshot%202025-07-21%20at%209.00.43%E2%80%AFPM.png" alt="" width="563"><figcaption></figcaption></figure></div>
5. Click **Save** to complete the setup<br>

   <figure><img src="https://content.gitbook.com/content/4CAWWzJyXXOO1e10en45/blobs/tRmCQIh7S7UgFLQfCaSR/Screenshot%202025-07-21%20at%209.00.49%E2%80%AFPM.png" alt=""><figcaption></figcaption></figure>
