Skip to content

Commit

Permalink
Merge pull request #1 from toddysm/master
Browse files Browse the repository at this point in the history
Update to Fluentd 0.14
  • Loading branch information
toddysm authored Sep 6, 2017
2 parents 84ff23c + d13129f commit 762da30
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
*.o
*.a
mkmf.log
*.gem
7 changes: 4 additions & 3 deletions fluent-plugin-azureeventhubs.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

Gem::Specification.new do |spec|
spec.name = "fluent-plugin-azureeventhubs"
spec.version = "0.0.5"
spec.authors = ["Hidemasa Togashi", "Justin Seely"]
spec.email = ["[email protected]"]
spec.version = "0.0.6"
spec.authors = ["Hidemasa Togashi", "Toddy Mladenov", "Justin Seely"]
spec.email = ["[email protected]", "[email protected]"]
spec.summary = "Fluentd output plugin for Azure Event Hubs"
spec.description = "Fluentd output plugin for Azure Event Hubs"
spec.homepage = "https://github.com/htgc/fluent-plugin-azureeventhubs"
Expand All @@ -19,4 +19,5 @@ Gem::Specification.new do |spec|

spec.add_development_dependency "bundler", "~> 1.7"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_dependency "fluentd", [">= 0.14.15", "< 2"]
end
25 changes: 20 additions & 5 deletions lib/fluent/plugin/out_azureeventhubs_buffered.rb
Original file line number Diff line number Diff line change
@@ -1,22 +1,32 @@
#module Fluent
module Fluent::Plugin

class AzureEventHubsOutputBuffered < Fluent::BufferedOutput
class AzureEventHubsOutputBuffered < Output
Fluent::Plugin.register_output('azureeventhubs_buffered', self)

helpers :compat_parameters, :inject

DEFAULT_BUFFER_TYPE = "memory"

config_param :connection_string, :string
config_param :hub_name, :string
config_param :include_tag, :bool, :default => false
config_param :include_time, :bool, :default => false
config_param :tag_time_name, :string, :default => 'time'
config_param :expiry_interval, :integer, :default => 3600 # 60min
config_param :type, :string, :default => 'https' # https / amqps (Not Implemented)
config_param :type, :string, :default => 'https' # https / amqps (Not Implemented)
config_param :proxy_addr, :string, :default => ''
config_param :proxy_port, :integer,:default => 3128
config_param :open_timeout, :integer,:default => 60
config_param :read_timeout, :integer,:default => 60
config_param :message_properties, :hash, :default => nil

config_section :buffer do
config_set_default :@type, DEFAULT_BUFFER_TYPE
config_set_default :chunk_keys, ['tag']
end

def configure(conf)
compat_parameters_convert(conf, :buffer, :inject)
super
case @type
when 'amqps'
Expand All @@ -25,12 +35,18 @@ def configure(conf)
require_relative 'azureeventhubs/http'
@sender = AzureEventHubsHttpSender.new(@connection_string, @hub_name, @expiry_interval,@proxy_addr,@proxy_port,@open_timeout,@read_timeout)
end
raise Fluent::ConfigError, "'tag' in chunk_keys is required." if not @chunk_key_tag
end

def format(tag, time, record)
record = inject_values_to_record(tag, time, record)
[tag, time, record].to_msgpack
end

def formatted_to_msgpack_binary?
true
end

def write(chunk)
chunk.msgpack_each { |tag, time, record|
p record.to_s
Expand All @@ -44,5 +60,4 @@ def write(chunk)
}
end
end
#end

end

0 comments on commit 762da30

Please sign in to comment.