diff --git a/fluent-plugin-input-gelf.gemspec b/fluent-plugin-input-gelf.gemspec index c1156c3..1cebe12 100644 --- a/fluent-plugin-input-gelf.gemspec +++ b/fluent-plugin-input-gelf.gemspec @@ -17,7 +17,7 @@ Gem::Specification.new do |gem| gem.require_paths = ['lib'] gem.add_runtime_dependency "fluentd" - gem.add_runtime_dependency "gelfd", ">= 0.2.0" + gem.add_runtime_dependency "gelfd2", ">= 0.3.0" gem.add_development_dependency "bundler" gem.add_development_dependency "rake" diff --git a/lib/fluent/plugin/in_gelf.rb b/lib/fluent/plugin/in_gelf.rb index 366d9ab..4b8e74d 100644 --- a/lib/fluent/plugin/in_gelf.rb +++ b/lib/fluent/plugin/in_gelf.rb @@ -13,7 +13,7 @@ class GelfInput < Fluent::Input def initialize super require 'fluent/plugin/socket_util' - require 'gelfd' + require 'gelfd2' end desc "The value is the tag assigned to the generated events." @@ -70,7 +70,7 @@ def run def receive_data(data, addr) begin - msg = Gelfd::Parser.parse(data) + msg = Gelfd2::Parser.parse(data) rescue => e log.warn 'Gelfd failed to parse a message', error: e.to_s log.warn_backtrace @@ -89,7 +89,7 @@ def receive_data(data, addr) time = record.delete('timestamp').to_i if record.key?('timestamp') # Postprocess recorded event - strip_leading_underscore(record) if @strip_leading_underscore + strip_leading_underscore_(record) if @strip_leading_underscore emit(time, record) } @@ -117,7 +117,7 @@ def emit(time, record) private - def strip_leading_underscore(record) + def strip_leading_underscore_(record) record.keys.each { |k| next unless k[0,1] == '_' record[k[1..-1]] = record.delete(k)