Loki Promtail Configuration - Log Aggregation Setup

Configure Loki Promtail for efficient log aggregation. Explore settings for server, ingester, storage, and ruler for robust log management.

Loki Promtail Configuration

This document outlines a typical configuration for Loki Promtail, a log collection agent for Loki. Proper configuration is crucial for efficient log aggregation and management within your infrastructure. Below is a detailed breakdown of key settings.

Promtail Server Configuration

The server section defines how Promtail listens for incoming data and its operational parameters. Key settings include the HTTP listen port.

Ingester Settings for Log Processing

The ingester configuration dictates how Promtail processes and prepares logs before sending them to Loki. This includes settings for chunking, retention, and retry mechanisms.

Storage and Schema Configuration

This section details how logs are stored and indexed. It covers the use of boltdb for indexing and filesystem for chunk storage, along with schema versioning and index periods.

Ruler and Alerting Setup

The ruler configuration enables Promtail to fetch and apply alerting rules. It specifies the rule storage location, alertmanager URL, and API enablement.

External Resources for Loki and Promtail

auth_enabled: false

server:
  http_listen_port: 3100

ingester:
  lifecycler:
    address: 127.0.0.1
    ring:
      kvstore:
        store: inmemory
      replication_factor: 1
    final_sleep: 0s
  chunk_idle_period: 5m
  chunk_retain_period: 30s
  max_transfer_retries: 0

schema_config:
  configs:
    - from: 2018-04-15
      store: boltdb
      object_store: filesystem
      schema: v11
      index:
        prefix: index_
        period: 168h

storage_config:
  boltdb:
    directory: /tmp/loki/index

  filesystem:
    directory: /tmp/loki/chunks

limits_config:
  enforce_metric_name: false
  reject_old_samples: true
  reject_old_samples_max_age: 168h

chunk_store_config:
  #max_look_back_period: 0s
  max_look_back_period: 168h

table_manager:
  retention_deletes_enabled: true
  #retention_period: 0s
  retention_period: 168h
  
ruler:
  storage:
    type: local
    local:
      directory: /etc/loki/rules
  rule_path: /tmp/loki/rules-temp
  alertmanager_url: http://alertmanager:9090
  ring:
    kvstore:
      store: inmemory
  enable_api: true