Why is "rules-temp" directory accessed?

Hi, I’m using loki 2.6.1 on a single standalone node, with a config based closely on cmd/loki/loki-local-config.yaml. Here it is in full:

auth_enabled: false

server:
  http_listen_port: 3100
  grpc_listen_port: 9096

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

schema_config:
  configs:
    - from: 2020-10-24
      store: boltdb-shipper
      object_store: filesystem
      schema: v11
      index:
        prefix: index_
        period: 24h

ruler:
  alertmanager_url: http://localhost:9093/alertmanager

compactor:
  retention_enabled: true

limits_config:
  retention_period: 91d
  enforce_metric_name: false
  reject_old_samples: true
  reject_old_samples_max_age: 168h

analytics:
  reporting_enabled: false

When loki starts, it logs the following message:

Oct 11 18:39:55 srv1 loki-linux-amd64[26215]: level=error ts=2022-10-11T18:39:55.887270979Z caller=mapper.go:50 msg="unable to read rules directory" path=/var/lib/loki/rules-temp err="open /var/lib/loki/rules-temp: no such file or directory"

My question is: why is it even trying to access /var/lib/loki/rules-temp, when the config points to /var/lib/loki/rules?

If I start with an empty /var/log/loki directory, then various subdirectories are created automatically under there, including “rules”, but not “rules-temp”.

Looking at the documentation for the “ruler” block, it seems there are at least two other storage paths that can be set. The following example is provided:

ruler:
  storage:
    type: local
    local:
      directory: /tmp/rules    <<<<<<<
  rule_path: /tmp/scratch      <<<<<<<
  alertmanager_url: http://localhost
  ring:
    kvstore:
      store: inmemory
  enable_api: true

Can someone please explain what these two settings do, and how they interact with the common.storage.filesystem.rules_directory setting?

Thanks,

Brian.

P.S. I found GH#3952, which was a similar issue using the docker image, but the solution made to that issue was simply to mkdir the /loki/rules-temp directory instead of /loki/rules.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.