Loki: Kubernetes 1.14 CRI directory change

Created on 12 Mar 2019  路  4Comments  路  Source: grafana/loki

Is your feature request related to a problem? Please describe.
Kubernetes 1.14 is changing the CRI log directory to include the namespace and pod name.

Describe the solution you'd like
Loki should support the new format as well as the old format out of the box.

Describe alternatives you've considered
Each user customizes promtail configmap

Additional context
See https://github.com/kubernetes/kubernetes/issues/73503

Most helpful comment

Until we patch the helm chart, users running CRI need to adapt their relabel rules in the promtail config.
The old path pattern /var/log/pods/$1/*.log no longer works.

I've seen success in changing all occurrences of

        - replacement: /var/log/pods/$1/*.log
          separator: /
          source_labels:
          - __meta_kubernetes_pod_uid
          - __meta_kubernetes_pod_container_name
          target_label: __path__

to

       - replacement: /var/log/pods/*$1*/*/*.log
          source_labels:
          - __meta_kubernetes_pod_uid
          target_label: __path__

All 4 comments

Since minikube ships with 1.14 it's becoming a more urgent issue

Until we patch the helm chart, users running CRI need to adapt their relabel rules in the promtail config.
The old path pattern /var/log/pods/$1/*.log no longer works.

I've seen success in changing all occurrences of

        - replacement: /var/log/pods/$1/*.log
          separator: /
          source_labels:
          - __meta_kubernetes_pod_uid
          - __meta_kubernetes_pod_container_name
          target_label: __path__

to

       - replacement: /var/log/pods/*$1*/*/*.log
          source_labels:
          - __meta_kubernetes_pod_uid
          target_label: __path__

@davkal refer to comment, could it be better to add a new scrape config?

I've confirmed with a developer from Google that GKE switched to the new log directory format even for older Kubernetes versions before 1.14.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Horkyze picture Horkyze  路  5Comments

bzon picture bzon  路  5Comments

oleksandr-hyuna picture oleksandr-hyuna  路  4Comments

Mario-Hofstaetter picture Mario-Hofstaetter  路  4Comments

pandey-adarsh147 picture pandey-adarsh147  路  4Comments