From b98a7a68f8f52fe4a3fa836ccd760121f2a6cf20 Mon Sep 17 00:00:00 2001 From: Zadkiel AHARONIAN Date: Fri, 11 Apr 2025 15:59:04 +0000 Subject: [PATCH] feat(hosttailer): reduce fluent-bit log level to error Signed-off-by: Zadkiel AHARONIAN --- .../logging-extensions.banzaicloud.io_hosttailers.yaml | 4 ++++ .../logging-extensions.banzaicloud.io_hosttailers.yaml | 4 ++++ .../logging-extensions.banzaicloud.io_hosttailers.yaml | 4 ++++ .../crds/extensions/v1alpha1/hosttailer_types.md | 10 ++++++++++ pkg/sdk/extensions/api/v1alpha1/filetailer.go | 3 +++ pkg/sdk/extensions/api/v1alpha1/hosttailer_types.go | 4 ++++ pkg/sdk/extensions/api/v1alpha1/systemdtailer.go | 3 +++ 7 files changed, 32 insertions(+) diff --git a/charts/logging-operator/charts/logging-operator-crds/templates/logging-extensions.banzaicloud.io_hosttailers.yaml b/charts/logging-operator/charts/logging-operator-crds/templates/logging-extensions.banzaicloud.io_hosttailers.yaml index a9649ba9f..e68f03dc4 100644 --- a/charts/logging-operator/charts/logging-operator-crds/templates/logging-extensions.banzaicloud.io_hosttailers.yaml +++ b/charts/logging-operator/charts/logging-operator-crds/templates/logging-extensions.banzaicloud.io_hosttailers.yaml @@ -368,6 +368,8 @@ spec: type: boolean skip_long_lines: type: string + verbose: + type: boolean required: - name type: object @@ -723,6 +725,8 @@ spec: type: string systemdFilter: type: string + verbose: + type: boolean required: - name type: object diff --git a/charts/logging-operator/crds/logging-extensions.banzaicloud.io_hosttailers.yaml b/charts/logging-operator/crds/logging-extensions.banzaicloud.io_hosttailers.yaml index a3282b006..a40302e68 100644 --- a/charts/logging-operator/crds/logging-extensions.banzaicloud.io_hosttailers.yaml +++ b/charts/logging-operator/crds/logging-extensions.banzaicloud.io_hosttailers.yaml @@ -365,6 +365,8 @@ spec: type: boolean skip_long_lines: type: string + verbose: + type: boolean required: - name type: object @@ -720,6 +722,8 @@ spec: type: string systemdFilter: type: string + verbose: + type: boolean required: - name type: object diff --git a/config/crd/bases/logging-extensions.banzaicloud.io_hosttailers.yaml b/config/crd/bases/logging-extensions.banzaicloud.io_hosttailers.yaml index a3282b006..a40302e68 100644 --- a/config/crd/bases/logging-extensions.banzaicloud.io_hosttailers.yaml +++ b/config/crd/bases/logging-extensions.banzaicloud.io_hosttailers.yaml @@ -365,6 +365,8 @@ spec: type: boolean skip_long_lines: type: string + verbose: + type: boolean required: - name type: object @@ -720,6 +722,8 @@ spec: type: string systemdFilter: type: string + verbose: + type: boolean required: - name type: object diff --git a/docs/configuration/crds/extensions/v1alpha1/hosttailer_types.md b/docs/configuration/crds/extensions/v1alpha1/hosttailer_types.md index 7d217e25b..9fbb30e47 100644 --- a/docs/configuration/crds/extensions/v1alpha1/hosttailer_types.md +++ b/docs/configuration/crds/extensions/v1alpha1/hosttailer_types.md @@ -122,6 +122,11 @@ Start reading from the head of new log files Skip long line when exceeding Buffer_Max_Size +### verbose (bool, optional) {#filetailer-verbose} + +Verbose mode + + ## SystemdTailer @@ -162,4 +167,9 @@ Override systemd log path Filter to select systemd unit example: kubelet.service +### verbose (bool, optional) {#systemdtailer-verbose} + +Verbose mode + + diff --git a/pkg/sdk/extensions/api/v1alpha1/filetailer.go b/pkg/sdk/extensions/api/v1alpha1/filetailer.go index 455650924..cf428a11e 100644 --- a/pkg/sdk/extensions/api/v1alpha1/filetailer.go +++ b/pkg/sdk/extensions/api/v1alpha1/filetailer.go @@ -53,6 +53,9 @@ func (f FileTailer) Command(Name string) []string { "-p", "format=template", "-p", "template={log}", } + if !f.Verbose { + command = append(command, "-qq") + } command = append(command, config.HostTailer.VersionedFluentBitPathArgs("/dev/stdout")...) return command } diff --git a/pkg/sdk/extensions/api/v1alpha1/hosttailer_types.go b/pkg/sdk/extensions/api/v1alpha1/hosttailer_types.go index 30c483428..9cf4a3a76 100644 --- a/pkg/sdk/extensions/api/v1alpha1/hosttailer_types.go +++ b/pkg/sdk/extensions/api/v1alpha1/hosttailer_types.go @@ -93,6 +93,8 @@ type FileTailer struct { ContainerBase *types.ContainerBase `json:"containerOverrides,omitempty"` // Override image field for the given trailer Image *tailer.ImageSpec `json:"image,omitempty"` + // Verbose mode + Verbose bool `json:"verbose,omitempty"` } // SystemdTailer configuration options @@ -111,6 +113,8 @@ type SystemdTailer struct { ContainerBase *types.ContainerBase `json:"containerOverrides,omitempty"` // Override image field for the given trailer Image *tailer.ImageSpec `json:"image,omitempty"` + // Verbose mode + Verbose bool `json:"verbose,omitempty"` } func init() { diff --git a/pkg/sdk/extensions/api/v1alpha1/systemdtailer.go b/pkg/sdk/extensions/api/v1alpha1/systemdtailer.go index 2ba8f0312..f698902fd 100644 --- a/pkg/sdk/extensions/api/v1alpha1/systemdtailer.go +++ b/pkg/sdk/extensions/api/v1alpha1/systemdtailer.go @@ -54,6 +54,9 @@ func (s SystemdTailer) Command(Name string) []string { "-o", "file", "-p", "format=plain", ) + if !s.Verbose { + command = append(command, "-qq") + } command = append(command, config.HostTailer.VersionedFluentBitPathArgs("/dev/stdout")...) return command }