Skip to content

Add a time object in the fluentd event #63

Open

Description

@frsh-augustin

Hi,

I'd like to add time filed in the event, the following example appears to add a string type "formatted_time", but I need a time type field.

<filter pattern>
  @type record_modifier
  <record>
    formatted_time ${Time.at(time).to_s}
  </record>
</filter>

I try the following way

<filter pattern>
  @type record_modifier
  <record>
    formatted_time ${time}
  </record>
</filter>

But I got the following errors:

2021-11-10 06:24:28.085795373 +0000 fluent.warn: {"error":"#<NoMethodError: undefined method `to_msgpack' for 2021-11-10 06:24:28 +0000:Time>","location":"/opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/event.rb:60:in `write'","tag":"iam.gu.cn.admin_api","message":"emit transaction failed: error_class=NoMethodError error=\"undefined method `to_msgpack' for 2021-11-10 06:24:28 +0000:Time\" location=\"/opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/event.rb:60:in `write'\" tag=\"iam.gu.cn.admin_api\""}

Please advise is it feasible to add a time type filed in the fluentd event? Thank you in adance.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions