Skip to content

Commit 3d63aff

Browse files
solidDoWantcw-Guo
authored andcommitted
Added the ability to set Use_Tag_For_Meta on fluentbit kubernetes filter
Signed-off-by: Fred Heinecke <[email protected]>
1 parent 3921e53 commit 3d63aff

File tree

9 files changed

+51
-0
lines changed

9 files changed

+51
-0
lines changed

apis/fluentbit/v1alpha2/plugins/filter/kubernetes_types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ type Kubernetes struct {
105105
NamespaceMetadataOnly *bool `json:"namespaceMetadataOnly,omitempty"`
106106
// Include Kubernetes owner references in the extra metadata.
107107
OwnerReferences *bool `json:"ownerReferences,omitempty"`
108+
// If true, Kubernetes metadata (e.g., pod_name, container_name, namespace_name etc) will be extracted from the tag itself.
109+
UseTagForMeta *bool `json:"useTagForMeta,omitempty"`
108110
}
109111

110112
func (_ *Kubernetes) Name() string {
@@ -222,6 +224,9 @@ func (k *Kubernetes) Params(_ plugins.SecretLoader) (*params.KVs, error) {
222224
if k.OwnerReferences != nil {
223225
kvs.Insert("Owner_References", fmt.Sprint(*k.OwnerReferences))
224226
}
227+
if k.UseTagForMeta != nil {
228+
kvs.Insert("Use_Tag_For_Meta", fmt.Sprint(*k.UseTagForMeta))
229+
}
225230
return kvs, nil
226231
}
227232

apis/fluentbit/v1alpha2/plugins/filter/zz_generated.deepcopy.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

charts/fluent-operator/charts/fluent-bit-crds/crds/fluentbit.fluent.io_clusterfilters.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,11 @@ spec:
317317
instead of calling Kube Server API to enhance the log.
318318
This could mitigate the Kube API heavy traffic issue for large cluster.
319319
type: boolean
320+
useTagForMeta:
321+
description: If true, Kubernetes metadata (e.g., pod_name,
322+
container_name, namespace_name etc) will be extracted
323+
from the tag itself.
324+
type: boolean
320325
type: object
321326
logToMetrics:
322327
description: LogToMetrics defines a Log to Metrics Filter configuration.

charts/fluent-operator/charts/fluent-bit-crds/crds/fluentbit.fluent.io_filters.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,11 @@ spec:
317317
instead of calling Kube Server API to enhance the log.
318318
This could mitigate the Kube API heavy traffic issue for large cluster.
319319
type: boolean
320+
useTagForMeta:
321+
description: If true, Kubernetes metadata (e.g., pod_name,
322+
container_name, namespace_name etc) will be extracted
323+
from the tag itself.
324+
type: boolean
320325
type: object
321326
logToMetrics:
322327
description: LogToMetrics defines a Log to Metrics Filter configuration.

config/crd/bases/fluentbit.fluent.io_clusterfilters.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,11 @@ spec:
317317
instead of calling Kube Server API to enhance the log.
318318
This could mitigate the Kube API heavy traffic issue for large cluster.
319319
type: boolean
320+
useTagForMeta:
321+
description: If true, Kubernetes metadata (e.g., pod_name,
322+
container_name, namespace_name etc) will be extracted
323+
from the tag itself.
324+
type: boolean
320325
type: object
321326
logToMetrics:
322327
description: LogToMetrics defines a Log to Metrics Filter configuration.

config/crd/bases/fluentbit.fluent.io_filters.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,11 @@ spec:
317317
instead of calling Kube Server API to enhance the log.
318318
This could mitigate the Kube API heavy traffic issue for large cluster.
319319
type: boolean
320+
useTagForMeta:
321+
description: If true, Kubernetes metadata (e.g., pod_name,
322+
container_name, namespace_name etc) will be extracted
323+
from the tag itself.
324+
type: boolean
320325
type: object
321326
logToMetrics:
322327
description: LogToMetrics defines a Log to Metrics Filter configuration.

docs/plugins/fluentbit/filter/kubernetes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,4 @@ Kubernetes filter allows to enrich your log files with Kubernetes metadata. <br
4040
| namespaceAnnotations | Include Kubernetes namespace resource annotations in the extra metadata. | *bool |
4141
| namespaceMetadataOnly | Include Kubernetes namespace metadata only and no pod metadata. If this is set, the values of Labels and Annotations are ignored. | *bool |
4242
| ownerReferences | Include Kubernetes owner references in the extra metadata. | *bool |
43+
| useTagForMeta | If true, Kubernetes metadata (e.g., pod_name, container_name, namespace_name etc) will be extracted from the tag itself. | *bool |

manifests/setup/fluent-operator-crd.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,11 @@ spec:
316316
instead of calling Kube Server API to enhance the log.
317317
This could mitigate the Kube API heavy traffic issue for large cluster.
318318
type: boolean
319+
useTagForMeta:
320+
description: If true, Kubernetes metadata (e.g., pod_name,
321+
container_name, namespace_name etc) will be extracted
322+
from the tag itself.
323+
type: boolean
319324
type: object
320325
logToMetrics:
321326
description: LogToMetrics defines a Log to Metrics Filter configuration.
@@ -15053,6 +15058,11 @@ spec:
1505315058
instead of calling Kube Server API to enhance the log.
1505415059
This could mitigate the Kube API heavy traffic issue for large cluster.
1505515060
type: boolean
15061+
useTagForMeta:
15062+
description: If true, Kubernetes metadata (e.g., pod_name,
15063+
container_name, namespace_name etc) will be extracted
15064+
from the tag itself.
15065+
type: boolean
1505615066
type: object
1505715067
logToMetrics:
1505815068
description: LogToMetrics defines a Log to Metrics Filter configuration.

manifests/setup/setup.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,11 @@ spec:
316316
instead of calling Kube Server API to enhance the log.
317317
This could mitigate the Kube API heavy traffic issue for large cluster.
318318
type: boolean
319+
useTagForMeta:
320+
description: If true, Kubernetes metadata (e.g., pod_name,
321+
container_name, namespace_name etc) will be extracted
322+
from the tag itself.
323+
type: boolean
319324
type: object
320325
logToMetrics:
321326
description: LogToMetrics defines a Log to Metrics Filter configuration.
@@ -15053,6 +15058,11 @@ spec:
1505315058
instead of calling Kube Server API to enhance the log.
1505415059
This could mitigate the Kube API heavy traffic issue for large cluster.
1505515060
type: boolean
15061+
useTagForMeta:
15062+
description: If true, Kubernetes metadata (e.g., pod_name,
15063+
container_name, namespace_name etc) will be extracted
15064+
from the tag itself.
15065+
type: boolean
1505615066
type: object
1505715067
logToMetrics:
1505815068
description: LogToMetrics defines a Log to Metrics Filter configuration.

0 commit comments

Comments
 (0)