Skip to content

Commit

Permalink
Merge pull request #1882 from kube-logging/configurable-pause-backport
Browse files Browse the repository at this point in the history
feat: make fluentbit pause on chunks overlimit configurable
  • Loading branch information
pepov authored Dec 16, 2024
2 parents 72257f5 + 5af4684 commit 5d2b977
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1493,6 +1493,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 @@ -2540,6 +2540,8 @@ spec:
items:
type: string
type: array
storage.pause_on_chunks_overlimit:
type: string
storage.type:
type: string
type: object
Expand Down Expand Up @@ -11960,6 +11962,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 @@ -4055,6 +4055,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 @@ -1493,6 +1493,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 @@ -2540,6 +2540,8 @@ spec:
items:
type: string
type: array
storage.pause_on_chunks_overlimit:
type: string
storage.type:
type: string
type: object
Expand Down Expand Up @@ -11960,6 +11962,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 @@ -4055,6 +4055,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 @@ -554,6 +554,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 @@ -85,12 +85,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 @@ -208,7 +209,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 @@ -286,6 +286,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 @@ -294,6 +294,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 5d2b977

Please sign in to comment.