apiVersion: v1
kind: ConfigMap
metadata:
  name: loki-config
  namespace: metrics
  annotations:
    use-subpath: "true"
  labels:
    app.kubernetes.io/name: loki
data:
  config.yaml: |
    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

    limits_config:
      allow_structured_metadata: true
      retention_period: 90d
      otlp_config:
        resource_attributes:
          attributes_config:
            - action: index_label
              attributes:
                - component
                - function
                - endpoint

    query_range:
      results_cache:
        cache:
          embedded_cache:
            enabled: true

    compactor:
      working_directory: /loki/compactor
      compaction_interval: 10m
      retention_enabled: true
      retention_delete_delay: 2h
      retention_delete_worker_count: 150
      delete_request_store: filesystem

    schema_config:
      configs:
        - from: 2020-10-24
          store: boltdb-shipper
          object_store: filesystem
          schema: v13
          index:
            prefix: index_
            period: 24h
        - from: 2024-04-12
          object_store: filesystem
          store: tsdb
          schema: v13
          index:
            prefix: index_
            period: 24h

    ruler:
      alertmanager_url: http://localhost:9093