fluent-plugin-kafka 0.0.15 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ea8e8c26bed79cf08bcf26e11213a6aec0757741
4
- data.tar.gz: 40df9fd993cd1f5daf1f7f10331c2370986df549
3
+ metadata.gz: a72f6359b8397411999429eeda7366e05114e925
4
+ data.tar.gz: b8dc3a2860a941b43d02f8a98562eec997bd065f
5
5
  SHA512:
6
- metadata.gz: f360beef321eeee7dc4dec739d3386e205bf81878ef8777e1970aee147f681dcf930b345efb46bc5a5bdf037caab07ea1a6f7a0abbec21e70581e44c32fb44b9
7
- data.tar.gz: 89b381653212a2a4ac66e69df57033f80206d3e2d6c5c48bc4bb5653e548c4a1f61aa85a7427703a30e544c1de429d0457fd1dfd12ea798a81ae13b824813952
6
+ metadata.gz: 6af36d8001d89b0b7b181118f66b6a38f3f4a567e70d4a744e3e69496c00a84939f9272aabba9650bf02ee57fe00113b6ca3782b674a20fa108e8892f8f00e81
7
+ data.tar.gz: c5a8f2ad75696645cd62a40cc0aad87f471a59119d73fbf04c2be8b0d68d195e33cfb9c2b82afa61312dc2d1160de91182a64686213fec15b37ae725dfbcd043
data/README.md CHANGED
@@ -27,6 +27,7 @@ Or install it yourself as:
27
27
  port <broker port: default=9092>
28
28
  topics <listening topics(separate with comma',')>
29
29
  format <input text type (text|json|ltsv|msgpack)>
30
+ message_key <key (Optional, for text format only, default is message)>
30
31
  add_prefix <tag prefix (Optional)>
31
32
  add_suffix <tag suffix (Optional)>
32
33
  max_bytes (integer) :default => nil (Use default of Poseidon)
@@ -12,7 +12,7 @@ Gem::Specification.new do |gem|
12
12
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
13
13
  gem.name = "fluent-plugin-kafka"
14
14
  gem.require_paths = ["lib"]
15
- gem.version = '0.0.15'
15
+ gem.version = '0.0.16'
16
16
  gem.add_dependency 'fluentd'
17
17
  gem.add_dependency 'poseidon'
18
18
  gem.add_dependency 'ltsv'
@@ -4,6 +4,7 @@ class KafkaInput < Input
4
4
  Plugin.register_input('kafka', self)
5
5
 
6
6
  config_param :format, :string, :default => 'json' # (json|text|ltsv)
7
+ config_param :message_key, :string, :default => 'message' # for 'text' format only
7
8
  config_param :host, :string, :default => 'localhost'
8
9
  config_param :port, :integer, :default => 9092
9
10
  config_param :interval, :integer, :default => 1 # seconds
@@ -51,7 +52,7 @@ class KafkaInput < Input
51
52
  opt[:socket_timeout_ms] = @socket_timeout_ms if @socket_timeout_ms
52
53
 
53
54
  @topic_watchers = @topic_list.map {|topic|
54
- TopicWatcher.new(topic, @host, @port, @client_id, @partition, @offset, interval, @format, @add_prefix, @add_suffix, opt)
55
+ TopicWatcher.new(topic, @host, @port, @client_id, @partition, @offset, interval, @format, @message_key, @add_prefix, @add_suffix, opt)
55
56
  }
56
57
  @topic_watchers.each {|tw|
57
58
  tw.attach(@loop)
@@ -71,10 +72,11 @@ class KafkaInput < Input
71
72
  end
72
73
 
73
74
  class TopicWatcher < Coolio::TimerWatcher
74
- def initialize(topic, host, port, client_id, partition, offset, interval, format, add_prefix, add_suffix, options={})
75
+ def initialize(topic, host, port, client_id, partition, offset, interval, format, message_key, add_prefix, add_suffix, options={})
75
76
  @topic = topic
76
77
  @callback = method(:consume)
77
78
  @format = format
79
+ @message_key = message_key
78
80
  @add_prefix = add_prefix
79
81
  @add_suffix = add_suffix
80
82
  @consumer = Poseidon::PartitionConsumer.new(
@@ -128,7 +130,7 @@ class KafkaInput < Input
128
130
  when 'msgpack'
129
131
  parsed_record = MessagePack.unpack(record)
130
132
  when 'text'
131
- parsed_record = record
133
+ parsed_record[@message_key] = record
132
134
  end
133
135
  parsed_record
134
136
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-kafka
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hidemasa Togashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-18 00:00:00.000000000 Z
11
+ date: 2015-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd