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_record_transformer does not support UTF-8 string in fluent.conf #1590

Closed
okkez opened this issue Jun 5, 2017 · 4 comments
Closed
Labels
bug Something isn't working v0.14

Comments

@okkez
Copy link
Contributor

okkez commented Jun 5, 2017

  • fluentd v0.14.17 and master HEAD
  • Debian GNU/Linux and Ruby 2.4.1

See also y-ken/fluent-plugin-twilio#8 (comment) and following comments in the PR.

How to reproduce

<source>
  @type forward
  @label @NOTIFY
</source>

<label @NOTIFY>
  <filter>
    @type record_transformer
    <record>
      message こんにちは. ${record["name"]} has made a order of ${record["item"]} just now.
    </record>
  </filter>
  <match dummy.log>
    @type stdout
  </match>
</label>

and run following command.

$ echo '{"name": "太郎", "message": "ほげほげ", "item": "寿司" }' | env LANG=C bundle exec fluent-cat dummy.log

And got following error:

2017-06-05 12:14:33 +0900 [warn]: #0 dump an error event: error_class=Encoding::CompatibilityError error="incompatible character encodings: ASCII-8BIT and UTF-8" tag="dummy.log" time=#<Fluent::EventTime:0x0055965471a558 @sec=1496632473, @nsec=421845491> record={"name"=>"\u592A\u90CE", "message"=>"\u307B\u3052\u307B\u3052", "item"=>"\u5BFF\u53F8"}

My investigation

This line does not consider encoding.

Solution A

Fluentd reads fluent.conf as UTF-8.
On the other hand, other files should be treated as ASCII-8BIT I think.

  • Pros
    • We don't need to fix filter_record_transformer
    • We don't need to fix other plugins for same issue
  • Cons
    • Probably there is large side effect

Solution B

Fix filter_record_transformer to consider encoding.

  • Pros
    • No side effect
  • Cons
    • We need to fix other plugins in near future
@y-ken
Copy link
Member

y-ken commented Jun 5, 2017

Another users has faced to related encoding problem with some plugins.

@repeatedly
Copy link
Member

It works with 0.12.
So v0.14 breaks the compatibility and it should be fixed.
@okkez Could you write a patch?

@repeatedly repeatedly added bug Something isn't working v0.14 labels Jun 6, 2017
@okkez
Copy link
Contributor Author

okkez commented Jun 7, 2017

OK, I will create patch according to solution A.

okkez added a commit to okkez/fluentd that referenced this issue Jun 7, 2017
Fluentd assumes configuration file encoding is UTF-8.

Fix fluent#1590
@y-ken
Copy link
Member

y-ken commented Jun 12, 2017

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working v0.14
Projects
None yet
Development

No branches or pull requests

3 participants