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: support fluentbit tail offsetKey parameters #1437

Merged
merged 2 commits into from
Dec 17, 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
2 changes: 1 addition & 1 deletion .github/workflows/lint-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.7
python-version: 3.9

- name: Set up chart-testing
uses: helm/chart-testing-action@v2.6.1
Expand Down
6 changes: 6 additions & 0 deletions apis/fluentbit/v1alpha2/plugins/input/tail_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ type Tail struct {
// Set one or multiple shell patterns separated by commas to exclude files matching a certain criteria,
// e.g: exclude_path=*.gz,*.zip
ExcludePath string `json:"excludePath,omitempty"`
// If enabled, Fluent Bit appends the offset of the current monitored file as part of the record.
// The value assigned becomes the key in the map
OffsetKey string `json:"offsetKey,omitempty"`
// For new discovered files on start (without a database offset/position),
// read the content from the head of the file, not tail.
ReadFromHead *bool `json:"readFromHead,omitempty"`
Expand Down Expand Up @@ -124,6 +127,9 @@ func (t *Tail) Params(_ plugins.SecretLoader) (*params.KVs, error) {
if t.ExcludePath != "" {
kvs.Insert("Exclude_Path", t.ExcludePath)
}
if t.OffsetKey != "" {
kvs.Insert("Offset_Key", t.OffsetKey)
}
if t.ReadFromHead != nil {
kvs.Insert("Read_from_Head", fmt.Sprint(*t.ReadFromHead))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,11 @@ spec:
This will help to reassembly multiline messages originally split by Docker or CRI
Specify one or Multiline Parser definition to apply to the content.
type: string
offsetKey:
description: |-
If enabled, Fluent Bit appends the offset of the current monitored file as part of the record.
The value assigned becomes the key in the map
type: string
parser:
description: Specify the name of a parser to interpret the entry
as a structured message.
Expand Down
5 changes: 5 additions & 0 deletions config/crd/bases/fluentbit.fluent.io_clusterinputs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,11 @@ spec:
This will help to reassembly multiline messages originally split by Docker or CRI
Specify one or Multiline Parser definition to apply to the content.
type: string
offsetKey:
description: |-
If enabled, Fluent Bit appends the offset of the current monitored file as part of the record.
The value assigned becomes the key in the map
type: string
parser:
description: Specify the name of a parser to interpret the entry
as a structured message.
Expand Down
1 change: 1 addition & 0 deletions docs/plugins/fluentbit/input/tail.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ The Tail input plugin allows to monitor one or several text files. <br /> It has
| path | Pattern specifying a specific log files or multiple ones through the use of common wildcards. | string |
| pathKey | If enabled, it appends the name of the monitored file as part of the record. The value assigned becomes the key in the map. | string |
| excludePath | Set one or multiple shell patterns separated by commas to exclude files matching a certain criteria, e.g: exclude_path=*.gz,*.zip | string |
| offsetKey | If enabled, Fluent Bit appends the offset of the current monitored file as part of the record. The value assigned becomes the key in the map | string |
| readFromHead | For new discovered files on start (without a database offset/position), read the content from the head of the file, not tail. | *bool |
| refreshIntervalSeconds | The interval of refreshing the list of watched files in seconds. | *int64 |
| rotateWaitSeconds | Specify the number of extra time in seconds to monitor a file once is rotated in case some pending data is flushed. | *int64 |
Expand Down
5 changes: 5 additions & 0 deletions manifests/setup/fluent-operator-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2877,6 +2877,11 @@ spec:
This will help to reassembly multiline messages originally split by Docker or CRI
Specify one or Multiline Parser definition to apply to the content.
type: string
offsetKey:
description: |-
If enabled, Fluent Bit appends the offset of the current monitored file as part of the record.
The value assigned becomes the key in the map
type: string
parser:
description: Specify the name of a parser to interpret the entry
as a structured message.
Expand Down
5 changes: 5 additions & 0 deletions manifests/setup/setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2877,6 +2877,11 @@ spec:
This will help to reassembly multiline messages originally split by Docker or CRI
Specify one or Multiline Parser definition to apply to the content.
type: string
offsetKey:
description: |-
If enabled, Fluent Bit appends the offset of the current monitored file as part of the record.
The value assigned becomes the key in the map
type: string
parser:
description: Specify the name of a parser to interpret the entry
as a structured message.
Expand Down
Loading