fluent-plugin-light-core 0.1.8 → 0.1.9
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 +25 -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: 2433cbe7616d4740d7722d4438d18c91aa599db380962943e368af9277b3cd2c
|
4
|
+
data.tar.gz: f8cb6f8a1f512b55b4d6340101363ad88c536f8983c9cbe7a644ab1cbc25f325
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '08df5f1170b4f9f23e24c05883154af18d74146afaa8f3eca8e96b5d462d241a2115c6ea3fd424cf4da070d86e4bf4ff64d0bf1c637c3d4f20a691c81793fbe1'
|
7
|
+
data.tar.gz: 69bbf8f5dc12be010404a76214576324febb1ae1cba9781279641f0b29e9362e7f3abc0a19daeb2876c30d84bb86f76305a7f3b0a983765831c3e386de6b7791
|
@@ -222,6 +222,7 @@ module Fluent
|
|
222
222
|
record.delete('file')
|
223
223
|
record.delete('time')
|
224
224
|
|
225
|
+
# 旧版本日志格式解析
|
225
226
|
if /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}\+\d{4} [A-Z]/.match(log)
|
226
227
|
|
227
228
|
item = /^(?<time>[^ ]*) (?<severity>[A-Z])\s* (?<component>(-|([^ ]*)))\s* \[(?<context>[^\]]*)\]\s* ((?<query>.*) protocol:op_query (?<querytime>[\d\.]+(?=ms))|(?<message>.*))/.match(log)
|
@@ -249,6 +250,30 @@ module Fluent
|
|
249
250
|
end
|
250
251
|
end
|
251
252
|
|
253
|
+
return record
|
254
|
+
else
|
255
|
+
|
256
|
+
# 版本4.4开始,默认日志为json格式
|
257
|
+
item = JSON.parse(log)
|
258
|
+
record['time'] = item['t']['$date']
|
259
|
+
record['severity'] = item['s']
|
260
|
+
record['component'] = item['c']
|
261
|
+
record['context'] = item['ctx']
|
262
|
+
record['identifier'] = item['id']
|
263
|
+
record['message'] = item['msg']
|
264
|
+
|
265
|
+
attributes = item['attr']
|
266
|
+
if attributes
|
267
|
+
record['querytime'] = attributes['durationMillis']
|
268
|
+
record['collection'] = attributes['ns']
|
269
|
+
record['command'] = attributes['command']
|
270
|
+
record['attr'] = attributes
|
271
|
+
end
|
272
|
+
|
273
|
+
record['tags'] = item['tags']
|
274
|
+
record['truncated'] = item['truncated']
|
275
|
+
record['size'] = item['size']
|
276
|
+
|
252
277
|
return record
|
253
278
|
end
|
254
279
|
|
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.1.
|
4
|
+
version: 0.1.9
|
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-01-
|
11
|
+
date: 2021-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|