kube-logging / logging-operator

Logging operator for Kubernetes
https://kube-logging.dev
Apache License 2.0
1.52k stars 326 forks source link

Namespace label based routing #1757

Closed pepov closed 1 month ago

pepov commented 1 month ago

Allow routing based on namespace labels if the feature is enabled in Fluent Bit, see: https://kube-logging.dev/4.6/docs/whats-new/#kubernetes-namespace-labels-and-annotations

Configure Fluent Bit in the Logging resource or separately like this:

kind: Logging
spec:
  fluentbit:
    filterKubernetes:
      namespace_labels: "On"

or

kind: FluentbitAgent
spec:
  filterKubernetes:
    namespace_labels: "On"

Use a clusterflow to match based on namespace labels (exclude works as well):

apiVersion: logging.banzaicloud.io/v1beta1
kind: ClusterFlow
metadata:
  name: sample
spec:
  match:
    - select:
        namespace_labels:
          tenant: devs
  gblobalOutputRefs:
    - example

depends on https://github.com/kube-logging/fluentd-images/pull/134 fixes https://github.com/kube-logging/logging-operator/issues/496