1.8 KiB · text History e832e77
# Loki log aggregator — single-node (monolithic) mode, 1 week retention.
#   include = ["include/loki.toml"]
# Listens on :3100 (host network). Retention is enforced by the compactor;
# retention_period=168h == 7 days.

# Ensure the mount point exists. The `:U,Z` volume flags below make podman
# chown the volume to the container's user (uid 10001) *and* relabel it for
# SELinux (container_file_t) at startup — both are required on SELinux hosts.
[[directories]]
path = "/mnt/loki"
mode = "0755"

[[files]]
path = "/etc/loki/config.yml"
mode = "0644"
content = """
auth_enabled: false

server:
  http_listen_port: 3100

common:
  instance_addr: 127.0.0.1
  path_prefix: /loki
  storage:
    filesystem:
      chunks_directory: /loki/chunks
      rules_directory: /loki/rules
  replication_factor: 1
  ring:
    kvstore:
      store: inmemory

schema_config:
  configs:
    - from: 2024-01-01
      store: tsdb
      object_store: filesystem
      schema: v13
      index:
        prefix: index_
        period: 24h

# Single-node retention: keep logs for one week (168h). The compactor must be
# enabled for retention to actually delete old data.
limits_config:
  retention_period: 168h

compactor:
  working_directory: /loki/compactor
  retention_enabled: true
  delete_request_store: filesystem
"""

[[files]]
path = "/etc/containers/systemd/loki.container"
mode = "0644"
content = """
[Unit]
Description=Loki
Requires=network-online.target
After=network-online.target

[Container]
Image=docker.io/grafana/loki:latest
Network=host
Volume=/etc/loki:/etc/loki:ro,Z
Volume=/mnt/loki:/loki:U,Z
Exec=-config.file=/etc/loki/config.yml
AutoUpdate=registry

[Service]
Restart=always
TimeoutStartSec=900

[Install]
WantedBy=multi-user.target
"""

[[services]]
name = "loki.service"
enabled = true
state = "started"