fluent-plugin-scribe 0.10.13 → 0.10.14

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: e82d716df29ee314a3d51ee911e32f9b0de07a0f
4
- data.tar.gz: 35be26bb3acbe72db1b38bad94b2801875d90e22
3
+ metadata.gz: fed484e3b03389ad95949efadb75469f0db8fb26
4
+ data.tar.gz: 8c7b0a17acf583b92e5aa9ec80b5316a8c5b7685
5
5
  SHA512:
6
- metadata.gz: f98b739988b9bdb0e69d34c56c9139e80cf7c9c1834c3d59f6ee22a449552230e471ee711fa3284487f6fb2735d296c6d42b182168653595526dc5a34fce1031
7
- data.tar.gz: 9dc6b1104e4b3aace045c925961b3224e4cc215de001303191f3cd560a94828b7f6929bccc66a1168de4958383b99d140c6ec923c30c861280af3adae46bdedd
6
+ metadata.gz: aa5bfa8ea262f65bf992283afccfc9708efb866ec3762f2b7250b77b17fff2c4a27b95a3aee4b31a46d89a30c6225fc42ff530772c9d4dd76a4ad35ba2e67ad3
7
+ data.tar.gz: 667cebaad66f654b2999dfd6866eab4598c9eb80f224f6b001b1622251e92a94aa0a84343142a2268a4a777ad2e58e3b989d723c89ac969e052d633c7d425aa9
data/ChangeLog CHANGED
@@ -1,9 +1,13 @@
1
- Release 0.10.13 - 2013/10/29
1
+ Release 0.10.14 - 2014/12/19
2
+ * add ignore_invalid_record to out_scribe
3
+ * improve input performance by reducing the times of emit
4
+
5
+ Release 0.10.13 - 2014/10/29
2
6
  * add validation for msg_format
3
7
  * use Yajl instead of JSON for parsing record
4
8
  * add ignore_invalid_record option to ignore invalid record and return OK to scribed
5
9
 
6
- Release 0.10.12 - 2013/09/04
10
+ Release 0.10.12 - 2014/09/04
7
11
  * support 'log_level' option
8
12
  * fix to do shutdown plugin instance not to duplicate listen
9
13
 
@@ -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.13"
5
+ gem.version = "0.10.14"
6
6
 
7
7
  gem.authors = ["Kazuki Ohta", "TAGOMORI Satoshi"]
8
8
  gem.email = ["kazuki.ohta@gmail.com", "tagomoris@gmail.com"]
@@ -127,30 +127,38 @@ module Fluent
127
127
  attr_accessor :logger # Use logger instead of log to avoid confusion with Log method
128
128
 
129
129
  def Log(msgs)
130
+ bucket = {} # tag -> events(array of [time,record])
131
+ time_now = Engine.now
130
132
  begin
131
- msgs.each { |msg|
133
+ msgs.each do |msg|
132
134
  begin
133
135
  record = create_record(msg)
134
136
  rescue => e
135
137
  if @ignore_invalid_record
136
138
  # This warning can be disabled by 'log_level error'
137
- logger.warn "got invalid record: #{msg}"
139
+ logger.warn "got invalid record", message: msg, error_class: e.class, error: e
138
140
  next
139
- else
140
- # Keep existence behaviour
141
- raise e
142
141
  end
143
- end
144
142
 
145
- if @add_prefix
146
- Engine.emit(@add_prefix + '.' + msg.category, Engine.now, record)
147
- else
148
- Engine.emit(msg.category, Engine.now, record)
143
+ raise
149
144
  end
150
- }
145
+ tag = @add_prefix ? @add_prefix + '.' + msg.category : msg.category
146
+ bucket[tag] ||= []
147
+ bucket[tag].push([time_now,record])
148
+ end
149
+ rescue => e
150
+ logger.error "unexpected error", error_class: e.class, error: e
151
+ logger.error_backtrace
152
+ return ResultCode::TRY_LATER
153
+ end
154
+
155
+ begin
156
+ bucket.each do |tag,events|
157
+ Engine.emit_array(tag, events)
158
+ end
151
159
  return ResultCode::OK
152
160
  rescue => e
153
- logger.error "unexpected error", :error => e.inspect
161
+ logger.error "unexpected error", error_class: e.class, error: e
154
162
  logger.error_backtrace
155
163
  return ResultCode::TRY_LATER
156
164
  end
@@ -26,6 +26,7 @@ module Fluent
26
26
 
27
27
  config_param :remove_prefix, :string, :default => nil
28
28
  config_param :add_newline, :bool, :default => false
29
+ config_param :ignore_invalid_record, :bool, :default => false
29
30
  config_param :default_category, :string, :default => 'unknown'
30
31
  config_param :format_to_json, :bool, :default => false
31
32
 
@@ -92,7 +93,18 @@ module Fluent
92
93
  message = @format_to_json ? record : record[@field_ref]
93
94
 
94
95
  if message.kind_of?(Array) or message.kind_of?(Hash)
95
- message = message.to_json
96
+ begin
97
+ message = message.to_json
98
+ rescue => e
99
+ if @ignore_invalid_record
100
+ # This warning can be disabled by 'log_level error'
101
+ log.warn "got invalid message", message: message, error: e, error_class: e.class
102
+ next
103
+ else
104
+ # Keep existence behaviour
105
+ raise
106
+ end
107
+ end
96
108
  end
97
109
 
98
110
  if @add_newline
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.13
4
+ version: 0.10.14
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: 2014-10-28 00:00:00.000000000 Z
12
+ date: 2014-12-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake