# Currency Conversion from Logstash JDBC Input - SOLVED

**URL:** <https://discuss.elastic.co/t/currency-conversion-from-logstash-jdbc-input-solved/47117>\
**Category:** Logstash\
**Created:** [April 12, 2016, 12:47pm UTC](https://discuss.elastic.co/t/currency-conversion-from-logstash-jdbc-input-solved/47117 "2016-04-12T12:47:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wayne\_Taylor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wayne_taylor/32/45984_2.png) [@Wayne\_Taylor](https://discuss.elastic.co/u/Wayne_Taylor)\
**Post date:** [April 12, 2016, 12:47pm UTC](https://discuss.elastic.co/t/currency-conversion-from-logstash-jdbc-input-solved/47117/1 "2016-04-12T12:47:06Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [April 12, 2016, 12:51pm UTC](https://discuss.elastic.co/t/currency-conversion-from-logstash-jdbc-input-solved/47117/2 "2016-04-12T12:51:06Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Wayne\_Taylor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wayne_taylor/32/45984_2.png) [@Wayne\_Taylor](https://discuss.elastic.co/u/Wayne_Taylor)\
**Post date:** [April 12, 2016, 12:59pm UTC](https://discuss.elastic.co/t/currency-conversion-from-logstash-jdbc-input-solved/47117/3 "2016-04-12T12:59:34Z")

</div>

Magnus thanks for the quick reply as always 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 5:02am UTC](https://discuss.elastic.co/t/currency-conversion-from-logstash-jdbc-input-solved/47117/4 "2017-07-06T05:02:46Z")

</div>

Closed on July 6, 2017, 5:02am UTC


