Convert millisecond epoch time to ISO human readable time


(Jeremy Mc Lain) #1

I have a field that is represented in milliseconds since epoch. I want to use this field as the x axis of a histogram bar chart but I want the dates to be human readable. See the screenshot of what it looks like now. What are some ways to do this?


(Bryan Vest) #2

It looks like you are storing the epoch as an integer. You have to specify something like this in your index mapping
"startTime": {
"format": "epoch_millis",
"type": "date"
}


(Jeremy Mc Lain) #3

@murlin99 Thanks. That makes sense. Unfortunately, I didn't create the original mapping. It's created by a third party plugin to Jenkins build server. I'm just getting familiar with Kibana. Is this something I should be able to do from the Management tab in Kibana? The type doesn't seem to be editable.

Is there a way to make a field that is derived from the startTime field with the appropriate type and format?


(Jeremy Mc Lain) #4

I was able to solve this using a scripted field. I understand that this isn't the most performant way to do it but it works. This is what I came up with for the scripted field:


(Bryan Vest) #5

That is exactly what I was going to suggest in that situation. I have had to use painless in a few area's one of them being the same issue you were dealing with.

Cool you got it working.


(system) #6

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