Skip to content

Commit

Permalink
feat: make fluentbit pause on chunks overlimit configurable
Browse files Browse the repository at this point in the history
Signed-off-by: Bence Csati <[email protected]>
  • Loading branch information
csatib02 committed Dec 16, 2024
1 parent 3354f9a commit 2c7da5a
Show file tree
Hide file tree
Showing 14 changed files with 45 additions and 9 deletions.
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

0 comments on commit 2c7da5a

Please sign in to comment.