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

if record is string. How to deal with it? #1279

Closed
orangemi opened this issue Oct 17, 2016 · 4 comments
Closed

if record is string. How to deal with it? #1279

orangemi opened this issue Oct 17, 2016 · 4 comments

Comments

@orangemi
Copy link

  • fluentd v0.3.1
  • docker.io/fluent/fluentd

I see the fluentd docs talking based on the record is a hash record. What if a record is a string record? Is there a way to convert it? #591 mentioned it but no description how to deal with it.

I tried to use transformer filter to convert like this but failed:

    <filter core.**>
      @type record_transformer
      enable_ruby
      <record>
        message ${record}
      </record>
    </filter>

Output:

  failed to reform records error_class=NoMethodError error="undefined method `merge!' for \"[2016-10-17T04:30:21.573Z] INFO {\\\"1\\\":234,\\\"abc\\\":\\\"abc\\\"}\":String"

I tried record.to_str but the same error.

I also tried to use filter_parser like this(configure errored if I wont add key_name):

    <filter core.**>
      @type parser
      format /^(?<message>.*)$/
      key_name record
    </filter>

Output:

2016-10-17 05:18:16 +0000 [warn]: record does not exist

I don't want to add format to in_forward because there are lots of sources use this port.

@repeatedly
Copy link
Member

No way. Fluentd can't handle string type record.
Senders, e.g. fluent-logger, and input plugins must emit a record as a Hash.

@repeatedly
Copy link
Member

repeatedly commented Oct 17, 2016

Do senders or plugins emit string type record?

@orangemi
Copy link
Author

Thank you for your quick reply. I will make a new PR to fluent/fluent-logger-node.

@repeatedly
Copy link
Member

Ah, okay.

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

No branches or pull requests

2 participants