I do not get subtract dates and ruby logstash

Hello,

I'm trying to subtract two dates ISO 8601 type, to extract an XML plugin through the ruby. The goal is to get the difference in the form of an integer with which to operate later.

I am using the latest version of logstash, 2.2.2.

I tried several examples, but without success. This is the example that I think is the one that should work.

Example:

ruby {code => "event['time_difference'] = Time.parse(DateTime.Parse('t_fin_etapa01')).to_i - Time.parse(DateTime.Parse('t_inicio_etapa01')).to_i"}

Result:

? [31mRuby exception occurred: undefined method `gsub '! for # <DateTime: 0x441d4c76> {: level =>: error} ? [0m

Any idea what I'm doing wrong?

Thanks in advance,

Regards!

At the end I resolved the problem by sending the information dates to a temporary index elasticsearch and processing them through a Java app (via the java API ) to generate a final index with subtraction of two dates in milliseconds .

Solve the problem, but really is not an optimal solution .

Someone knows another more direct way to do subtractions between dates come within an index ?