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

add multiline filter plugin #176

Merged
merged 1 commit into from Dec 1, 2021
Merged

add multiline filter plugin #176

merged 1 commit into from Dec 1, 2021

Conversation

wenchajun
Copy link
Member

@wenchajun wenchajun commented Nov 29, 2021

What this PR dose?

Adds support for https://docs.fluentbit.io/manual/pipeline/filters/multiline-stacktrace filter plugin

Why we need it?

Fluentbit supports a variety of plug-ins, but not all fluentbit-operator adaptations. More plug-ins will be supported in the future, see the fields supported by the multiline plug-in

Field Description Scheme Default
multiline.parser Specify one or multiple Multiline Parser definitions to apply to the content. You can specify multiple multiline parsers to detect different formats by separating them with a comma. string
multiline.key_content Key name that holds the content to process. Note that a Multiline Parser definition can already specify the key_content to use, but this option allows to overwrite that value for the purpose of the filter. string

The final results

The configuration is written to secret

1638264094(1)

1638258948(1)

Signed-off-by: chengdehao <dehaocheng@yunify.com

// The Multiline Filter helps to concatenate messages that originally belong to one context but were split across multiple records or log lines.
type Multiline struct {
// The Multi struct helps to concatenate messages that originally belong to one context but were split across multiple records or log lines.
Multi *Multi `json:"multiline,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of multi?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because its arguments are multiline.parser and multiline.key_content. So I created a structure so that I could add new parameters.

Copy link
Collaborator

@wanjunlei wanjunlei Nov 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mutil is not optional, the omitempty should be deleted.
Maybe inline is more suitable for multi?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I am not clear about it. I mean Mutil should be inline type.

type Multiline struct {
  *Multi `json:",inline"`
}


func (m *Multiline) Params(_ plugins.SecretLoader) (*params.KVs, error) {
kvs := params.NewKVs()
if m.Multi.KeyContent != "" {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It needs to determine whether the mutil is empty here.

type Multi struct {
// Specify one or multiple Multiline Parsing definitions to apply to the content.
//You can specify multiple multiline parsers to detect different formats by separating them with a comma.
Parser string `json:"parser,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parser is not optional, the omitempty should be deleted.

// The Multiline Filter helps to concatenate messages that originally belong to one context but were split across multiple records or log lines.
type Multiline struct {
// The Multi struct helps to concatenate messages that originally belong to one context but were split across multiple records or log lines.
Multi *Multi `json:"multiline,omitempty"`
Copy link
Collaborator

@wanjunlei wanjunlei Nov 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mutil is not optional, the omitempty should be deleted.
Maybe inline is more suitable for multi?

Signed-off-by: chengdehao <dehaocheng@yunify.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants