Currency Conversion from Logstash JDBC Input - SOLVED

Hi All,

I have a purchase data store which has data in multiple currencies.
The data is stored in multiple fields such as Purchase Amount, Discount Amount, Tax Amount and then a different field called currency which is the ISO value e.g. USD, GBP etc.

We have an existing ERP system which provides values of the GBP to USD exchange rates fed from our banking partner each day.

In logstash what would the best way to achieve doing this conversion? Appreciate if an example could be provided.

Assume inputs look like this:
Purchase Data:

Product Code, Purchase Price, Discount Amount, Tax Amount, Total amount, Currency, Date
MOVIE, 1.99, 0.00,0.00,1.99,GBP,2016-03-01
MOVIE, 1.99, 0.00,0.00,1.99,USD,2016-03-02

Currency Conversion Table:
Date, From Currency,To Currency,Unit,Rate
2016-03-01,GBP,USD,1,0.679
2016-03-01,VND,USD,1,20000

Note the purchase date and Currency Tables are stored in two different entities (e.g. DB's)

You can use the translate filter to look up a currency name in a YAML file and store the exchange rate in another field. You'll probably have to use a ruby filter to perform the necessary computations once you have the rate.

1 Like

Magnus thanks for the quick reply as always :slight_smile: