How does Logstash convert a integer value to another integer value

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.

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
  }
}

Hi zhu,

You could try the Logstash Ruby filter and write a Ruby expression to shift the operator.

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