fluent-bit icon indicating copy to clipboard operation
fluent-bit copied to clipboard

rewrite_tag "could not compose tag" with dash in tag name

Open etesyolk80 opened this issue 2 years ago • 4 comments

Bug Report

Describe the bug I have been trying to utilize tags to send the logs to the files equal to the new tag and used the dash for the file name Unfortunately received the below error:

[error] [record accessor] syntax error, unexpected '$', expecting $end at '$ct-$zhenya' [error] [filter:rewrite_tag:rewrite_tag.0] could not compose tag: $ct-$zhenya.log [error] Failed initialize filter rewrite_tag.0 [error] [engine] filter initialization failed [error] [lib] backend failed

Expected behavior no error when rewriting tag contains dahes

Your Environment Configuration used:

[INPUT]
    NAME   dummy
    Dummy  {"ts": "zhenya", "ct": "zhenya", "zhenya": "tesyolkin"}
    Tag    test_tag

[FILTER]
    Name          rewrite_tag
    Match         test_tag
    Rule          $ts ^(zhenya)$  $ct-$zhenya.log false
    Emitter_Name  re_emitted


[OUTPUT]
    name  file
    match *
    Path  /root/zhenya
  • Version used: 2.2.0
  • Operating System and version: Ubuntu 20.04

etesyolk80 avatar Nov 20 '23 17:11 etesyolk80

I think this has been a restriction for a while, my guess is you want the tag to specify the filename and it must have a dash in it?

A workaround would be to just create a separate key first (e.g. with LUA) with the value including the dash then specify that key directly (no need for dash now) and optionally drop the key afterwards.

patrick-stephens avatar Nov 21 '23 11:11 patrick-stephens

I think this has been a restriction for a while, my guess is you want the tag to specify the filename and it must have a dash in it?

A workaround would be to just create a separate key first (e.g. with LUA) with the value including the dash then specify that key directly (no need for dash now) and optionally drop the key afterwards.

Yes, exactly. My filename should contain a dash. It's weird that I can use a "." or even "," , but not the "-" (it should be supported by the docs ) Was able to implement it with LUA, thanks.

etesyolk80 avatar Nov 21 '23 13:11 etesyolk80

It would be good if you could submit a docs PR to help others: https://github.com/fluent/fluent-bit-docs/blob/master/pipeline/filters/rewrite-tag.md

I'm not sure if this is a limitation of the record-accessor syntax or just specific to this particular plugin.

patrick-stephens avatar Nov 21 '23 14:11 patrick-stephens

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[bot] avatar Feb 21 '24 01:02 github-actions[bot]

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

github-actions[bot] avatar Feb 27 '24 01:02 github-actions[bot]