fluent-operator icon indicating copy to clipboard operation
fluent-operator copied to clipboard

Does watchedNamespaces support regex

Open tanmx opened this issue 2 years ago • 4 comments

Describe the issue

I want to use ClusterFluentdConfig to collect all logs of the cluster except logging namespace. And use FluentdConfig in logging namespace to collect the namespace logs. If I have many namespaces and they are updated frequently, watchedNamespaces also need to be updated synchronously, which will be very troublesome. Is there any other good way?

such as:

ClusterFluentdConfig-> all namespace expect logging namespace-> ClusterOutput -> es(all)
FluentdConfig -> logging namespace-> output -> es(other)

How did you install fluent operator?

helm upgrade --install --wait --create-namespace --namespace logging -f fluent-values.yaml fluent-operator fluent-operator

the fluent-values.yaml

fluentd:
  enable: true
  name: fluentd
  port: 24224
  image:
    repository: "kubesphere/fluentd"
    tag: "v1.15.3-arm64"
  replicas: 1
  forward:
    port: 24224
  watchedNamespaces:
    - kube-system
    - default
    - monitoring
  resources:
    limits:
      cpu: 1
      memory: 1024Mi
    requests:
      cpu: 100m
      memory: 128Mi

Additional context

No response

tanmx avatar Feb 24 '23 08:02 tanmx

Here, if set, logs will be collected for all namespaces that are set. If not set, the entire cluster logs will be collected. https://github.com/fluent/fluent-operator/blob/master/pkg/fluentd/router/route.go#L54

wenchajun avatar Mar 01 '23 06:03 wenchajun

It's a good idea to maybe add a parameter to exclude some namespaces. nonWatchNamespace?

wenchajun avatar Mar 01 '23 06:03 wenchajun

If I have many namespaces and they are updated frequently, watchedNamespaces also need to be updated synchronously, which will be very troublesome. Is there any other good way?

Fluent Operator uses https://github.com/kube-logging/fluent-plugin-label-router to control the namespaces selection, it's possible to exclude some namespaces by this plugin: image

It'll be great if you can create a proposal and a following PR for this @tanmx

benjaminhuo avatar Mar 02 '23 03:03 benjaminhuo

nonWatchNamespace

It would be a great feature to have.

kaiohenricunha avatar May 13 '23 22:05 kaiohenricunha