Convert a field string to time


(Vivek Nigam) #1

Hi,

my string value is like 03:40:15 , want to convert it to time field without date.

can i do it??


#2

I think date fields need the actual date as well as time or else they wouldn't be able to be plotted on a chart or understood very well. I would say a workaround to this would be to add a date to it like 1970-01-01.


(Magnus Bäck) #3

The ES date type represents an absolute time so just omitting the date won't work. If you describe what you want to accomplish with a time-only field maybe we can make a suggestion.


(Vivek Nigam) #4

Hi,

I have a process, where i want to show total time taken to complete the process like 03:34:25 without date.i take it to string value, but in kibana i cannot show string value in Y Axis.

can i take value 03:34:25 as integer, i try but it store only first value:03, even cannot store value as float. same situation.


(Magnus Bäck) #5

How long something has taken isn't a time, it's a duration. You'll want to store that data as an integer (representing the number of seconds or milliseconds). I don't think there's an out of the box plugin for doing this so you'll have to write a piece of Ruby code in a ruby filter.


(system) #6

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