fluent-plugin-light-core 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/fluent-plugin-light-core.gemspec +1 -1
- data/lib/fluent/plugin/filter_light_core.rb +10 -2
- data/sample/source.conf +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7362a4a9cf4dce7cd3516cb36570bc9bb3cceaaa57298fb46516eb4ac21b3c03
|
4
|
+
data.tar.gz: 5971ac366d57a1e95814b2fe6dc2f142fd3f9bb21f22ec9c59311edc2022fdde
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00db95fd28c70604437e7838b0f9f832aa8478671d39236097e11e28a58c36f8ea455aad92d60c252db91520ef5ecf9fa01c460f9a17bdd5fc8c824c98d0d202
|
7
|
+
data.tar.gz: '09a94bea94957e69e72174136913bc5c642f71e2036af1fcb4331a530ae64ace14ca1504c5ea9165c6b5eb33949dbbfbd81116da96325653ae102d362885cd96'
|
@@ -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