Cents to notes

Hi,

My log analytics reads amount data in cents. I would like the kibana change that into notes when displaying the field. (E.g. 1000 cents to 10)

Any formatter for that or any way of achieving this?

Another problem I also want to mention here is (sort of another related question) that my data comes from different countries with different currency. Anyway I can convert the data to one currency for displaying in kibana?

Thanks!

Hey Nathan,

I thought field formatters might help you here. But I am not sure if they can stretch it all the way.

https://www.elastic.co/guide/en/kibana/current/managing-fields.html

You can see if scripted fields can help you with it?

https://www.elastic.co/guide/en/kibana/current/scripted-fields.html

Thanks,
Bhavya

Thanks bhavyarm, i used the following script for converting cents to notes, and it worked:
{
"script" : {
"inline" : "doc['amount-cents'].value / 100",
"lang" : "painless"
}
}

But not sure how to handle the currency issue yet; as the the exchange rate fluctuate. I want everything to show in Swedish Krone while i have clients from Euro countries.

Are you looking for the conversion to be done based on when the document is indexed, or do you want a live conversion based on the current exchange rate, no matter what that is?

Doing this at index time is more performant, as you only have to do the calculation once. The downside there is that you don't get live exchange rates, so if you want to display up-to-date conversions, it wouldn't be possible with this approach. If this is acceptable, I'd suggest using Logstash to accomplish this. You could potentially integrate with a conversion service using the http filter.

If you need live exchange rates, then I don't have any great suggestions for you. The only idea that comes to mind is to create a custom visualization type which performs this conversion on the fly.

Thanks Larry_Gregory; I think the former approach will be suffice for now; which means at index time.

Best,

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