Transform to human readable values

alerting

(Dave Evans) #1

Is there a way in a transform to convert bytes to human readable format?

I know I can do a painless script to perform math on a byte value, but can I format to show MB or GB depending on size of the value?


(Alexander Reelsen) #2

Hey,

not really. Elasticsearch has a ByteSizeValue class, that is unfortunately not exposed in painless. if you are querying a monitoring API you can use the human parameter to get human readable values. Maybe that already helps.

If it's about documents, I would highly recommend doing this on indexing with an ingest processor (still you have to write the logic yourself). Here is some inspiration https://github.com/elastic/elasticsearch/blob/master/core/src/main/java/org/elasticsearch/common/unit/ByteSizeValue.java

--Alex


(Dave Evans) #3

Thank you. I'm reading from a metricbeat index. I can deal with just always converting to MB. Not really worth the effort to write something.


(system) #4

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