---
title: "Configure Loki settings | Grafana Cloud documentation"
description: "Adjust Loki settings in Grafana Cloud Logs such as retention, OTLP configuration, and line truncation using the Grafana Cloud UI."
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

# Configure Loki settings

Loki offers many settings (also known as *limits*) that can be adjusted for different use cases. In Grafana Cloud Logs, we manage them all for you, and set defaults that work for most of our users. Still there may be some settings you may need to adjust such as [retention](/docs/loki/latest/operations/storage/retention/#configuring-the-retention-period), the [OTLP label mappings](/docs/loki/latest/get-started/labels/#default-labels-for-opentelemetry), or enabling truncation of long log lines that would otherwise be dropped.

You can configure these settings using the Grafana Cloud UI.

> Caution
> 
> Our engineering team manually reviews all requested limits to ensure system stability and performance.
> 
> We aim to approve the requests as soon as possible, but **the review and approval process may take up to 2 business days**.
> 
> In the UI, the current configuration shows a `pending` status while we review the request and `applied` once the request is approved and applied.

## Before you begin

To configure Loki settings using the UI, you need access to a Grafana Cloud stack with permissions to manage database configuration.

### Use the Grafana Cloud UI

To access the Loki configuration UI:

1. In your Grafana Cloud stack, in the main menu, expand **More apps**.
2. Select **Databases Configuration**.
3. Select **Logs**.

The configuration page has three tabs: **Retention**, **OTLP config**, and **Line truncation**. Each tab lets you view your current configuration, submit change requests, and track request status.

When you submit a change request, the request goes through a review process before it takes effect. You can optionally provide a message for reviewers to explain the context of your change. The current configuration panel shows the status of your request:

- **applied**: The requested changes have been reviewed and applied.
- **pending**: The request is awaiting review.
- **rejected**: The request was rejected. Expand the **Reviewer Comments** section to see the reason.

You can also expand the **Submitter’s Note** section to review the message you included with your request.

## Supported settings and restrictions

Here is a list of the limits that can be configured using the UI, along with the restrictions that apply to each.

> Note
> 
> If you need to set any of these settings but the restrictions prevent you from doing it, open a support ticket.

> Note
> 
> Our engineering team may need to override your configured settings. In case your settings are not applied within 2 business days, contact support for assistance.

### Configure retention

By default, Grafana Cloud Logs has a retention of 30 days. You can increase it via the `retention_period` or `retention_stream` limits. If you need to set a retention of something less than 30 days, contact Grafana Support.

- When using the API, you cannot decrease the retention below the currently configured or applied value (or 30 days by default). The UI allows retention reduction with an explicit confirmation step.
- The maximum configurable retention period is 1 year.
- The period must be a multiple of 30 days (for example 60d, 90d, etc.).

> Note
> 
> Note that the minimum charge is for 30 day retention, lowering it below 30 days will not further reduce your costs. Increasing the retention period beyond the minimum 30 days will increase your costs. For more information, refer to [Logs, traces, and profiles invoice](/docs/grafana-cloud/cost-management-and-billing/manage-invoices/understand-your-invoice/logs-invoice/).

You can learn more about retention in the [Log retention documentation](/docs/loki/latest/operations/storage/retention/#configuring-the-retention-period).

#### Configure retention using the UI

1. In your Grafana Cloud stack, in the main menu, expand **More apps**.
2. Select **Databases Configuration**.
3. Select **Logs**.
4. Click the **Retention** tab on the **Database Configuration** page.
5. Use the **Global Retention Period** menu to select the default retention period. Available values range from 1 month to 1 year.
6. Click the **Stream Retentions** button to configure retention periods for specific log streams using label selectors. For each stream retention, set the following fields:
   
   - **Period**: Select a retention period from the dropdown.
   - **Selector**: Enter a label selector to match specific log streams, for example `{env="prod"}`.
   - **Priority**: Set the priority for the retention rule.
7. Click the **Add Stream Retention** button to add additional stream retention rules. Click the trash icon to remove a stream retention rule.
8. Enter your name in the **Author** field and optionally provide a **Message** to explain the context of your change for reviewers.
9. Click **Submit change request** to submit your changes.

> Caution
> 
> The UI allows you to reduce retention below the currently applied value, which is not permitted through the API. When you reduce retention, a confirmation dialog box opens warning that the change may result in data loss. You must type `reduce retention` to confirm the change.

### OTLP label mappings

Grafana Cloud Logs configures a [default set of OpenTelemetry resource labels mapping to stream labels](/docs/loki/latest/get-started/labels/#default-labels-for-opentelemetry). If you need to modify the labels mapping, you can configure them using the UI.

Restrictions:

- You can promote up to 30 resource attributes to stream labels (that is the attributes with `action: index_label`).
- The `severity_text_as_label` field cannot be set to `true`.

> Warning
> 
> Promoting high cardinality labels may negatively affect the performance of Loki and slow down queries. Refer to the documentation for [how to estimate cardinality](/docs/loki/latest/get-started/labels/cardinality/) and [design an effective labeling strategy](/docs/loki/latest/get-started/labels/bp-labels/).

#### Use the UI to map labels

01. In your Grafana Cloud stack, in the main menu, expand **More apps**.
02. Select **Databases Configuration**.
03. Select **Logs**.
04. Click the **OTLP config** tab on the **Database Configuration** page.
05. If you previously configured OTLP settings through the API, the page displays a **Legacy configuration found** banner showing your existing API configuration. Select **Import into form** to migrate these settings into the form so you can manage them through the UI.
06. Switch the **Ignore Defaults** on to ignore default resource attribute mappings.
07. Click **Add Resource Attributes** to configure a new rule for how OpenTelemetry resource attributes are processed. For each rule, configure:
    
    - **Action**: Select **Index Label**, **Structured Metadata**, or **Drop**.
    - **Regex**: Match attributes by a regular expression pattern, or
    - **Attributes**: List specific attribute names. You must specify either a regular expression pattern or a list of attributes, but not both.
08. Click **Scope Attributes** to configure a new rule for how OpenTelemetry scope attributes are processed. For each rule, configure:
    
    - **Action**: Select **Index Label**, **Structured Metadata**, or **Drop**.
    - **Regex**: Match attributes by a regular expression pattern, or
    - **Attributes**: List specific attribute names. You must specify either a regular expression pattern or a list of attributes, but not both.
09. Click **Log Attributes** to configure a new rule for how OpenTelemetry log attributes are processed. For each rule, configure:
    
    - **Action**: Select **Index Label**, **Structured Metadata**, or **Drop**.
    - **Regex**: Match attributes by a regular expression pattern, or
    - **Attributes**: List specific attribute names. You must specify either a regular expression pattern or a list of attributes, but not both.
10. Enter your name in the **Author** field and optionally provide a **Message** for reviewers.
11. Click **Submit change request** to submit your changes.

#### Move mapped resource attributes from indexed labels to structured metadata

In cases where resource attributes that are part of the [default mapping](/docs/loki/latest/get-started/labels/#default-labels-for-opentelemetry) have high cardinality and should not be stored as indexed labels, but as structured metadata instead, you must use both the `drop` stage to remove them from the indexed labels **and** the `structured_metadata` stage to add them as structured metadata.

A common example is the `service.instance.id` resource attribute, which tends to have relatively high cardinality.

In the UI, add two resource attribute rules: one with the **Drop** action and one with the **Structured Metadata** action, both targeting the same attribute.

### Set max line truncation

By default, Grafana Cloud Logs drops all log lines that exceed the maximum log line size, 256KB. You can enable `max_line_size_truncate` ([refer to the limits configuration docs](/docs/loki/latest/configure/#limits_config)) to truncate the lines that exceed the maximum log line size instead of dropping the logs.

#### Use the UI to truncate lines

1. In your Grafana Cloud stack, in the main menu, expand **More apps**.
2. Select **Databases Configuration**.
3. Select **Logs**.
4. Click the **Line truncation** tab on the **Database Configuration** page.
5. If you previously configured line truncation through the API, the page displays a **Legacy configuration found** banner showing your existing API configuration. Select **Import into form** to migrate these settings into the form so you can manage them through the UI.
6. Switch **Enable line truncation** on to truncate log lines exceeding 256KB.
7. Enter your name in the **Author** field and optionally provide a **Message** for reviewers.
8. Click **Submit change request** to submit your changes.
