Ruby time.strftime logstash

Hi

I want to convert hour to number , hour is extracted from timestamp as below in logstash:

ruby { code => "event.set('[hour]',event.get('Activity-Time-New').time.strftime('%k') )" }

In Kibana i want #hour ,a number data type instead of string, in kibana i get it as a string

I tried mutate convert but its not working please guide how can i convert hour to number# in kibana

Regards

You would use

mutate { convert => { "hour" => "integer" } }

However, if you have already indexed documents where [hour] was a string, then elasticsearch will convert the integer to a string as it indexes new documents. You will need to index the documents into a new index.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.