Skip to content

Switch to forked gelfd2 gem for uncompressed support #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 11, 2017
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
2 changes: 1 addition & 1 deletion fluent-plugin-input-gelf.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 4 additions & 4 deletions lib/fluent/plugin/in_gelf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down Expand Up @@ -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
Expand All @@ -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)
}
Expand Down Expand Up @@ -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)
Expand Down