Skip to content

Commit

Permalink
avoid fields with underscore from overriding GELF field fixes logstas…
Browse files Browse the repository at this point in the history
  • Loading branch information
Cactusbone committed Sep 14, 2016
1 parent 0921453 commit 0f0e71c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/logstash/inputs/gelf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,11 @@ def strip_leading_underscore(event)
# Map all '_foo' fields to simply 'foo'
event.to_hash.keys.each do |key|
next unless key[0,1] == "_"
event.set(key[1..-1], event.get(key))
new_key = key[1..-1]
# https://github.com/logstash-plugins/logstash-input-gelf/issues/25
next if ['version', 'host', 'short_message', 'full_message', 'timestamp', 'level', 'facility', 'line', 'file'].include? new_key # GELF inner fields
next if ['type'].include? new_key # Logstash fields
event.set(new_key, event.get(key))
event.remove(key)
end
end # deef removing_leading_underscores
Expand Down

0 comments on commit 0f0e71c

Please sign in to comment.