# Logstash translate filter and converting integers to strings

**URL:** <https://discuss.elastic.co/t/logstash-translate-filter-and-converting-integers-to-strings/268803>\
**Category:** Logstash\
**Created:** [March 30, 2021, 2:31pm UTC](https://discuss.elastic.co/t/logstash-translate-filter-and-converting-integers-to-strings/268803 "2021-03-30T14:31:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![chapmantrain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chapmantrain/32/22646_2.png) [@chapmantrain](https://discuss.elastic.co/u/chapmantrain)\
**Post date:** [March 30, 2021, 2:31pm UTC](https://discuss.elastic.co/t/logstash-translate-filter-and-converting-integers-to-strings/268803/1 "2021-03-30T14:31:30Z")

</div>

I am on logstash 7.11. I need a translate from an integer code to real speed value.

```auto
	mutate {
		convert => { "ifspeed" => "string" }
	}
	translate {
		field => "[ifspeed]"
		destination => "[inf_speed]"
		dictionary => {
          "1" => 10000000
          "2" => 10000000
          "3" => 100000000
          "4" => 1000000000
          "5" => 45000000
          "6" => 155000000
          "7" => 10000000000
        }
		fallback => 0
	}

```

I'm converting the integer to string. The conversion ends up: ifspeed = 0.4e1. Am I going to have to change the translate dictionary to "0.4e1" or am I missing something on the convert statement?

---

<div class="post-metadata">

**Author:** ![chapmantrain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chapmantrain/32/22646_2.png) [@chapmantrain](https://discuss.elastic.co/u/chapmantrain)\
**Post date:** [April 6, 2021, 12:27pm UTC](https://discuss.elastic.co/t/logstash-translate-filter-and-converting-integers-to-strings/268803/2 "2021-04-06T12:27:59Z")

</div>

I'm assuming the 0.4e1 is the expected conversion. Configuring this form works for now. Thanks

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [April 6, 2021, 2:48pm UTC](https://discuss.elastic.co/t/logstash-translate-filter-and-converting-integers-to-strings/268803/3 "2021-04-06T14:48:13Z")

</div>

> [@chapmantrain](#):
>
> I'm assuming the 0.4e1 is the expected conversion.

convert is just [calling](https://github.com/logstash-plugins/logstash-filter-mutate/blob/883c8b007c41e2c8cf0107447e3de87baee7e89e/lib/logstash/filters/mutate.rb#L334) the ruby .to\_s function, which often uses an exponent form.

---

<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:** [May 4, 2021, 2:48pm UTC](https://discuss.elastic.co/t/logstash-translate-filter-and-converting-integers-to-strings/268803/4 "2021-05-04T14:48:26Z")

</div>

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