fluent-plugin-monolog 0.1.8 → 0.2.0

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: 87674206ea6024c2721003b3b8821b009677b647
4
- data.tar.gz: 870040049fbeee7caec86dd36928123e8a844035
3
+ metadata.gz: 2b5f4b67970607199edc905626cd34d204e5c122
4
+ data.tar.gz: 66df80a1e127d6c20fbfbc1e99203da726925589
5
5
  SHA512:
6
- metadata.gz: 9fd96fb63b6171b4d394cc28824dcf37513e846cabf57cf6739696ea5e4b6d7f73331f6c36d9f5781bda3337169cd10699ffc0600483b559b0d08bfff82f6c8f
7
- data.tar.gz: 4fa7962507a3117389c968f086ed2dc863a27516ac09a45feae20532bfb8568f5f46748c7b52299c74f7f8e6b2e56af9dcff4f80a3513ace262585f12d307b7f
6
+ metadata.gz: 2adca0eb3cd94d6f95b34f2b3c4c571ca05092a68054e19db6355ca2c5e16c1ada222a94240142457516acafbbce4c82f2d4546c878f14f7f2b7191f5c232d16
7
+ data.tar.gz: efc333a79860925d78e8132c729cac25cfcb150ae716f323137b533a0ff9371e082b9d5d2adb71016af582334c325e2c07b437db4d3e38544682a7cbbcdf2262
data/README.md CHANGED
@@ -19,7 +19,7 @@ We have an example for this plugin, so please use it.
19
19
 
20
20
  ## Usage
21
21
 
22
- After installed, please add configurations of [in_tail(tail Input Plugin)](http://docs.fluentd.org/v0.12/articles/in_tail) to `td-agent.conf`, like below.
22
+ After installed, please add configurations of [in_tail(tail Input Plugin)](https://docs.fluentd.org/v0.14/articles/in_tail) to `td-agent.conf`, like below.
23
23
 
24
24
  ```
25
25
  # /etc/td-agent/td-agent.conf
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "fluent-plugin-monolog"
7
- spec.version = "0.1.8"
7
+ spec.version = "0.2.0"
8
8
  spec.authors = ["imunew"]
9
9
  spec.email = ["imunew@gmail.com"]
10
10
 
@@ -29,6 +29,6 @@ Gem::Specification.new do |spec|
29
29
  spec.add_development_dependency "bundler", "~> 1.12"
30
30
  spec.add_development_dependency "rake"
31
31
  spec.add_development_dependency "test-unit", "~> 3.1"
32
- spec.add_runtime_dependency "fluentd", "~> 0.12.0"
32
+ spec.add_runtime_dependency "fluentd", [">= 0.14.0", "< 2"]
33
33
 
34
34
  end
@@ -1,50 +1,53 @@
1
+ require 'fluent/plugin/parser'
1
2
  require 'json'
2
3
 
3
4
  module Fluent
4
- class TextParser
5
- class MonologParser < Parser
6
- Fluent::Plugin.register_parser('monolog', self)
7
-
8
- REGEXP = /^\[(?<time>[\d\-]+ [\d\:]+)\] (?<channel>.+)\.(?<level>(DEBUG|INFO|NOTICE|WARNING|ERROR|CRITICAL|ALERT|EMERGENCY))\: (?<message>[^\{\}]*) (?<context>(\{.+\})|(\[.*\])) (?<extra>(\{.+\})|(\[.*\]))\s*$/
9
- TIME_FORMAT = "%Y-%m-%d %H:%M:%S"
10
-
11
- def initialize
12
- super
13
- @time_parser = TimeParser.new(TIME_FORMAT)
14
- @mutex = Mutex.new
15
- end
16
-
17
- def patterns
18
- {'format' => REGEXP, 'time_format' => TIME_FORMAT}
19
- end
5
+ module Plugin
6
+ class TextParser
7
+ class MonologParser < Parser
8
+ Fluent::Plugin.register_parser('monolog', self)
9
+
10
+ REGEXP = /^\[(?<time>[\d\-]+ [\d\:]+)\] (?<channel>.+)\.(?<level>(DEBUG|INFO|NOTICE|WARNING|ERROR|CRITICAL|ALERT|EMERGENCY))\: (?<message>[^\{\}]*) (?<context>(\{.+\})|(\[.*\])) (?<extra>(\{.+\})|(\[.*\]))\s*$/
11
+ TIME_FORMAT = "%Y-%m-%d %H:%M:%S"
12
+
13
+ def initialize
14
+ super
15
+ @time_parser = TimeParser.new(TIME_FORMAT)
16
+ @mutex = Mutex.new
17
+ end
20
18
 
21
- def parse(text)
22
- m = REGEXP.match(text)
23
- unless m
24
- yield nil, nil
25
- return
19
+ def patterns
20
+ {'format' => REGEXP, 'time_format' => TIME_FORMAT}
26
21
  end
27
22
 
28
- time = m['time']
29
- time = @mutex.synchronize { @time_parser.parse(time) }
30
-
31
- channel = m['channel']
32
- level = m['level']
33
- message = m['message']
34
- context = JSON.parse(m['context'])
35
- extra = JSON.parse(m['extra'])
36
-
37
- record = {
38
- "channel" => channel,
39
- "level" => level,
40
- "message" => message,
41
- "context" => context,
42
- "extra" => extra
43
- }
44
- record["time"] = m['time'] if @keep_time_key
45
-
46
- yield time, record
23
+ def parse(text)
24
+ m = REGEXP.match(text)
25
+ unless m
26
+ yield nil, nil
27
+ return
28
+ end
29
+
30
+ time = m['time']
31
+ time = @mutex.synchronize { @time_parser.parse(time) }
32
+
33
+ channel = m['channel']
34
+ level = m['level']
35
+ message = m['message']
36
+ context = JSON.parse(m['context'])
37
+ extra = JSON.parse(m['extra'])
38
+
39
+ record = {
40
+ "channel" => channel,
41
+ "level" => level,
42
+ "message" => message,
43
+ "context" => context,
44
+ "extra" => extra
45
+ }
46
+ record["time"] = m['time'] if @keep_time_key
47
+
48
+ yield time, record
49
+ end
47
50
  end
48
51
  end
49
52
  end
50
- end
53
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-monolog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - imunew
@@ -56,16 +56,22 @@ dependencies:
56
56
  name: fluentd
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 0.14.0
62
+ - - "<"
60
63
  - !ruby/object:Gem::Version
61
- version: 0.12.0
64
+ version: '2'
62
65
  type: :runtime
63
66
  prerelease: false
64
67
  version_requirements: !ruby/object:Gem::Requirement
65
68
  requirements:
66
- - - "~>"
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: 0.14.0
72
+ - - "<"
67
73
  - !ruby/object:Gem::Version
68
- version: 0.12.0
74
+ version: '2'
69
75
  description: Fluentd parser plugin to parse log text from monolog
70
76
  email:
71
77
  - imunew@gmail.com