fluent / fluent-bit

Fast and Lightweight Logs and Metrics processor for Linux, BSD, OSX and Windows
https://fluentbit.io
Apache License 2.0
5.86k stars 1.58k forks source link

Modify Tag in Lua Filter #1411

Open mitchellmaler opened 5 years ago

mitchellmaler commented 5 years ago

Describe the solution you'd like Currently there is no way to modify an existing tag. If the lua filter allowed you to return the tag that if modified based on logic it would fix our problem. You could create a new tag using a stream but we already use lua for a bunch of other logic and would be nice to allow it there as well to give options.

Describe alternatives you've considered Create a new steam based on a where clause to tag logs differently based on a field.

scuzhanglei commented 5 years ago

hi, @mitchellmaler , we have same problem. I have a test. log. want to route different output according log line .

Example

test.log

this line want to output stdout
this line want to output  http

fluent-bit.conf

[INPUT]
   Name  tail
   path  test.log

[OUTPUT]
   Name  stdout

[OUTPUT]
   Name http

there is only one INPUT, and want to route line1 and line 2 to different output.

We can avoid this problem by set two INPUT with Tag different only. but this is not elegant at all

edsiper commented 5 years ago

this is a work in process feature, no fixed ETA

scuzhanglei commented 5 years ago

this is a work in process feature, no fixed ETA

@edsiper I use stream processor for a workarround, looks good.

artheus commented 2 years ago

this is a work in process feature, no fixed ETA

@edsiper I use stream processor for a workarround, looks good.

I would really like some more explanation to what, and how, you are doing this. We are currently working on setting up Fluent Bit, at work, and we want to set tags depending on log message format. Is Stream Processors something that could solve that for us?

kevincua-umbocv commented 3 months ago

this is a work in process feature, no fixed ETA

@edsiper I use stream processor for a workarround, looks good.

I would really like some more explanation to what, and how, you are doing this. We are currently working on setting up Fluent Bit, at work, and we want to set tags depending on log message format. Is Stream Processors something that could solve that for us?

i was able to to this by mixing lua filter (creating a new field) for the tag -> rewrite_tag (using new field) -> record_modifier to remove that field

arunim2405 commented 3 months ago

this is a work in process feature, no fixed ETA

@edsiper I use stream processor for a workarround, looks good.

I would really like some more explanation to what, and how, you are doing this. We are currently working on setting up Fluent Bit, at work, and we want to set tags depending on log message format. Is Stream Processors something that could solve that for us?

i was able to to this by mixing lua filter (creating a new field) for the tag -> rewrite_tag (using new field) -> record_modifier to remove that field

Can you please share the example