fluent-plugin-light-core 0.1.8 → 0.1.9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f402d3e7add5f4132e862aad254907c08f73068b8e92b4cf82f12c7e64fc01d7
4
- data.tar.gz: a03cc3f47b6061a4567f7467d2786dac007e28deede646d511a5de7a58040796
3
+ metadata.gz: 2433cbe7616d4740d7722d4438d18c91aa599db380962943e368af9277b3cd2c
4
+ data.tar.gz: f8cb6f8a1f512b55b4d6340101363ad88c536f8983c9cbe7a644ab1cbc25f325
5
5
  SHA512:
6
- metadata.gz: 3ffb7670974e375d66d460237f94de74e2f10d308e72d4b9e2cf62c7fc9113da24e957fad8a17a9af81f8f9b2ac32b93775e3ea24cfa7e4c820e14ccda1347b0
7
- data.tar.gz: 5ca326bae0e725610ddf20775db3cb254217497544d60ffbe3f5f4a5d0ecd6176e2b5c3595a65e2abfdd670cd269ec590196c346eb38a6fac7ab658a6ae4eccd
6
+ metadata.gz: '08df5f1170b4f9f23e24c05883154af18d74146afaa8f3eca8e96b5d462d241a2115c6ea3fd424cf4da070d86e4bf4ff64d0bf1c637c3d4f20a691c81793fbe1'
7
+ data.tar.gz: 69bbf8f5dc12be010404a76214576324febb1ae1cba9781279641f0b29e9362e7f3abc0a19daeb2876c30d84bb86f76305a7f3b0a983765831c3e386de6b7791
@@ -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.1.8"
6
+ spec.version = "0.1.9"
7
7
  spec.authors = ["LIN LI"]
8
8
  spec.email = ["l.li@alphabets.cn"]
9
9
 
@@ -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.8
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-21 00:00:00.000000000 Z
11
+ date: 2021-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler