fluent-plugin-light-core 0.2.9 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/fluent-plugin-light-core.gemspec +1 -1
- data/lib/fluent/plugin/filter_light_core.rb +23 -2
- data/sample/source.conf +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6119d11808512bdf44f83123c91c633d8f11ca5c2dac44fc1e7576d075273d08
|
4
|
+
data.tar.gz: 891aa7bc78a8d191733805b3de356f003c32fcddc0365d5ccebd97cc91a5615a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30231e1d3b211c71b11370bd482eb12d6070d61da621907e95df5140e04b4eb1c5572851a838aaa54a407f13ec6ddaf778e960e4026d8333573f7c45bfea259c
|
7
|
+
data.tar.gz: 2bd9370ed15a793354809c6cff4c6a2a08251cf48e9c33948cd541700a928dac3c28a44233fd70f055eeaf310b69bbac273af74fa80200b6b539a4333611c395
|
@@ -41,6 +41,7 @@ module Fluent
|
|
41
41
|
# MongoDB 异常 settings
|
42
42
|
config_param :mongo_severity, :array, default: ['F', 'E'], value_type: :string
|
43
43
|
config_param :mongo_querytime, :float, default: 100
|
44
|
+
config_param :mongo_dataBytes, :float, default: 1073741824
|
44
45
|
|
45
46
|
# 初始化 Sentry
|
46
47
|
def start
|
@@ -69,7 +70,7 @@ module Fluent
|
|
69
70
|
|
70
71
|
# 主处理
|
71
72
|
def filter(tag, time, record)
|
72
|
-
|
73
|
+
|
73
74
|
if ['app', 'service'].include? tag
|
74
75
|
record = filter_app(tag, time, record)
|
75
76
|
return notice('app', record)
|
@@ -212,7 +213,7 @@ module Fluent
|
|
212
213
|
|
213
214
|
# https://docs.mongodb.com/manual/reference/log-messages/
|
214
215
|
def filter_mongo(tag, time, record)
|
215
|
-
|
216
|
+
|
216
217
|
file = record['file'].split('/').last.split('_')
|
217
218
|
log = record['log']
|
218
219
|
|
@@ -239,6 +240,14 @@ module Fluent
|
|
239
240
|
record['querytime'] = attributes['durationMillis']
|
240
241
|
record['collection'] = attributes['ns']
|
241
242
|
record['command'] = attributes['command']
|
243
|
+
storage = attributes['storage']
|
244
|
+
if storage
|
245
|
+
data = storage['data']
|
246
|
+
if data
|
247
|
+
record['bytesRead'] = data['bytesRead']
|
248
|
+
record['bytesWritten'] = data['bytesWritten']
|
249
|
+
end
|
250
|
+
end
|
242
251
|
record['attr'] = attributes
|
243
252
|
end
|
244
253
|
|
@@ -314,6 +323,18 @@ module Fluent
|
|
314
323
|
send(tag, message, record) if record['querytime'].to_f >= @mongo_querytime
|
315
324
|
end
|
316
325
|
|
326
|
+
if @mongo_dataBytes > 0 && record['bytesRead']
|
327
|
+
message = 'bytesRead data is:' + record['bytesRead'].to_s
|
328
|
+
message = message + ' : ' + record['collection'] if record['collection']
|
329
|
+
send(tag, message, record) if record['bytesRead'].to_f >= @mongo_dataBytes
|
330
|
+
end
|
331
|
+
|
332
|
+
if @mongo_dataBytes > 0 && record['bytesWritten']
|
333
|
+
message = 'bytesWritten data is:' + record['bytesWritten'].to_s
|
334
|
+
message = message + ' : ' + record['collection'] if record['collection']
|
335
|
+
send(tag, message, record) if record['bytesWritten'].to_f >= @mongo_dataBytes
|
336
|
+
end
|
337
|
+
|
317
338
|
return record
|
318
339
|
end
|
319
340
|
|
data/sample/source.conf
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-light-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- LIN LI
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|