Hot to add timestamp to fluent.** record?

  • fluent.conf
   <filter fluent.*>
      @type record_transformer
      <record>
        host "#{Socket.gethostname}"
      </record>
    </filter>

    # istio-proxy
    <source>
      @type tail
      path /var/log/containers/*istio-proxy*.log
      pos_file /var/log/istio-proxy.log.pos
      tag istio-proxy.*
      read_from_head true
      <parse>
        @type json
        time_format %Y-%m-%dT%H:%M:%S.%NZ
      </parse>
    </source>

    # add topic field
    <filter **>
      @type record_transformer
      <record>
        tag ${tag}
        topic ${tag_parts[0]}-test
      </record>
    </filter>

    # add kubernetes metadata
    <filter **>
      @type kubernetes_metadata
    </filter>

    # output to kafka
    <match **>
      @type kafka
      @log_level info
      brokers *******:9092,*******:9092
      required_acks -1
      compression_codec gzip
    </match>

fluentd stdout

k logs -f  -n logging fluentd-dzzw7
2021-03-09 08:53:39 +0000 [info]: #0 disable filter chain optimization because [Fluent::Plugin::RecordTransformerFilter, Fluent::Plugin::KubernetesMetadataFilter] uses `#filter_stream` method.

but in kafka

kafka-console-consumer.sh --bootstrap-server *******:9092 --topic fluent-test
{"message":"disable filter chain optimization because [Fluent::Plugin::RecordTransformerFilter, Fluent::Plugin::KubernetesMetadataFilter] uses `#filter_stream` method.","host":"fluentd-dzzw7","tag":"fluent.info","topic":"fluent-test"}

Why record not included “time” field in kafka?
Thanks!

Did you enable output_include_time in <match **>?

ref. GitHub - fluent/fluent-plugin-kafka: Kafka input and output plugin for Fluentd