grafana / loki

Like Prometheus, but for logs.
https://grafana.com/loki
GNU Affero General Public License v3.0
23.34k stars 3.38k forks source link

tanka failed: evaluating jsonnet: RUNTIME ERROR: must define storage_backend as a comma separated list of backends in use #6884

Open phuna opened 2 years ago

phuna commented 2 years ago

Describe the bug I got this error when following the installation instruction here: https://grafana.com/docs/loki/latest/installation/tanka/

$ tk show environments/loki/
Error: evaluating jsonnet: RUNTIME ERROR: must define storage_backend as a comma separated list of backends in use,
    valid entries: dynamodb,s3,gcs,bigtable,cassandra. Typically this would be two entries, e.g. `gcs,bigtable`

main.jsonnet file:

cat environments/loki/main.jsonnet
local gateway = import 'loki/gateway.libsonnet';
local loki = import 'loki/loki.libsonnet';
local promtail = import 'promtail/promtail.libsonnet';

loki + promtail + gateway {
  _config+:: {
    namespace: 'loki',
    htpasswd_contents: 'loki:$apr1$H4yGiGNg$ssl5/NymaGFRUvxIV1Nyr.',

    //Set this variable based on the type of object storage you're using.
    boltdb_shipper_shared_store: 'filesystem',

    //Update the object_store and from fields
    loki+: {
      schema_config: {
        configs: [{
          from: '2022-08-01',
          store: 'boltdb-shipper',
          object_store: 'filesystem',
          schema: 'v11',
          index: {
            prefix: '%s_index_' % $._config.table_prefix,
            period: '%dh' % $._config.index_period_hours,
          },
        }],
      },
    },

    //Update the container_root_path if necessary
    promtail_config+: {
      clients: [{
        scheme:: 'http',
        hostname:: 'gateway.%(namespace)s.svc' % $._config,
        username:: 'loki',
        password:: 'lokiadmin',
        container_root_path:: '/var/snap/microk8s/common/var/lib/containerd',
      }],
    },

    replication_factor: 3,
    consul_replicas: 1,
  },
}

To Reproduce Steps to reproduce the behavior:

  1. Edit environments/loki/main.jsonnet as above
  2. Run tk show environments/loki

Environment:

emilyastranova commented 1 year ago

I followed the instructions step by step and am having the same exact issue with filesystem

cpaschold commented 1 year ago

Same issue here, also followed the instructions step by step.

JuanPabloSGU commented 1 year ago

I believe that the issue is with the docs not tanka itself... it mentions that you can replace "Update the value of boltdb_shipper_shared_storeto the type of object storage you are using. Options are gcs, s3, azure, or filesystem. Update the object_storevariable under the schema_configsection to the same value.". I found that this is not the case with filesystem. I think that this is missleading. To fix this issue add a storage_config they have done something similar see

local gateway = import 'loki/gateway.libsonnet';
local loki = import 'loki/loki.libsonnet';
local promtail = import 'promtail/promtail.libsonnet';

loki + promtail + gateway {
  _config+:: {
    namespace: 'loki',
    htpasswd_contents: 'loki:$apr1$H4yGiGNg$ssl5/NymaGFRUvxIV1Nyr.',

    //Set this variable based on the type of object storage you're using.
    boltdb_shipper_shared_store: 'filesystem',

    //Update the object_store and from fields
    loki+: {
      schema_config: {
        configs: [{
          from: '2022-10-6',
          store: 'boltdb-shipper',
          object_store: 'filesystem',
          schema: 'v11',
          index: {
            prefix: 'index_',
            period: '24h',
          },
        }],
      },
      storage_config: {
        boltdb: {
          directory: '/tmp/loki/index',
        },
        filesystem: {
          directory: '/tmp/loki/index',
        },
      },
    },

    //Update the container_root_path if necessary
    promtail_config+: {
      clients: [{
        scheme:: 'http',
        hostname:: 'gateway.%(namespace)s.svc' % $._config,
        username:: 'loki',
        password:: 'password',
        container_root_path:: '/var/lib/docker',
      }],
    },

    replication_factor: 3,
    consul_replicas: 1,
  },
}
beckerrobin commented 1 year ago

Same issue here!