0

I want to change time to system and utc of given log

{"host":"sp-1","level":"INFO","log":{"classname":"common.server.hacluster.CSFHATopologyChangeHandlerMBean:93","message":"Finished processing CSF HA 'become standby' message.","stacktrace":"","threadname":"RMI TCP Connection(1784)-192.168.20.11"},"process":"becomeStandby","service":"SP","time":"2020-03-19T10:15:36.514Z","timezone":"America/Toronto","type":"log","system":"SP_IG_20_3_R1_I2002","systemid":"SP_IG_20_3_R1_I2002"}

<filter com.logging.tmplog>
  @type record_modifier
  <record>
  type log
  time ${record["time"]}.to_time.utc
  arun ${tag}
  </record>
</filter>

But it didn't workout

{"host":"sp-1","level":"INFO","log":{"classname":"com.alcatel.tpapps.common.server.hacluster.CSFHATopologyChangeHandlerMBean:93","message":"Finished processing CSF HA 'become standby' message.","stacktrace":"","threadname":"RMI TCP Connection(1784)-192.168.20.11"},"process":"becomeStandby","service":"SP","time":"2020-03-19T10:15:36.514Z.to_time.utc","timezone":"America/Toronto","type":"log","system":"SP_IG_20_3_R1_I2002","systemid":"SP_IG_20_3_R1_I2002","arun":"com.logging.tmplog"}

Also, i want to convert time to System time? What can be correct?

arun kushwaha
  • 36
  • 1
  • 6
  • I have never used fluentd but it looks like your `.to_time.utc` is outside of the `${ }` interpolation brackets so that unevaluated code is showing up verbatim in the result. – max pleaner Mar 19 '20 at 20:31
  • Please do not duplicate your questions. This is a subset of your question asked about an hour later. – the Tin Man Mar 19 '20 at 22:05
  • @theTinMan I think both are different. In this it's conversion to utc or system. While the other question is to get value through external command and capture that value to use in other plugin – arun kushwaha Mar 20 '20 at 04:44
  • I solved it myself. Just use `time ${Time.at(time).utc.iso8601}` – arun kushwaha Mar 26 '20 at 05:58

0 Answers0