Convert seconds (float number) into a more legible datatype

Dear friends,

We have an ELK to get information about the use of one of our software applications.

We have a field for session duration which represent the duration (time) of a session in seconds. That is not very human-readable so I would like to change or convert it to something like "hh hours mm minutes ss seconds"

Can you tell me the way to do that?

Thanks in advance.

Regards

You might be able to do this with a scripted field, but I think it'd be tough.

Field formatters would probably also be able to do this, but they don't do time based formatters yet.

The easiest way is to do this in logstash.

-- Asaf.

Heh, yeah, a lot easier! :smiley:

Thank you all for your answer.

After reading them, I've changed my question to "how to do it in ElasticSearch?" :wink:

I've been looking for information about ElasticSearch datatypes but I haven't found any datatype related to time but dates, I mean I don't know hot to convert a float into a time expression (hh MM ss)

Thanks again.

I think you have to map your date as a date data type in ES:
https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-date-format.html

Once you have that, you can use date formatters in K4:
https://www.elastic.co/guide/en/kibana/current/managing-fields.html#_date_field_formatters

Thank you. My problem is that the field is not a date, it's the number of
seconds (it represents a session duration), so transforming the float
(seconds) data type to a time expression is not direct.

If I specify that field is a date in ElasticSearch, it will understand it
is a date represented in UTC float and that's not the case.

Am I right? or did not understand your answer?

Thanks again.

Oh, right - I misunderstood what you were trying to do :frowning:

Converting a float representing setting duration to a custom time display is not possible at the moment, but is a reasonable enhancement request. Would you mind filing an issue in Github, if it's important to you? https://github.com/elastic/kibana/issues

@pjvv1 - In Kibana 4.1 you have the ability to formal a number field into date format - check out this formatting options for additional info- https://adamwdraper.github.io/Numeral-js/

-- Asaf.

1 Like