Ask questionsLoki + Kubernetes labels question

Hey! I've been trying to setup Vector on my cluster, but am struggling with the config as it seems various resources are outdated, or unclear as to how to approach Loki and Kubernetes.

Loki config:

data_dir = "/var/lib/vector"
  type = "kubernetes"
  type = "loki"
  inputs = ["kubernetes"]
  endpoint = "http://loki:3100"
  encoding.codec = "json"

The output of running this is:

➜  ~ kubectl -n vector logs vector-4d5np vector
May 29 18:27:28.838  INFO vector: Log level "info" is enabled.
May 29 18:27:28.838  INFO vector: Loading configs. path=["/etc/vector/vector.toml"]
May 29 18:27:28.841 ERROR vector: Configuration error: "/etc/vector/vector.toml": missing field `labels` for key `sinks.loki`

What sort of labels should I be putting the config?

How do I extract k8s labels and ship them to Loki?

See Loki's fluent-bit config for what sorts of labels (I assume) should be added.


Answer questions rrichardson

I got the deployment working using the latest from the k8s-impl branch from However, the process crashes immediately with a "capacity overflow" in the Loki sink configuration.

Here is my config:

  managed.toml: |
    # Data dir is location controlled at the `DaemonSet`.
    data_dir = "/vector-data-dir"

    # Ingest logs from Kubernetes.
      type = "kubernetes_logs"

      # General
      type = "loki"
      inputs = ["kubernetes_logs"]
      endpoint = "http://loki.loki.svc.cluster.local:3100"
      healthcheck = true
      encoding.codec = "json"
        k8s_pod_name = "{{ kubernetes.pod_name }}"
        k8s_pod_uid = "{{ kubernetes.pod_uid }}"

here is the log with backtrace:

Jul 09 21:14:07.635  INFO vector: Vector is starting. version="0.10.0" git_version="v0.9.0-421-g33de5ef" released="Thu, 09 Jul 2020 20:33:25 +0000" arch="x86_64"
Jul 09 21:14:07.635  INFO vector::sources::kubernetes_logs: obtained Kubernetes Node name to collect logs for (self) self_node_name="ip-10-210-70-174.ec2.internal"
thread 'main' panicked at 'capacity overflow', src/liballoc/
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at ./cargo/registry/src/
   1: backtrace::backtrace::trace_unsynchronized
             at ./cargo/registry/src/
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/
   4: core::fmt::write
             at src/libcore/fmt/
   5: std::io::Write::write_fmt
             at src/libstd/io/
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/
   9: std::panicking::default_hook
             at src/libstd/
  10: std::panicking::rust_panic_with_hook
             at src/libstd/
  11: rust_begin_unwind
             at src/libstd/
  12: core::panicking::panic_fmt
             at src/libcore/
  13: core::panicking::panic
             at src/libcore/
  14: alloc::raw_vec::capacity_overflow
             at src/liballoc/
  15: alloc::raw_vec::RawVec<T,A>::allocate_in::{{closure}}
  16: <vector::sinks::loki::LokiConfig as vector::topology::config::SinkConfig>::build
  17: vector::topology::builder::build_pieces
  18: vector::topology::builder::check_build
  19: vector::topology::validate
  20: vector::main::{{closure}}
  21: <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll
  22: <futures_util::compat::compat03as01::Compat<Fut> as futures::future::Future>::poll
  23: futures::task_impl::std::set
  24: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
  25: tokio::runtime::enter::Enter::block_on
  26: tokio::runtime::context::enter
  27: tokio::runtime::Runtime::block_on
  28: tokio_compat::runtime::threadpool::Runtime::block_on
  29: vector::main
  30: std::rt::lang_start::{{closure}}
  31: std::rt::lang_start_internal::{{closure}}
             at src/libstd/
  32: std::panicking::try::do_call
             at src/libstd/
  33: std::panicking::try
             at src/libstd/
  34: std::panic::catch_unwind
             at src/libstd/
  35: std::rt::lang_start_internal
             at src/libstd/
  36: main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Github User Rank List