Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make fluentbit pause on chunks overlimit configurable #1881

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1587,6 +1587,8 @@ spec:
items:
type: string
type: array
storage.pause_on_chunks_overlimit:
type: string
storage.type:
type: string
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2429,6 +2429,8 @@ spec:
items:
type: string
type: array
storage.pause_on_chunks_overlimit:
type: string
storage.type:
type: string
type: object
Expand Down Expand Up @@ -11779,6 +11781,8 @@ spec:
items:
type: string
type: array
storage.pause_on_chunks_overlimit:
type: string
storage.type:
type: string
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4066,6 +4066,8 @@ spec:
items:
type: string
type: array
storage.pause_on_chunks_overlimit:
type: string
storage.type:
type: string
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1584,6 +1584,8 @@ spec:
items:
type: string
type: array
storage.pause_on_chunks_overlimit:
type: string
storage.type:
type: string
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2426,6 +2426,8 @@ spec:
items:
type: string
type: array
storage.pause_on_chunks_overlimit:
type: string
storage.type:
type: string
type: object
Expand Down Expand Up @@ -11776,6 +11778,8 @@ spec:
items:
type: string
type: array
storage.pause_on_chunks_overlimit:
type: string
storage.type:
type: string
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4063,6 +4063,8 @@ spec:
items:
type: string
type: array
storage.pause_on_chunks_overlimit:
type: string
storage.type:
type: string
type: object
Expand Down
2 changes: 2 additions & 0 deletions config/crd/bases/logging.banzaicloud.io_fluentbitagents.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1584,6 +1584,8 @@ spec:
items:
type: string
type: array
storage.pause_on_chunks_overlimit:
type: string
storage.type:
type: string
type: object
Expand Down
4 changes: 4 additions & 0 deletions config/crd/bases/logging.banzaicloud.io_loggings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2426,6 +2426,8 @@ spec:
items:
type: string
type: array
storage.pause_on_chunks_overlimit:
type: string
storage.type:
type: string
type: object
Expand Down Expand Up @@ -11776,6 +11778,8 @@ spec:
items:
type: string
type: array
storage.pause_on_chunks_overlimit:
type: string
storage.type:
type: string
type: object
Expand Down
2 changes: 2 additions & 0 deletions config/crd/bases/logging.banzaicloud.io_nodeagents.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4063,6 +4063,8 @@ spec:
items:
type: string
type: array
storage.pause_on_chunks_overlimit:
type: string
storage.type:
type: string
type: object
Expand Down
6 changes: 6 additions & 0 deletions docs/configuration/crds/v1beta1/fluentbit_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,12 @@ When a monitored file reach it buffer capacity due to a very long line (Buffer_M

Default: Off

### storage.pause_on_chunks_overlimit (string, optional) {#inputtail-storage.pause_on_chunks_overlimit}

Specifies whether to pause or drop data when the buffer is full. This helps to make sure we apply backpressure on the input if enabled, see https://docs.fluentbit.io/manual/administration/backpressure

Default: on

### storage.type (string, optional) {#inputtail-storage.type}

Specify the buffering mechanism to use. It can be memory or filesystem.
Expand Down
2 changes: 0 additions & 2 deletions pkg/resources/fluentbit/tenants.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,6 @@ func (r *Reconciler) configureInputsForTenants(tenants []v1beta1.Tenant, input *

tenantValues["DB"] = fmt.Sprintf("/tail-db/tail-containers-state-%s.db", t.Name)
tenantValues["Tag"] = fmt.Sprintf("kubernetes.%s.*", hashFromTenantName(t.Name))
// This helps to make sure we apply backpressure on the input, see https://docs.fluentbit.io/manual/administration/backpressure
tenantValues["storage.pause_on_chunks_overlimit"] = "on"
input.Inputs = append(input.Inputs, fluentbitInputConfigWithTenant{
Tenant: t.Name,
Values: tenantValues,
Expand Down
16 changes: 9 additions & 7 deletions pkg/resources/nodeagent/nodeagent.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,13 @@ func NodeAgentFluentbitDefaults(userDefined v1beta1.NodeAgentConfig) (*v1beta1.N
LogLevel: "info",
CoroStackSize: 24576,
InputTail: v1beta1.InputTail{
Path: "/var/log/containers/*.log",
RefreshInterval: "5",
SkipLongLines: "On",
DB: util.StringPointer("/tail-db/tail-containers-state.db"),
MemBufLimit: "5MB",
Tag: "kubernetes.*",
Path: "/var/log/containers/*.log",
RefreshInterval: "5",
SkipLongLines: "On",
DB: util.StringPointer("/tail-db/tail-containers-state.db"),
MemBufLimit: "5MB",
Tag: "kubernetes.*",
StoragePauseOnChunksOverlimit: "on",
},
Security: &v1beta1.Security{
RoleBasedAccessControlCreate: util.BoolPointer(true),
Expand Down Expand Up @@ -211,7 +212,8 @@ var NodeAgentFluentbitWindowsDefaults = &v1beta1.NodeAgentConfig{
KubeTagPrefix: "kubernetes.C.var.log.containers.",
},
InputTail: v1beta1.InputTail{
Path: "C:\\var\\log\\containers\\*.log",
Path: "C:\\var\\log\\containers\\*.log",
StoragePauseOnChunksOverlimit: "on",
},
ContainersPath: "C:\\ProgramData\\docker",
VarLogsPath: "C:\\var\\log",
Expand Down
3 changes: 3 additions & 0 deletions pkg/sdk/logging/api/v1beta1/fluentbit_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,9 @@ type InputTail struct {
DockerModeFlush string `json:"Docker_Mode_Flush,omitempty"`
// Specify one or multiple parser definitions to apply to the content. Part of the new Multiline Core support in 1.8 (default: "")
MultilineParser []string `json:"multiline.parser,omitempty"`
// Specifies whether to pause or drop data when the buffer is full. (default:on)
// This helps to make sure we apply backpressure on the input if enabled, see https://docs.fluentbit.io/manual/administration/backpressure
StoragePauseOnChunksOverlimit string `json:"storage.pause_on_chunks_overlimit,omitempty"`
}

// FilterKubernetes Fluent Bit Kubernetes Filter allows to enrich your log files with Kubernetes metadata.
Expand Down
3 changes: 3 additions & 0 deletions pkg/sdk/logging/api/v1beta1/logging_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,9 @@ func FluentBitDefaults(fluentbitSpec *FluentbitSpec) error {
if fluentbitSpec.InputTail.Tag == "" {
fluentbitSpec.InputTail.Tag = "kubernetes.*"
}
if fluentbitSpec.InputTail.StoragePauseOnChunksOverlimit == "" {
fluentbitSpec.InputTail.StoragePauseOnChunksOverlimit = "on"
}
if fluentbitSpec.Annotations == nil {
fluentbitSpec.Annotations = make(map[string]string)
}
Expand Down
Loading