英文:
Fluentbit Regex support in Match for Filter plugins
问题
- 它只支持基本的通配符支持还是完整的正则表达式支持?
 - 在节流插件中是否有办法实现我正在尝试做的事情?
 
英文:
I have a basic question about the usage of Match for Filter plugins.
I saw that Match supports wildcard, based on https://docs.fluentbit.io/manual/concepts/data-pipeline/router
Is it only basic wildcard support or complete regex support?
My typical tags look like part1.part2.part3.part4
This is my current configuration and it works as expected (i.e. logs that match these tags are getting throttled).
    [FILTER]
        Name                      throttle
        Match                     part1.*.*.part4
        Rate                      1
        Window                    300
        Interval                  1s
I tried to modify this so that this filter is not applied if part2=xyz
    [FILTER]
        Name                      throttle
        Match                     part1.(?!xyz).*.part4
        Rate                      1
        Window                    300
        Interval                  1s
But looks like this isn't working (i.e. none of the logs are getting throttled)
My questions:
- Does it only support basic wildcard support or has complete regex support?
 - Is there a way to do what I am trying to do in the throttle plugin?
 
答案1
得分: 0
发现答案
TIL:有一个名为Match_Regex的关键字,它可以在所有可以使用Match的地方使用。
Match仅支持*作为通配符。
Match_Regex支持完整的正则表达式。
来源:https://docs.fluentbit.io/manual/v/1.3/configuration/file
我的修改后的配置
[FILTER]
    Name                      throttle
    Match_Regex               part1.(?!xyz).*.part4
    Rate                      1
    Window                    300
    Interval                  1s
感谢Anurag Gupta在Fluentbit Slack中指出这一点。
英文:
Found the answer
TIL: there is a key named Match_Regex and it works in all the places where Match can be used.
Match only support * as a wildcard
Match_Regex supports whole regex
Source: https://docs.fluentbit.io/manual/v/1.3/configuration/file
My modified config
    [FILTER]
        Name                      throttle
        Match_Regex               part1.(?!xyz).*.part4
        Rate                      1
        Window                    300
        Interval                  1s
Thanks to Anurag Gupta for pointing to this in Fluentbit slack.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论