fluent-plugin-light-core 0.3.0 → 0.3.1

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
  SHA256:
3
- metadata.gz: 6119d11808512bdf44f83123c91c633d8f11ca5c2dac44fc1e7576d075273d08
4
- data.tar.gz: 891aa7bc78a8d191733805b3de356f003c32fcddc0365d5ccebd97cc91a5615a
3
+ metadata.gz: 7362a4a9cf4dce7cd3516cb36570bc9bb3cceaaa57298fb46516eb4ac21b3c03
4
+ data.tar.gz: 5971ac366d57a1e95814b2fe6dc2f142fd3f9bb21f22ec9c59311edc2022fdde
5
5
  SHA512:
6
- metadata.gz: 30231e1d3b211c71b11370bd482eb12d6070d61da621907e95df5140e04b4eb1c5572851a838aaa54a407f13ec6ddaf778e960e4026d8333573f7c45bfea259c
7
- data.tar.gz: 2bd9370ed15a793354809c6cff4c6a2a08251cf48e9c33948cd541700a928dac3c28a44233fd70f055eeaf310b69bbac273af74fa80200b6b539a4333611c395
6
+ metadata.gz: 00db95fd28c70604437e7838b0f9f832aa8478671d39236097e11e28a58c36f8ea455aad92d60c252db91520ef5ecf9fa01c460f9a17bdd5fc8c824c98d0d202
7
+ data.tar.gz: '09a94bea94957e69e72174136913bc5c642f71e2036af1fcb4331a530ae64ace14ca1504c5ea9165c6b5eb33949dbbfbd81116da96325653ae102d362885cd96'
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
 
4
4
  Gem::Specification.new do |spec|
5
5
  spec.name = "fluent-plugin-light-core"
6
- spec.version = "0.3.0"
6
+ spec.version = "0.3.1"
7
7
  spec.authors = ["LIN LI"]
8
8
  spec.email = ["l.li@alphabets.cn"]
9
9
 
@@ -42,6 +42,7 @@ module Fluent
42
42
  config_param :mongo_severity, :array, default: ['F', 'E'], value_type: :string
43
43
  config_param :mongo_querytime, :float, default: 100
44
44
  config_param :mongo_dataBytes, :float, default: 1073741824
45
+ config_param :mongo_reslen, :float, default: 20971520
45
46
 
46
47
  # 初始化 Sentry
47
48
  def start
@@ -213,7 +214,7 @@ module Fluent
213
214
 
214
215
  # https://docs.mongodb.com/manual/reference/log-messages/
215
216
  def filter_mongo(tag, time, record)
216
-
217
+
217
218
  file = record['file'].split('/').last.split('_')
218
219
  log = record['log']
219
220
 
@@ -234,12 +235,13 @@ module Fluent
234
235
  record['context'] = item['ctx']
235
236
  record['identifier'] = item['id']
236
237
  record['message'] = item['msg']
237
-
238
+
238
239
  attributes = item['attr']
239
240
  if attributes
240
241
  record['querytime'] = attributes['durationMillis']
241
242
  record['collection'] = attributes['ns']
242
243
  record['command'] = attributes['command']
244
+ record['reslen'] = attributes['reslen']
243
245
  storage = attributes['storage']
244
246
  if storage
245
247
  data = storage['data']
@@ -335,6 +337,12 @@ module Fluent
335
337
  send(tag, message, record) if record['bytesWritten'].to_f >= @mongo_dataBytes
336
338
  end
337
339
 
340
+ if @mongo_reslen > 0 && record['reslen']
341
+ message = 'reslen data is:' + record['reslen'].to_s
342
+ message = message + ' : ' + record['collection'] if record['collection']
343
+ send(tag, message, record) if record['reslen'].to_f >= @mongo_reslen
344
+ end
345
+
338
346
  return record
339
347
  end
340
348
 
data/sample/source.conf CHANGED
@@ -84,6 +84,7 @@
84
84
  mongo_querytime 300
85
85
  mongo_severity F,E
86
86
  mongo_dataBytes 1073741824
87
+ mongo_reslen 20971520
87
88
  lb_stream stderr
88
89
  lb_code 400,500
89
90
  lb_elapsed 5
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-light-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - LIN LI