fluent-plugin-mongo-slow-query 0.0.1 → 0.0.2

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
  SHA1:
3
- metadata.gz: 8c16e75ba54dd181782178b8aeed4eebae3f3bee
4
- data.tar.gz: f5871adf90b4e0afafc945f2d133416d9c0dd0d1
3
+ metadata.gz: 1aa827020993c3b9d101768f7cfd245287516ff1
4
+ data.tar.gz: c0345c46f856136c08952af620bc1fad0fbddaf3
5
5
  SHA512:
6
- metadata.gz: 26ca6c863a0291e93143341515e7296ecaa5902f7bf99cd164e970eaed943ba9240e39f7ff0002800c522307635a17fd315133bbee50a0e9324c6c6911ffe5f9
7
- data.tar.gz: a435abc0e37cf99a513d9fec5ec784677e6606dc19428d275d5f667761aac4a02fa8b790ce474a9f61141ac6b87933ed70accc6e3eaececc843c7b073cd4807a
6
+ metadata.gz: 37f7f5c04f34e6e93ddfb287d2092a9c6cb9f63350583c60e7153cd9b569175239140534e076448531bd3ef0e7c763b7820b9595a6447746c092ee061ea52a73
7
+ data.tar.gz: a7495ba4f6ce4a0a21672847164482b191360f0f97538962b68d2361220f2f221a4c0ea71a06ebfbbec404151a0aee182a765115a231e2bce599bfbf7ade2962
@@ -10,11 +10,15 @@ module Fluent
10
10
  # 'conf' is a Hash that includes configuration parameters.
11
11
  # If the configuration is invalid, raise Fluent::ConfigError.
12
12
  def configure(conf)
13
- if not conf.has_key?("format")
13
+ unless conf.has_key?("format")
14
14
  conf["format"] = '/(?<time>[^ ]+ [^ ]+ [^ ]+ [^ ]+) \[\w+\] (?<op>[^ ]+) (?<ns>[^ ]+) (query: (?<query>{.+}) update: (?<update>{.*}))|(query: (?<query>{.+})) .* (?<cost>\d+)ms/'
15
15
  $log.warn "load default format: ", conf["format"]
16
16
  end
17
17
 
18
+ unless conf.has_key?("time_format")
19
+ conf["time_format"] = '%a %b %d %H:%M:%S.%L'
20
+ $log.warn "load default time_format: ", conf["time_format"]
21
+ end
18
22
  super
19
23
  end
20
24
 
@@ -25,11 +29,14 @@ module Fluent
25
29
  line.chomp! # remove \n
26
30
  time, record = parse_line(line)
27
31
  if time && record
28
- # change query
32
+ # get prototype
29
33
  if record.has_key?("query")
30
34
  record["query"] = get_query_prototype(record["query"])
31
- es.add(time, record)
32
35
  end
36
+ if record.has_key?("update")
37
+ record["update"] = get_query_prototype(record["update"])
38
+ end
39
+ es.add(time, record)
33
40
  end
34
41
  rescue
35
42
  $log.warn line.dump, :error=>$!.to_s
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-mongo-slow-query
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - caosiyang