DateTime in Human Readable format Kibana

Hi Team,

I was trying to create a metric visualization to show when was the last time server health is checked
Max(DateTime) really doesnot make more sense to user,so i created the scripted field "LastCheckInHumanReadableFormat" with the following configuration and use this scripted field to create visualization.

This visualization always says "51Years" but the expected value should be 10 days i have the data of only Nov 25th

What's going wrong here?

Thanks in Advance
Ramya

Hi,

My guess is the following: Your field LastCheck contains a Date and Java returns the milliseconds since 01.01.1970 for this as this is the way the Date class stores it internally. Therefore, you receive 51 years which would be correct.

What you want is to calculate the time difference between now and the LastCheck and to return this in a human readable form.

Best regards
Wolfram

1 Like

@Wolfram_Haussig , Your Awesome!!

It worked ,many thanks for your reply :grinning:

image

Others, if you need this as reference

Thanks,
Ramya

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