fluent / fluent/fluent-operator

Remove tag consideration from Fluentd ClusterFilter / Filter order

Open
#1,832 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
682
Forks
328
Avg merge
2d 23h
Merged PRs (30d)
13

Description

### Is your feature request related to a problem? Please describe.

The filter order logic in fluentd ever since https://github.com/fluent/fluent-operator/pull/1106 can be seen [here](https://github.com/fluent/fluent-operator/blob/master/apis/fluentd/v1alpha1/plugins/params/model.go#L246).
Specifically in:
```
func (a PluginStoreByNameById) Less(i, j int) bool {
if a[i].Name == a[j].Name {
if a[i].GetTag() == "**" && a[j].GetTag() != "**" {
return false
}
if a[i].GetTag() != "**" && a[j].GetTag() == "**" {
return true
}
return a[i].GetId() < a[j].GetId()
} else {
return a[i].Name < a[j].Name
}
}
```
From reading the code, it seems filters with tag `**` will be order last no matter the id (which matches my experience).
My argument is that the current ordering is problematic and unintuitive.

### Describe the solution you'd like

The more initiative ordering, is to consider the filter k8s name, and then if a ClusterFilter / Filter contains a list of several filters, it should add them in order.
This seems to already happen inside `return a[i].GetId() < a[j].GetId()`, so the only thing left is to remove the `GetTag` section.

I understand that this is a breaking change, but the current ordering prevent having `**` in as a middle filter, which is useful.
I think this should either be a breaking change in version v4, or add a parameter for the deployment to disable tag ordering.

### Workaround

Using `customPlugin` with some placeholder tag, and then setting the filter to `**` in the config section.

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.