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

Unconditional rewrite_tag regardless of record data #5846

Closed
ryan65 opened this issue Aug 7, 2022 · 3 comments
Closed

Unconditional rewrite_tag regardless of record data #5846

ryan65 opened this issue Aug 7, 2022 · 3 comments
Labels

Comments

@ryan65
Copy link

ryan65 commented Aug 7, 2022

Hi
I would like to unconditionally rewrite the tag , if it matches a certain value (or regex). for example below , if the Tag in the input was set to tag1 tag2 tag3 I would like to change it to Tag_General, I dont care about the actual record data.
Is there any existing way to do something like this .?
I tried using $TAG in the rule as the key and then use a regex , but caused seg fault.

I am looking for something like this.
[FILTER]
Name rewrite_tag
match_regex (tag1|tag2|tag3)
Rule [ignore] [ignore] Tag_General false
Emitter_Name re_emitted

@ryan65 ryan65 changed the title Unconditional rewrite_tag Unconditional rewrite_tag regardless of record data Aug 7, 2022
@nokute78
Copy link
Collaborator

A workaround is to use filter_lua.

$ ../bin/fluent-bit -c a.conf 
Fluent Bit v2.0.0
* Copyright (C) 2015-2022 The Fluent Bit Authors
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io

[2022/08/12 13:54:33] [ info] [fluent bit] version=2.0.0, commit=fc325524d5, pid=36618
[2022/08/12 13:54:33] [ info] [storage] version=1.2.0, type=memory-only, sync=normal, checksum=disabled, max_chunks_up=128
[2022/08/12 13:54:33] [ info] [cmetrics] version=0.3.5
[2022/08/12 13:54:33] [ info] [sp] stream processor started
[2022/08/12 13:54:33] [ info] [output:stdout:stdout.0] worker #0 started
[0] Tag_General: [1660280074.748267173, {"tag"=>"tag1", "test"=>"message1"}]
[1] Tag_General: [1660280074.748463153, {"tag"=>"tag2", "test"=>"message2"}]
[2] Tag_General: [1660280074.748533248, {"tag"=>"tag3", "test"=>"message3"}]
[INPUT]
    Name dummy
    tag tag1
    Dummy {"test":"message1"}

[INPUT]
    Name dummy
    tag tag2
    Dummy {"test":"message2"}

[INPUT]
    Name dummy
    tag tag3
    Dummy {"test":"message3"}

[FILTER]
    Name lua
    Match tag*
    script append_tag.lua
    call append_tag

[FILTER]
    Name rewrite_tag
    Match tag*
    Rule tag tag* Tag_General false

[OUTPUT]
    Name stdout
    Match *

The lua script is https://github.com/fluent/fluent-bit/blob/master/scripts/append_tag.lua

nokute78 added a commit to nokute78/fluent-bit that referenced this issue Aug 12, 2022
nokute78 added a commit to nokute78/fluent-bit that referenced this issue Aug 12, 2022
nokute78 added a commit to nokute78/fluent-bit that referenced this issue Aug 12, 2022
edsiper pushed a commit that referenced this issue Aug 15, 2022
edsiper pushed a commit that referenced this issue Aug 15, 2022
nokute78 added a commit to nokute78/fluent-bit that referenced this issue Aug 15, 2022
nokute78 added a commit to nokute78/fluent-bit that referenced this issue Aug 15, 2022
edsiper pushed a commit that referenced this issue Sep 27, 2022
edsiper pushed a commit that referenced this issue Sep 27, 2022
mgeriesa pushed a commit to mgeriesa/fluent-bit that referenced this issue Oct 25, 2022
mgeriesa pushed a commit to mgeriesa/fluent-bit that referenced this issue Oct 25, 2022
Signed-off-by: Takahiro Yamashita <[email protected]>
Signed-off-by: Manal Geries <[email protected]>
@github-actions
Copy link
Contributor

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days. Maintainers can add the exempt-stale label.

@github-actions github-actions bot added the Stale label Nov 11, 2022
@github-actions
Copy link
Contributor

This issue was closed because it has been stalled for 5 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants