Hi, I want a fluentbit filter that would drop only...
# fluent-bit
d
Hi, I want a fluentbit filter that would drop only INFO level records that contains keyword "healthcheck" (will apply regex here). Appreciate the help! Sample log
Copy code
{
  "@timestamp": "2025-10-08T17:47:06.0808Z",
  "level": "DEBUG",
  "message": "healthcheck"
}
{
  "@timestamp": "2025-10-08T17:47:07.1234Z",
  "level": "INFO",
  "message": "healthcheck Application started successfully"
}
{
  "@timestamp": "2025-10-08T17:47:07.1234Z",
  "level": "INFO",
  "message": "health-check test Application started successfully"
}
Expected Output
Copy code
[0] tail.0: [1760122642.884274043, {"log"=>"{"}]
[1] tail.0: [1760122642.885037709, {"log"=>"  "@timestamp": "2025-10-08T17:47:06.0808Z","}]
[2] tail.0: [1760122642.885040918, {"log"=>"  "level": "DEBUG","}]
[3] tail.0: [1760122642.885042001, {"log"=>"  "message": "healthcheck""}]
fluent-bit.conf
Copy code
[INPUT]
    Name            tail
    Path            /fluent-bit/etc/log
    Inotify_Watcher false
    Read_from_Head  True

[FILTER]
    Name   grep
    Match  *
    Regex  level  ^INFO$

[FILTER]
    Name    grep
    Match   *
    Exclude message (?i)(healthcheck)

[OUTPUT]
    Name    stdout
    Match   *
p
I think you want the multiple conditions option. https://docs.fluentbit.io/manual/data-pipeline/filters/grep
You want to only exclude messages that are info and healthcheck, all others are ok
✅ 1
d
@Pat yes that's correct! I want to only exclude logs that has level info and message contains keyword "*healthcheck*". I tried grep filter but that did not worked. Would you have any other suggestions? Thanks for your help.
Copy code
[FILTER]
    Name   grep
    Match  *
    Regex  level  ^INFO$

[FILTER]
    Name    grep
    Match   *
    Exclude message (?i)(healthcheck)
p
did you try the multiple conditions as I say, that's what you want
d
yup, the below config did not worked either.
Copy code
[FILTER]
    Name            grep
    Alias           ignore-healthchecks
    Match           *
    Logical_Op      and
    Exclude         level (?i)(info)
    Exclude         message (?i)(healthcheck)