Skip to content

Commit 47295c7

Browse files
CharlieR-o-o-tcw-Guo
authored andcommitted
feat(fluentbit): add enable_flb_null to fluentbit filter params
Signed-off-by: Siarhei Rasiukevich <[email protected]>
1 parent fe64c66 commit 47295c7

File tree

10 files changed

+54
-1
lines changed

10 files changed

+54
-1
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ type Lua struct {
3636
// If enabled, Lua script will be executed in protected mode.
3737
// It prevents to crash when invalid Lua script is executed. Default is true.
3838
ProtectedMode *bool `json:"protectedMode,omitempty"`
39+
// If enabled, null will be converted to flb_null in Lua.
40+
// This helps prevent removing key/value since nil is a special value to remove key/value from map in Lua. Default value: false.
41+
EnableFlbNull *bool `json:"enable_flb_null,omitempty"`
3942
// By default when the Lua script is invoked, the record timestamp is passed as a
4043
// Floating number which might lead to loss precision when the data is converted back.
4144
// If you desire timestamp precision enabling this option will pass the timestamp as
@@ -90,6 +93,10 @@ func (l *Lua) Params(_ plugins.SecretLoader) (*params.KVs, error) {
9093
kvs.Insert("protected_mode", strconv.FormatBool(*l.ProtectedMode))
9194
}
9295

96+
if l.EnableFlbNull != nil {
97+
kvs.Insert("enable_flb_null", strconv.FormatBool(*l.EnableFlbNull))
98+
}
99+
93100
if l.TimeAsTable {
94101
kvs.Insert("time_as_table", "true")
95102
}

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-bit-crds/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: fluent-bit-crds
33
description: A helm chart for Fluent-Bit custom resource definitions (CRDs) used by fluent-operator.
44
type: application
5-
version: 0.2.0
5+
version: 0.2.1
66
appVersion: v3.5.0
77
keywords:
88
- logging

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,11 @@ spec:
429429
description: Inline LUA code instead of loading from a path
430430
via script.
431431
type: string
432+
enable_flb_null:
433+
description: |-
434+
If enabled, null will be converted to flb_null in Lua.
435+
This helps prevent removing key/value since nil is a special value to remove key/value from map in Lua. Default value: false.
436+
type: boolean
432437
protectedMode:
433438
description: |-
434439
If enabled, Lua script will be executed in protected mode.

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,11 @@ spec:
429429
description: Inline LUA code instead of loading from a path
430430
via script.
431431
type: string
432+
enable_flb_null:
433+
description: |-
434+
If enabled, null will be converted to flb_null in Lua.
435+
This helps prevent removing key/value since nil is a special value to remove key/value from map in Lua. Default value: false.
436+
type: boolean
432437
protectedMode:
433438
description: |-
434439
If enabled, Lua script will be executed in protected mode.

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,11 @@ spec:
426426
description: Inline LUA code instead of loading from a path
427427
via script.
428428
type: string
429+
enable_flb_null:
430+
description: |-
431+
If enabled, null will be converted to flb_null in Lua.
432+
This helps prevent removing key/value since nil is a special value to remove key/value from map in Lua. Default value: false.
433+
type: boolean
429434
protectedMode:
430435
description: |-
431436
If enabled, Lua script will be executed in protected mode.

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,11 @@ spec:
426426
description: Inline LUA code instead of loading from a path
427427
via script.
428428
type: string
429+
enable_flb_null:
430+
description: |-
431+
If enabled, null will be converted to flb_null in Lua.
432+
This helps prevent removing key/value since nil is a special value to remove key/value from map in Lua. Default value: false.
433+
type: boolean
429434
protectedMode:
430435
description: |-
431436
If enabled, Lua script will be executed in protected mode.

docs/plugins/fluentbit/filter/lua.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ The Lua Filter allows you to modify the incoming records using custom Lua Script
1111
| typeIntKey | If these keys are matched, the fields are converted to integer. If more than one key, delimit by space. Note that starting from Fluent Bit v1.6 integer data types are preserved and not converted to double as in previous versions. | []string |
1212
| typeArrayKey | If these keys are matched, the fields are handled as array. If more than one key, delimit by space. It is useful the array can be empty. | []string |
1313
| protectedMode | If enabled, Lua script will be executed in protected mode. It prevents to crash when invalid Lua script is executed. Default is true. | *bool |
14+
| enable_flb_null | If enabled, null will be converted to flb_null in Lua. This helps prevent removing key/value since nil is a special value to remove key/value from map in Lua. Default value: false. | *bool |
1415
| timeAsTable | By default when the Lua script is invoked, the record timestamp is passed as a Floating number which might lead to loss precision when the data is converted back. If you desire timestamp precision enabling this option will pass the timestamp as a Lua table with keys sec for seconds since epoch and nsec for nanoseconds. | bool |

manifests/setup/fluent-operator-crd.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,11 @@ spec:
425425
description: Inline LUA code instead of loading from a path
426426
via script.
427427
type: string
428+
enable_flb_null:
429+
description: |-
430+
If enabled, null will be converted to flb_null in Lua.
431+
This helps prevent removing key/value since nil is a special value to remove key/value from map in Lua. Default value: false.
432+
type: boolean
428433
protectedMode:
429434
description: |-
430435
If enabled, Lua script will be executed in protected mode.
@@ -15389,6 +15394,11 @@ spec:
1538915394
description: Inline LUA code instead of loading from a path
1539015395
via script.
1539115396
type: string
15397+
enable_flb_null:
15398+
description: |-
15399+
If enabled, null will be converted to flb_null in Lua.
15400+
This helps prevent removing key/value since nil is a special value to remove key/value from map in Lua. Default value: false.
15401+
type: boolean
1539215402
protectedMode:
1539315403
description: |-
1539415404
If enabled, Lua script will be executed in protected mode.

manifests/setup/setup.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,11 @@ spec:
425425
description: Inline LUA code instead of loading from a path
426426
via script.
427427
type: string
428+
enable_flb_null:
429+
description: |-
430+
If enabled, null will be converted to flb_null in Lua.
431+
This helps prevent removing key/value since nil is a special value to remove key/value from map in Lua. Default value: false.
432+
type: boolean
428433
protectedMode:
429434
description: |-
430435
If enabled, Lua script will be executed in protected mode.
@@ -15389,6 +15394,11 @@ spec:
1538915394
description: Inline LUA code instead of loading from a path
1539015395
via script.
1539115396
type: string
15397+
enable_flb_null:
15398+
description: |-
15399+
If enabled, null will be converted to flb_null in Lua.
15400+
This helps prevent removing key/value since nil is a special value to remove key/value from map in Lua. Default value: false.
15401+
type: boolean
1539215402
protectedMode:
1539315403
description: |-
1539415404
If enabled, Lua script will be executed in protected mode.

0 commit comments

Comments
 (0)