Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 3.6.0
- Add JRuby 10 support: fix integer conversion precision loss beyond 2^53 caused by `parse_signed_hex_str` routing all strings through `Float()` [#178](https://github.com/logstash-plugins/logstash-filter-mutate/pull/178)

## 3.5.9
- Fix `convert` to covert hexadecimal float notation and scientific notation string to float and integer [#175](https://github.com/logstash-plugins/logstash-filter-mutate/pull/175)

Expand Down
7 changes: 5 additions & 2 deletions lib/logstash/filters/mutate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ def convert_integer(value)
# scientific notation. BigDecimal() can't parse hex string
return BigDecimal(value).to_i if value.include?("e")
# maybe a float string
return value.to_i
return BigDecimal(value).to_i
end

Integer(value)
Expand Down Expand Up @@ -414,7 +414,10 @@ def cnv_replace_eu(value)
# @param value [String] the string to parse
# @return [Float, nil] the signed float value if hex, or nil if not a hex string
def parse_signed_hex_str(value)
return Float(value) if @support_signed_hex
if @support_signed_hex
return Float(value) if value.match?(/^[+-]?0x/i)
return nil
end

if value.match?(/^[+-]?0x/i)
sign = value.start_with?('-') ? -1 : 1
Expand Down
3 changes: 2 additions & 1 deletion logstash-filter-mutate.gemspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Gem::Specification.new do |s|

s.name = 'logstash-filter-mutate'
s.version = '3.5.9'
s.version = '3.6.0'
s.licenses = ['Apache License (2.0)']
s.summary = "Performs mutations on fields"
s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
Expand All @@ -21,6 +21,7 @@ Gem::Specification.new do |s|

# Gem dependencies
s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.60", "<= 2.99"
s.add_runtime_dependency "bigdecimal"
s.add_development_dependency "logstash-patterns-core"
s.add_development_dependency "logstash-filter-grok"
s.add_development_dependency "logstash-codec-plain"
Expand Down
Loading