diff --git a/lib/logstash/event.rb b/lib/logstash/event.rb index 9e54c6a2f..cd69b7a0f 100644 --- a/lib/logstash/event.rb +++ b/lib/logstash/event.rb @@ -85,7 +85,7 @@ class LogStash::Event copy = {} @data.each do |k,v| # TODO(sissel): Recurse if this is a hash/array? - copy[k] = v.clone + copy[k] = begin v.clone rescue v end end return self.class.new(copy) end # def clone diff --git a/spec/filters/clone.rb b/spec/filters/clone.rb index 83152f52c..fd73f178f 100644 --- a/spec/filters/clone.rb +++ b/spec/filters/clone.rb @@ -64,4 +64,20 @@ describe LogStash::Filters::Clone do end end + + describe "Bug LOGSTASH-1225" do + ### LOGSTASH-1225: Cannot clone events containing numbers. + config <<-CONFIG + filter { + clone { + clones => [ 'clone1' ] + } + } + CONFIG + + sample("type" => "bug-1225", "message" => "unused", "number" => 5) do + insist { subject[0]["number"] } == 5 + insist { subject[1]["number"] } == 5 + end + end end