1

I'm tryig to configure Loki on separate VM with S3 (minIO) as a object store, using docker-composer.

The minIO/s3 bucket is public and addiotionaly I have added r/w permission to it.

There are no errors in logs.

The file loki_cluster_seed.json successfully created, but no index/chunks dirs

Loki version 2.8.2

Can someone help me to find out the issue?

My configuration.

docker-compose:

---
version: "3"

networks:
  loki:

services:
  read:
    image: grafana/loki:2.8.2
    command: "-config.file=/etc/loki/config.yaml -target=read -config.expand-env=true -print-config-stderr log-config-reverse-order"
    ports:
      - 3101:3100
      - 7946
      - 9095
    volumes:
      - ./loki-config.yaml:/etc/loki/config.yaml
    healthcheck:
      test: [ "CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:3100/ready || exit 1" ]
      interval: 10s
      timeout: 5s
      retries: 5
    networks: &loki-dns
      loki:
        aliases:
          - loki

  write:
    image: grafana/loki:2.8.2
    command: "-config.file=/etc/loki/config.yaml -target=write -config.expand-env=true -print-config-stderr log-config-reverse-order"
    ports:
      - 3102:3100
      - 7946
      - 9095
    volumes:
      - ./loki-config.yaml:/etc/loki/config.yaml
    #volumes:
    #  - ${PWD}/loki-config.yaml:/etc/loki/config.yaml
    healthcheck:
      test: [ "CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:3100/ready || exit 1" ]
      interval: 10s
      timeout: 5s
      retries: 5
    # depends_on:
    #   - minio
    networks:
      <<: *loki-dns

  gateway:
    image: nginx:latest
    depends_on:
      - read
      - write
    entrypoint:
      - sh
      - -euc
      - |
        cat <<EOF > /etc/nginx/nginx.conf
        user  nginx;
        worker_processes  5;  ## Default: 1

        events {
          worker_connections   1000;
        }

        http {
          resolver 127.0.0.11;

          server {
            listen             3100;

            location = / {
              return 200 'OK';
              auth_basic off;
            }

            location = /api/prom/push {
              proxy_pass       http://write:3100\$$request_uri;
            }

            location = /api/prom/tail {
              proxy_pass       http://read:3100\$$request_uri;
              proxy_set_header Upgrade \$$http_upgrade;
              proxy_set_header Connection "upgrade";
            }

            location ~ /api/prom/.* {
              proxy_pass       http://read:3100\$$request_uri;
            }

            location = /loki/api/v1/push {
              proxy_pass       http://write:3100\$$request_uri;
            }

            location = /loki/api/v1/tail {
              proxy_pass       http://read:3100\$$request_uri;
              proxy_set_header Upgrade \$$http_upgrade;
              proxy_set_header Connection "upgrade";
            }

            location ~ /loki/api/.* {
              proxy_pass       http://read:3100\$$request_uri;
            }
          }
        }
        EOF
        /docker-entrypoint.sh nginx -g "daemon off;"
    ports:
      - "3100:3100"
    healthcheck:
      test: ["CMD", "service", "nginx", "status"]
      interval: 10s
      timeout: 5s
      retries: 5
    networks:
      - loki

My loki-config.yaml

auth_enabled: false

server:
  http_listen_port: 3100
  grpc_listen_port: 9096

common:
  path_prefix: /tmp/loki
  replication_factor: 1
  ring:
    kvstore:
      store: inmemory

query_range:
  results_cache:
    cache:
      embedded_cache:
        enabled: true
        max_size_mb: 100
compactor:
  working_directory: /loki/boltdb-shipper-compactor
  shared_store: aws
schema_config:
  configs:
    - from: "2023-03-20"
      index:
        period: 24h
        prefix: index_
      object_store: s3
      schema: v12
      store: boltdb-shipper
storage_config:
  aws:
    bucketnames: lokidoki
    endpoint: http://s3.minio.local:9000
    insecure: true
    sse_encryption: false
    s3: s3://key:secret_key@http://s3.minio.local.:9000/lokidoki
    region: null
    s3forcepathstyle: true
    access_key_id: key
    secret_access_key: secret_key
    http_config:
      idle_conn_timeout: 5m
      response_header_timeout: 0s
      insecure_skip_verify: true
  boltdb_shipper:
    active_index_directory: /loki/index
    cache_location: /loki/cache
    shared_store_key_prefix: loki-index/
    resync_interval: 5s
    shared_store: s3
  hedging:
    at: 250ms
    max_per_second: 20
    up_to: 3

ingester:
  lifecycler:
    address: 0.0.0.0
    join_after: "60s"
    observe_period: "5s"
    ring:
      replication_factor: 1
      kvstore:
        store: inmemory
    final_sleep: "0s"
  max_chunk_age: "240h"

ruler:
  storage:
    s3:
      bucketnames: lokidoki

# If you would like to disable reporting, uncomment the following lines:
#analytics:
#  reporting_enabled: false

I have tried differet configuration options, but no luck...

Thanks in advance!

Save Loki objects on S3 Bucket

easleyfixed
  • 219
  • 1
  • 13
Serge
  • 21
  • 4

0 Answers0