Unable to convert a field from string to integer that is dynamically generated in Logstash filter

See this post. You cannot use a sprintf reference in the source of a convert.