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

Filter on systemd not working #7234

Closed
rucciva opened this issue Apr 20, 2023 · 6 comments
Closed

Filter on systemd not working #7234

rucciva opened this issue Apr 20, 2023 · 6 comments

Comments

@rucciva
Copy link

rucciva commented Apr 20, 2023

Bug Report

Filter section is not executed when using systemd

To Reproduce

  • create config that use rewrite tag to change systemd tag
[Input]
    Name    systemd
    Tag    systemd.*
    Systemd_Filter    _SYSTEMD_UNIT=containerd.service
    Systemd_Filter    _SYSTEMD_UNIT=kubelet.service
[Filter]
    Name    rewrite_tag
    Match    systemd.*
    Rule    $log (.+) loki.$TAG false
    Emitter_Name    systemd_loki
[OUTPUT]
    Name   stdout
    Match  systemd.*
  • run fluentbit with said config

Expected behavior
No output are generated since the filter is executed and the tag is rewritten

Screenshots

Screen Shot 2023-04-20 at 22 30 27

Your Environment

  • Version used: 2.0.11
  • Configuration: as above
  • Environment name and version (e.g. Kubernetes? What version?): kubernetes 1.23 with fluent operator 2.2
  • Server type and version:
  • Operating System and version: ubuntu 18.04
  • Filters and plugins: rewrite_tag and stdout

Additional context

If i change the config to this

[Input]
    Name    systemd
    Tag    systemd.*
    Systemd_Filter    _SYSTEMD_UNIT=containerd.service
    Systemd_Filter    _SYSTEMD_UNIT=kubelet.service
[Filter]
    Name    rewrite_tag
    Match    systemd.*
    Rule    $log (.+) loki.$TAG false
    Emitter_Name    systemd_loki
[OUTPUT]
    Name   stdout
    Match  loki.systemd.*

no output are displayed

@patrick-stephens
Copy link
Contributor

Your output is still matching the original input: rewrite tag creates effectively a duplicate stream of it, it does not stop the current tag at that point.

@rucciva
Copy link
Author

rucciva commented Apr 21, 2023

it does not stop the current tag at that point.

i specified keep as false (Rule $log (.+) loki.$TAG false) as noted in https://docs.fluentbit.io/manual/pipeline/filters/rewrite-tag#keep. Won't that make the original record dropped and doesn't continue in pipeline?

besides, using this output step didn't produce anything, which should output the same line if the filter match right?

[OUTPUT]
    Name   stdout
    Match  loki.systemd.*

@patrick-stephens
Copy link
Contributor

Ah yeah, my bad for skimming over it on mobile.

Does the example in the docs work?
https://docs.fluentbit.io/manual/pipeline/filters/rewrite-tag#configuration-example

@rucciva
Copy link
Author

rucciva commented Apr 21, 2023

yes the example works
Screen Shot 2023-04-21 at 17 30 42

@nokute78
Copy link
Collaborator

Could you try following Rule config ?

    Rule    $MESSAGE (.+) loki.$TAG false

Output of systemd plugin doesn't contain the key log.

@rucciva
Copy link
Author

rucciva commented Apr 23, 2023

ah i see, thanks @nokute78 , it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants