apiVersion: v1
kind: Secret
metadata:
  name: loki
stringData:
  loki.yaml: |-
    auth_enabled: false

    chunk_store_config:
      # 'max_look_back_period' must be less then or equal to 'table_manager.retention_period'
      # 'max_look_back_period' = ( 24h * 30d ) 720h
      max_look_back_period: 720h
    
    compactor:
      shared_store: filesystem
      working_directory: /data/loki/index/boltdb-shipper-compactor
    
    ingester:
      chunk_block_size: 262144
      # 'chunk_idle_period' default 30m
      chunk_idle_period: 30m
      # 'chunk_retain_period' default 15m
      chunk_retain_period: 15m
      chunk_target_size: 1536000
      lifecycler:
        ring:
          kvstore:
            store: inmemory
          replication_factor: 1
      # 'max_chunk_age' default 1h
      max_chunk_age: 1h
      max_transfer_retries: 0
      # WARN: WAL is available only in 'latest 6.1.2021' container image
      wal:
        enabled: true # default false
        dir: /data/loki/wal
        flush_on_shutdown: true # default false
        checkpoint_duration: 5m # default 5m
        # replay_memory_ceiling: 4G # default 4GB

    limits_config:
      enforce_metric_name: false
      reject_old_samples: true
      # 'reject_old_samples_max_age' = 168h = 7d
      reject_old_samples_max_age: 168h
    
    schema_config:
      configs:
      - from: "2021-01-06"
        # chunks:
        #   # 'period' = 168h = 7d (default 168h)
        #   period: 168h
        index:
          # 'period' must be multiples of 24h
          # INFO: boltdb-shipper works best with 'period' = 24h 
          # 'period' = 168h = 7d (default 168h)
          period: 24h
          prefix: index_
        # chunk store (If omitted, defaults to the same value as 'store')
        object_store: filesystem
        schema: v11
        # index store
        store: boltdb-shipper
    
    server:
      http_listen_port: 3100
    
    storage_config:
      boltdb_shipper:
        active_index_directory: /data/loki/index/boltdb-shipper-active
        cache_location: /data/loki/index/boltdb-shipper-cache
        cache_ttl: 24h
        shared_store: filesystem
      filesystem:
        directory: /data/loki/chunks
    
    table_manager:
      retention_deletes_enabled: true
      # 'retention_period' must be a multiple of the index and chunks table period, configured in the 'period_config' (schema_config.configs[0]) block
      # 'retention_period' = ( 24h * 31d ) 744h
      retention_period: 744h
