Skip to content

Remove tag consideration from Fluentd ClusterFilter / Filter order #1832

@ben-dov

Description

@ben-dov

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

The filter order logic in fluentd ever since #1106 can be seen here.
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions