# Weird multiplication error in Logstash

**URL:** <https://discuss.elastic.co/t/weird-multiplication-error-in-logstash/159763>\
**Category:** Logstash\
**Created:** [December 6, 2018, 4:21pm UTC](https://discuss.elastic.co/t/weird-multiplication-error-in-logstash/159763 "2018-12-06T16:21:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Harshet\_Jain](https://avatars.discourse-cdn.com/v4/letter/h/dc4da7/32.png) [@Harshet\_Jain](https://discuss.elastic.co/u/Harshet_Jain)\
**Post date:** [December 6, 2018, 4:21pm UTC](https://discuss.elastic.co/t/weird-multiplication-error-in-logstash/159763/1 "2018-12-06T16:21:46Z")

</div>

I want to convert currency (to indian rupees) from USD or EUR.

I am using the following code in Ruby

```
  if [Currency] == "EUR" or [Currency] == "USD" {
      ruby {
          id => "addingCurrencyValue"
          code =>
          '
            event.set("[currencyMultiple]", 80) if event.get("[Currency]") == "EUR"
            event.set("[currencyMultiple]", 70) if event.get("[Currency]") == "USD"
          '
      }
    }
  if [currencyMultiple] {
      ruby {
          id => "currencyConverter"
          code =>
          '
            event.set("[currencyConvertedValue]", (event.get("[Unit_Sold_Value]")*event.get("[currencyMultiple]")))
            event.set("[Value]", event.get("[currencyConvertedValue]"))
          '
      }
    }
}

```

The response in STDOUT is very weird and I cannot find any reference.

```
{
         "@timestamp" => 2018-12-06T16:17:50.911Z,
            "message" => "﻿Currency,Unit_Sold_Value\r\n",
           "@version" => "1",
           "Currency" => "﻿Currency",
    "Unit_Sold_Value" => "Unit_Sold_Value"
}
{
                     "Value" => "100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100",
                  "@version" => "1",
                  "Currency" => "EUR",
    "currencyConvertedValue" => "100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100",
                "@timestamp" => 2018-12-06T16:17:50.946Z,
                   "message" => "EUR,100",
          "currencyMultiple" => 80,
           "Unit_Sold_Value" => "100"
}
{
                     "Value" => "10101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010",
                  "@version" => "1",
                  "Currency" => "USD",
    "currencyConvertedValue" => "10101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010",
                "@timestamp" => 2018-12-06T16:17:50.946Z,
                   "message" => "USD,10\r\n",
          "currencyMultiple" => 70,
           "Unit_Sold_Value" => "10"

```

> My csv file only has two rows and columns:  
> Currency: EUR (or USD)  
> Unti\_Sold\_value: 100 (or 10)

---

<div class="post-metadata">

**Author:** ![Harshet\_Jain](https://avatars.discourse-cdn.com/v4/letter/h/dc4da7/32.png) [@Harshet\_Jain](https://discuss.elastic.co/u/Harshet_Jain)\
**Post date:** [December 8, 2018, 9:40am UTC](https://discuss.elastic.co/t/weird-multiplication-error-in-logstash/159763/2 "2018-12-08T09:40:21Z")

</div>

Can anyone help me with this error?

---

<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:** [January 5, 2019, 9:40am UTC](https://discuss.elastic.co/t/weird-multiplication-error-in-logstash/159763/3 "2019-01-05T09:40:28Z")

</div>

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