fluent-plugin-scribe 0.10.11 → 0.10.12

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: c1fa97e1091c9a7b3864e658377226530c5796b8
4
- data.tar.gz: 53a1f639942eaab9d0ec71c663b6947bce5eea95
3
+ metadata.gz: 4742edb4137955d08718e1cc275f2b163a0f7d98
4
+ data.tar.gz: 454ccd6f4ebb77898c159c25bb17e17c0f94526c
5
5
  SHA512:
6
- metadata.gz: 5724cce9d7574385413afd56a28e078748a8936557a0aefa5f162aeb64058b17d6d5ae299a57ffa02149943ccb4c8fc9ac2e929cf8ef771e4a78e09ffbc39763
7
- data.tar.gz: d32cf42a08d55bcb0678b85144b54f2411d5301c7ef273ac25eab37cb0a97f363b5f583e854dcf501ea0ddff32dc80f71b813967091d1ebab35e7a6aa9a8de3a
6
+ metadata.gz: 5d607d8c5e8f579efe419e4575340caa1fca4b3103c48895e1208394eae5a30c609fe136875f8ad768b79484add797d12493e071747c6eb9e0d35f86598ac215
7
+ data.tar.gz: 5419ee2a3a620720172a909baa0087cf8e15da93ffd8a253a1aee2f891b0d40405272ec6e8e6600391877ac46eb7ca366fc3d670500eabf800b2bf13029f07ee
@@ -0,0 +1,11 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - 1.9.3
5
+ - 2.0.0
6
+
7
+ branches:
8
+ only:
9
+ - master
10
+
11
+ script: bundle exec rake test
@@ -74,19 +74,19 @@ These options are supported.
74
74
  * port: port number (default: 1463)
75
75
  * field_ref: field name which sent as scribe log message (default: message)
76
76
  * timeout: thrift protocol timeout (default: 30)
77
- * body_format: parse a body message as a specified format (default: 'text', option: 'json')
77
+ * format_to_json: if true/yes, format entire record as json, and send as message (default: false)
78
78
  * remove_prefix: prefix string, removed from the tag (default: nil)
79
79
 
80
80
  == For Developers
81
81
 
82
- To test this plugin, please execute the following command in your 'fluent' project directory, not scribe input plugin directory.
82
+ To run fluentd with this plugin on chaging,
83
83
 
84
- $ export SCRIBE_PLUGIN_DIR=../fluent-plugin-scribe
85
- $ FLUENT_PLUGIN=$SCRIBE_PLUGIN_DIR/lib/fluent/plugin/ ./bin/fluentd --config $SCRIBE_PLUGIN_DIR/example.conf -v -v -v
84
+ $ bundle # (or 'bundle update')
85
+ $ bundle exec fluentd -v -v -v -c example.conf
86
86
 
87
87
  Then please execute the sample client.
88
88
 
89
- $ ./bin/fluent-scribe-remote
89
+ $ bundle exec bin/fluent-scribe-remote
90
90
 
91
91
  == Contributors
92
92
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |gem|
4
4
  gem.name = "fluent-plugin-scribe"
5
- gem.version = "0.10.11"
5
+ gem.version = "0.10.12"
6
6
 
7
7
  gem.authors = ["Kazuki Ohta", "TAGOMORI Satoshi"]
8
8
  gem.email = ["kazuki.ohta@gmail.com", "tagomoris@gmail.com"]
@@ -28,6 +28,10 @@ module Fluent
28
28
  config_param :remove_newline, :bool, :default => false
29
29
  config_param :msg_format, :string, :default => 'text'
30
30
 
31
+ unless method_defined?(:log)
32
+ define_method(:log) { $log }
33
+ end
34
+
31
35
  def initialize
32
36
  require 'cgi'
33
37
  require 'thrift'
@@ -46,12 +50,13 @@ module Fluent
46
50
  end
47
51
 
48
52
  def start
49
- $log.debug "listening scribe on #{@bind}:#{@port}"
53
+ log.debug "listening scribe on #{@bind}:#{@port}"
50
54
 
51
55
  handler = FluentScribeHandler.new
52
56
  handler.add_prefix = @add_prefix
53
57
  handler.remove_newline = @remove_newline
54
58
  handler.msg_format = @msg_format
59
+ handler.logger = log
55
60
  processor = Scribe::Processor.new handler
56
61
 
57
62
  @transport = Thrift::ServerSocket.new @bind, @port
@@ -101,14 +106,15 @@ module Fluent
101
106
  def run
102
107
  @server.serve
103
108
  rescue
104
- $log.error "unexpected error", :error=>$!.to_s
105
- $log.error_backtrace
109
+ log.error "unexpected error", :error=>$!.to_s
110
+ log.error_backtrace
106
111
  end
107
112
 
108
113
  class FluentScribeHandler
109
114
  attr_accessor :add_prefix
110
115
  attr_accessor :remove_newline
111
116
  attr_accessor :msg_format
117
+ attr_accessor :logger # Use logger instead of log to avoid confusion with Log method
112
118
 
113
119
  def Log(msgs)
114
120
  begin
@@ -122,8 +128,8 @@ module Fluent
122
128
  }
123
129
  return ResultCode::OK
124
130
  rescue => e
125
- $log.error "unexpected error", :error=>$!.to_s
126
- $log.error_backtrace
131
+ logger.error "unexpected error", :error=>$!.to_s
132
+ logger.error_backtrace
127
133
  return ResultCode::TRY_LATER
128
134
  end
129
135
  end
@@ -29,6 +29,10 @@ module Fluent
29
29
  config_param :default_category, :string, :default => 'unknown'
30
30
  config_param :format_to_json, :bool, :default => false
31
31
 
32
+ unless method_defined?(:log)
33
+ define_method(:log) { $log }
34
+ end
35
+
32
36
  def initialize
33
37
  require 'thrift'
34
38
  $:.unshift File.join(File.dirname(__FILE__), 'thrift')
@@ -102,7 +106,7 @@ module Fluent
102
106
  entries << entry
103
107
  end
104
108
 
105
- $log.debug "Writing #{entries.count} entries to scribe"
109
+ log.debug "Writing #{entries.count} entries to scribe"
106
110
  client.Log(entries)
107
111
  ensure
108
112
  transport.close
@@ -18,6 +18,12 @@ class ScribeInputTest < Test::Unit::TestCase
18
18
  Fluent::Test::InputTestDriver.new(Fluent::ScribeInput).configure(conf)
19
19
  end
20
20
 
21
+ def shutdown_driver(driver)
22
+ return unless driver.instance.instance_eval{ @thread }
23
+ driver.instance.shutdown
24
+ driver.instance.instance_eval{ @thread && @thread.join }
25
+ end
26
+
21
27
  def test_configure
22
28
  d = create_driver
23
29
  assert_equal 14630, d.instance.port
@@ -44,6 +50,8 @@ class ScribeInputTest < Test::Unit::TestCase
44
50
  assert_equal ResultCode::OK, res
45
51
  }
46
52
  end
53
+
54
+ shutdown_driver(d)
47
55
  end
48
56
 
49
57
  def test_add_prefix
@@ -68,6 +76,8 @@ class ScribeInputTest < Test::Unit::TestCase
68
76
  }
69
77
  end
70
78
 
79
+ shutdown_driver(d)
80
+
71
81
  d2 = create_driver(CONFIG + %[
72
82
  add_prefix scribe.input
73
83
  ])
@@ -88,6 +98,8 @@ class ScribeInputTest < Test::Unit::TestCase
88
98
  assert_equal ResultCode::OK, res
89
99
  }
90
100
  end
101
+
102
+ shutdown_driver(d2)
91
103
  end
92
104
 
93
105
  def test_remove_newline
@@ -114,6 +126,8 @@ class ScribeInputTest < Test::Unit::TestCase
114
126
  assert_equal ResultCode::OK, res
115
127
  }
116
128
  end
129
+
130
+ shutdown_driver(d)
117
131
  end
118
132
 
119
133
  def test_msg_format_json
@@ -140,6 +154,8 @@ class ScribeInputTest < Test::Unit::TestCase
140
154
  assert_equal ResultCode::OK, res
141
155
  }
142
156
  end
157
+
158
+ shutdown_driver(d)
143
159
  end
144
160
 
145
161
  def test_msg_format_url_param
@@ -170,6 +186,8 @@ class ScribeInputTest < Test::Unit::TestCase
170
186
  assert_equal ResultCode::OK, res
171
187
  }
172
188
  end
189
+
190
+ shutdown_driver(d)
173
191
  end
174
192
 
175
193
  def message_send(tag, msg)
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.11
4
+ version: 0.10.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kazuki Ohta
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-04 00:00:00.000000000 Z
12
+ date: 2014-02-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -63,6 +63,7 @@ extensions: []
63
63
  extra_rdoc_files: []
64
64
  files:
65
65
  - .gitignore
66
+ - .travis.yml
66
67
  - AUTHORS
67
68
  - ChangeLog
68
69
  - Gemfile