fluent-plugin-scribe 0.10.1 → 0.10.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -8,7 +8,7 @@ begin
8
8
  gemspec.name = "fluent-plugin-scribe"
9
9
  gemspec.summary = "Scribe plugin for Fluent event collector"
10
10
  gemspec.author = "Kazuki Ohta"
11
- #gemspec.email = "kazuki.ohta@gmail.com"
11
+ gemspec.email = "kazuki.ohta@gmail.com"
12
12
  gemspec.homepage = "https://github.com/fluent/fluent-plugin-scribe"
13
13
  gemspec.has_rdoc = false
14
14
  gemspec.require_paths = ["lib"]
@@ -17,8 +17,7 @@ begin
17
17
  gemspec.test_files = Dir["test/**/*.rb"]
18
18
  gemspec.files = Dir["bin/**/*", "lib/**/*", "test/**/*.rb"] +
19
19
  %w[example.conf VERSION AUTHORS Rakefile fluent-plugin-scribe.gemspec]
20
-
21
- gemspec.executables = []
20
+ gemspec.executables = ['fluent-scribe-remote']
22
21
  end
23
22
  Jeweler::GemcutterTasks.new
24
23
  rescue LoadError
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.10.1
1
+ 0.10.2
@@ -5,11 +5,14 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{fluent-plugin-scribe}
8
- s.version = "0.10.0"
8
+ s.version = "0.10.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kazuki Ohta"]
12
12
  s.date = %q{2011-10-16}
13
+ s.default_executable = %q{fluent-scribe-remote}
14
+ s.email = %q{kazuki.ohta@gmail.com}
15
+ s.executables = ["fluent-scribe-remote"]
13
16
  s.extra_rdoc_files = [
14
17
  "README.rdoc"
15
18
  ]
@@ -29,12 +32,14 @@ Gem::Specification.new do |s|
29
32
  "lib/fluent/plugin/thrift/scribe.rb",
30
33
  "lib/fluent/plugin/thrift/scribe.thrift",
31
34
  "lib/fluent/plugin/thrift/scribe_constants.rb",
32
- "lib/fluent/plugin/thrift/scribe_types.rb"
35
+ "lib/fluent/plugin/thrift/scribe_types.rb",
36
+ "test/plugin/in_scribe.rb"
33
37
  ]
34
38
  s.homepage = %q{https://github.com/fluent/fluent-plugin-scribe}
35
39
  s.require_paths = ["lib"]
36
40
  s.rubygems_version = %q{1.6.2}
37
41
  s.summary = %q{Scribe plugin for Fluent event collector}
42
+ s.test_files = ["test/plugin/in_scribe.rb"]
38
43
 
39
44
  if s.respond_to? :specification_version then
40
45
  s.specification_version = 3
@@ -17,7 +17,6 @@
17
17
  #
18
18
  module Fluent
19
19
 
20
-
21
20
  class ScribeInput < Input
22
21
  Plugin.register_input('scribe', self)
23
22
 
@@ -49,7 +48,7 @@ class ScribeInput < Input
49
48
  handler = FluentScribeHandler.new
50
49
  processor = Scribe::Processor.new handler
51
50
 
52
- @transport = Thrift::ServerSocket.new @host, @port
51
+ @transport = Thrift::ServerSocket.new @bind, @port
53
52
  if @is_framed
54
53
  transport_factory = Thrift::FramedTransportFactory.new
55
54
  else
@@ -115,6 +114,4 @@ class ScribeInput < Input
115
114
  end
116
115
  end
117
116
 
118
-
119
117
  end
120
-
@@ -20,8 +20,12 @@ module Fluent
20
20
  class ScribeOutput < BufferedOutput
21
21
  Fluent::Plugin.register_output('scribe', self)
22
22
 
23
+ config_param :host, :string, :default => 'localhost'
24
+ config_param :port, :integer, :default => 1463
25
+ config_param :field_ref, :string, :default => 'message'
26
+ config_param :timeout, :integer, :default => 30
27
+
23
28
  def initialize
24
- super
25
29
  require 'thrift'
26
30
  $:.unshift File.join(File.dirname(__FILE__), 'thrift')
27
31
  require 'fb303_types'
@@ -30,13 +34,11 @@ class ScribeOutput < BufferedOutput
30
34
  require 'scribe_types'
31
35
  require 'scribe_constants'
32
36
  require 'scribe'
37
+ super
33
38
  end
34
39
 
35
40
  def configure(conf)
36
41
  super
37
-
38
- @host = 'localhost'
39
- @port = 38888
40
42
  end
41
43
 
42
44
  def start
@@ -47,38 +49,37 @@ class ScribeOutput < BufferedOutput
47
49
  super
48
50
  end
49
51
 
50
- def format(tag, event)
51
- [tag, event.record].to_msgpack
52
+ def format(tag, time, record)
53
+ [tag, record].to_msgpack
52
54
  end
53
55
 
54
56
  def write(chunk)
55
57
  records = []
56
- chunk.open { |io|
57
- begin
58
- MessagePack::Unpacker.new(io).each { |record| records << record }
59
- rescue EOFError
60
- # EOFError always occured when reached end of chunk.
61
- end
58
+ chunk.msgpack_each { |arr|
59
+ records << arr
62
60
  }
63
61
 
64
- socket = Thrift::Socket.new @host, @port.to_i
62
+ socket = Thrift::Socket.new @host, @port, @timeout
65
63
  transport = Thrift::FramedTransport.new socket
66
64
  protocol = Thrift::BinaryProtocol.new transport, false, false
67
65
  client = Scribe::Client.new protocol
68
- transport.open
69
66
 
70
- entries = []
71
- records.each { |r|
72
- entry = LogEntry.new
73
- entry.category = r[0]
74
- entry.message = r[1].to_json
75
- entries << entry
76
- }
77
-
78
- client.Log(entries)
79
- transport.close
67
+ transport.open
68
+ begin
69
+ entries = []
70
+ records.each { |r|
71
+ tag, record = r
72
+ next unless record.has_key?(@field_ref)
73
+ entry = LogEntry.new
74
+ entry.category = tag
75
+ entry.message = record[@field_ref]
76
+ entries << entry
77
+ }
78
+ client.Log(entries)
79
+ ensure
80
+ transport.close
81
+ end
80
82
  end
81
83
  end
82
84
 
83
-
84
85
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-scribe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: 0.10.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
  date: 2011-10-16 00:00:00.000000000 -07:00
13
- default_executable:
13
+ default_executable: fluent-scribe-remote
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: fluentd
17
- requirement: &2156672800 !ruby/object:Gem::Requirement
17
+ requirement: &2157073220 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 0.10.0
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2156672800
25
+ version_requirements: *2157073220
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: thrift
28
- requirement: &2156671600 !ruby/object:Gem::Requirement
28
+ requirement: &2157072380 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,10 +33,11 @@ dependencies:
33
33
  version: 0.7.0
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *2156671600
36
+ version_requirements: *2157072380
37
37
  description:
38
- email:
39
- executables: []
38
+ email: kazuki.ohta@gmail.com
39
+ executables:
40
+ - fluent-scribe-remote
40
41
  extensions: []
41
42
  extra_rdoc_files:
42
43
  - README.rdoc