cassandragrafanagrafana-lokipromtail

Loki gives error table index_2797 does not exist when using Cassandra as store


I'm using Cassandra as the data and index store for Grafana Loki, following the guidelines in the Grafana Documentation. However, I'm encountering an error stating that the table 'index_XXXX' does not exist. Is there a configuration step that I might have overlooked?"

Docker compose for loki

loki:
    image: grafana/loki:2.8.0
    ports:
      - 3100:3100
    volumes:
      - ./config/loki-config.yml:/etc/loki/local-config.yaml
    command: -config.file=/etc/loki/local-config.yaml
    depends_on:
      - cassandra
    networks:
      - app

loki config file

target: all

auth_enabled: false

server:
  http_listen_port: 3100
  
common:
  path_prefix: /loki
  ring:
    kvstore:
      store: inmemory
  
schema_config:
  configs:
    - from: 2020-07-01
      store: cassandra
      object_store: cassandra
      schema: v11
      index:
        prefix: index_
        period: 168h
      chunks:
        prefix: chunk_
        period: 168h
  
storage_config:
  cassandra:
    addresses: cassandra
    keyspace: loki1
    auth: false
    replication_factor: 1
    timeout: 100s
    connect_timeout: 100s
    max_retries: 3
  filesystem:
    directory: /loki/chunks

table_manager:
  retention_deletes_enabled: true
  retention_period: 168h
  
limits_config:
  retention_period: 168h
  allow_deletes: true

Solution

  • I was able to find a solution for with the help of the link . I am posting the solution here as it may be helpful for someone who faced the same problem. It is same loki config file but we should include "table-manager" as a value of target key. So loki will create the tables.

    target: all,table-manager
    auth_enabled: false
    server:
      http_listen_port: 3100
    common:
      path_prefix: /loki
      ring:
        kvstore:
          store: inmemory  
    schema_config:
      configs:
        - from: 2020-07-01
          store: cassandra
          object_store: cassandra
          schema: v11
          index:
            prefix: index_
            period: 168h
          chunks:
            prefix: chunk_
            period: 168h 
    storage_config:
      cassandra:
        addresses: cassandra
        keyspace: loki1
        auth: false
        replication_factor: 1
        timeout: 100s
        connect_timeout: 100s
        max_retries: 3
      filesystem:
        directory: /loki/chunks
    table_manager:
      retention_deletes_enabled: true
      retention_period: 168h  
    limits_config:
      retention_period: 168h
      allow_deletes: true
    query_range:
      parallelise_shardable_queries: false