Skip to content
This repository was archived by the owner on Oct 8, 2024. It is now read-only.
This repository was archived by the owner on Oct 8, 2024. It is now read-only.

Use __host__ label in promtail config #47

@james-callahan

Description

@james-callahan

From https://grafana.com/docs/loki/latest/clients/promtail/scraping/#kubernetes-discovery

Note that while Promtail can utilize the Kubernetes API to discover pods as targets, it can only read log files from pods that are running on the same node as the one Promtail is running on. Promtail looks for a host label on each target and validates that it is set to the same hostname as Promtail's (using either $HOSTNAME or the hostname reported by the kernel if the environment variable is not set).
This means that any time Kubernetes service discovery is used, there must be a relabel_config that creates the intermediate label host from __meta_kubernetes_pod_node_name

We don't currently set the __host__ label. Though I think we still get host filtering via https://github.com/grafana/loki/blob/c53457feb95a871e7494d22c5e072004874a197c/clients/pkg/promtail/targets/file/filetargetmanager.go#L107-L117

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions