# How does Logstash convert a integer value to another integer value

**URL:** <https://discuss.elastic.co/t/how-does-logstash-convert-a-integer-value-to-another-integer-value/326830>\
**Category:** Logstash\
**Created:** [March 2, 2023, 9:06am UTC](https://discuss.elastic.co/t/how-does-logstash-convert-a-integer-value-to-another-integer-value/326830 "2023-03-02T09:06:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![wensi](https://avatars.discourse-cdn.com/v4/letter/w/e95f7d/32.png) [@wensi](https://discuss.elastic.co/u/wensi)\
**Post date:** [March 2, 2023, 9:06am UTC](https://discuss.elastic.co/t/how-does-logstash-convert-a-integer-value-to-another-integer-value/326830/1 "2023-03-02T09:06:48Z")

</div>

In the following pipeline, I want to add a shift (1000000) to `id` column value, `id` was 1, and I want it to be `1000001`. However, with `mutate update` generates a string `"1 + 1000000"` instead of making integer shifted. I also tried that in output, logstash complains about illegal argument.

```auto
filter {
  mutate {
    copy => { "id" => "[@metadata][_id]"}
    remove_field => ["@version"]
  }
  mutate {
    gsub => ["vec", "[\[\]]", "" ]
    split => { "vec" => "," }
    #update => { "id" => "%{id} + 1000000} # this results a "1 + 1000000" string id.
  }
  mutate {
    convert => {
      "vec" => "float"
    }
  }
}
output {
  stdout { codec => "rubydebug"}
}

output {
  elasticsearch {
    index => "ff0"
    ilm_enabled => false
    document_id => "%{id}" + 1000000 # this causes error when run logstash
  }
}

```

---

<div class="post-metadata">

**Author:** ![carly.richmond](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carly.richmond/32/104935_2.png) [@carly.richmond](https://discuss.elastic.co/u/carly.richmond)\
**Post date:** [March 2, 2023, 11:02am UTC](https://discuss.elastic.co/t/how-does-logstash-convert-a-integer-value-to-another-integer-value/326830/2 "2023-03-02T11:02:10Z")

</div>

Hi zhu,

You could try the [Logstash Ruby filter](https://www.elastic.co/guide/en/logstash/current/plugins-filters-ruby.html) and write a Ruby expression to shift the operator.

---

<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:** [March 30, 2023, 11:02am UTC](https://discuss.elastic.co/t/how-does-logstash-convert-a-integer-value-to-another-integer-value/326830/3 "2023-03-30T11:02:23Z")

</div>

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