Loki mkdir : no such file or directory

docker-compose.yaml context

  init-loki:
    profiles:
      - init
    image: ubuntu
    user: root
    # command: chown -R 10001:10001 /data/loki
    command: chown -R 1031:100 /data/loki #
    volumes:
      - ./loki/data:/data/loki

  loki:
    image: grafana/loki:2.9.3
    restart: unless-stopped
    user: 1031:100
    environment:
      - TC=UTC
    volumes:
      # - /etc/timezone:/etc/timezone:ro
      # - /etc/localtime:/etc/localtime:ro
      - ./loki/loki.yaml:/etc/loki/loki.yaml:ro
      - ./loki/data:/data/loki
    command:
      - --config.file=/etc/loki/loki.yaml
      - --log.level=debug
      # - --config.expand-env=true
    ports:
      - 3100:3100
      - 9096:9096
      - 7946:7946

loki.yaml

analytics:
 reporting_enabled: false

auth_enabled: false

server:
  http_listen_port: 3100

ingester:
  wal:
    enabled: false
#   lifecycler:
#     address: nas.lan
#     ring:
#       kvstore:
#         store: inmemory
#       replication_factor: 1

# query_range:
#   results_cache:
#     cache:
#       embedded_cache:
#         enabled: true
#         max_size_mb: 100

schema_config:
  configs:
    - from: 2023-01-01
      store: tsdb
      # store: boltdb
      object_store: filesystem
      schema: v12
      index:
        prefix: index_
        period: 24h

storage_config:
  filesystem:
    directory: /data/loki/filesystem
  tsdb_shipper:
    active_index_directory: /data/loki/tsdb-index
    cache_location: /data/loki/tsdb-cache
    # shared_store: filesystem
loki_1             | mkdir : no such file or directory
loki_1             | error initialising module: compactor
loki_1             | github.com/grafana/dskit/modules.(*Manager).initModule
loki_1             | 	/src/loki/vendor/github.com/grafana/dskit/modules/modules.go:138
loki_1             | github.com/grafana/dskit/modules.(*Manager).InitModuleServices
loki_1             | 	/src/loki/vendor/github.com/grafana/dskit/modules/modules.go:108
loki_1             | github.com/grafana/loki/pkg/loki.(*Loki).Run
loki_1             | 	/src/loki/pkg/loki/loki.go:461
loki_1             | main.main
loki_1             | 	/src/loki/cmd/loki/main.go:110
loki_1             | runtime.main
loki_1             | 	/usr/local/go/src/runtime/proc.go:267
loki_1             | runtime.goexit
loki_1             | 	/usr/local/go/src/runtime/asm_amd64.s:1650

No info what directory. I have tried multiple variants, but it doesn’t work.

How to fix this? Error message is not helpful.

How to make the right config config for NAS Synology? This imply data are already mirrored and also I don’t care about losing logs, because of hardware failure.

I have not setup Loki on Synology but when I installed Docker, I had to use the /volume1 directory as my root folder, so /data probably won’t work. if you long into DSM and go to the filestation, and create a data folder, it will be /volume1/data not /data.

Hope this helps!

Sorry for misleading. I added docker-compose.yaml context. This is not about /data/.

Any hints? I stuck on this.

Am seeing the same problem after upgrading my deployment on Kubernetes with the loki-distributed helm chart to 0.78.1. Everything but the compactor pod seems to be working fine. Was running the loki-distributed helm chart version 0.76.1 before this.

I was able to get things working again by adding this to the config:

compactor:
  working_directory: /var/loki/compactor
2 Likes