fluent-plugin-grok-parser 2.1.0 → 2.1.1
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 +4 -4
- data/.travis.yml +2 -1
- data/README.md +8 -0
- data/fluent-plugin-grok-parser.gemspec +1 -1
- data/lib/fluent/plugin/parser_grok.rb +2 -1
- data/test/test_grok_parser_in_tcp.rb +49 -22
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e060afabd9e4d73423021b054e7e5ee3039d3c61
|
4
|
+
data.tar.gz: 034f70ce29e90780e1400cceef99e7846593215d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89b109daae28b9a9a353fa2f8e18c96c8bd756fef61a8f9ab80a57c2063791bbd862e880246f638dff4a5ed9c63d171280d28f604df1b49076ba82f69cddcdab
|
7
|
+
data.tar.gz: 53d9839896675c45ebcfbcc0ad4aa3019ac24cb06d4f80667efef2d263e51901b24ba9e3a0d43213cf98782539d912dbeba2263bc5d471f9cd2d08f410261dce
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
|
3
3
|
This is a Fluentd plugin to enable Logstash's Grok-like parsing logic.
|
4
4
|
|
5
|
+
## Requirements
|
6
|
+
|
7
|
+
| fluent-plugin-grok-parser | fluentd | ruby |
|
8
|
+
|---------------------------|------------|--------|
|
9
|
+
| >= 1.0.0 | >= v0.14.0 | >= 2.1 |
|
10
|
+
| < 1.0.0 | >= v0.12.0 | >= 1.9 |
|
11
|
+
|
12
|
+
|
5
13
|
## What's Grok?
|
6
14
|
|
7
15
|
Grok is a macro to simplify and reuse regexes, originally developed by [Jordan Sissel](http://github.com/jordansissel).
|
@@ -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-grok-parser"
|
7
|
-
spec.version = "2.1.
|
7
|
+
spec.version = "2.1.1"
|
8
8
|
spec.authors = ["kiyoto", "Kenji Okimoto"]
|
9
9
|
spec.email = ["kiyoto@treasure-data.com", "okimoto@clear-code.com"]
|
10
10
|
spec.summary = %q{Fluentd plugin to support Logstash-inspired Grok format for parsing logs}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require "fluent/plugin/grok"
|
2
|
+
require "fluent/plugin/parser_none"
|
2
3
|
|
3
4
|
module Fluent
|
4
5
|
module Plugin
|
@@ -16,7 +17,7 @@ module Fluent
|
|
16
17
|
|
17
18
|
def initialize
|
18
19
|
super
|
19
|
-
@default_parser = NoneParser.new
|
20
|
+
@default_parser = Fluent::Plugin::NoneParser.new
|
20
21
|
end
|
21
22
|
|
22
23
|
def configure(conf={})
|
@@ -24,43 +24,67 @@ class TcpInputWithGrokTest < Test::Unit::TestCase
|
|
24
24
|
BASE_CONFIG = %[
|
25
25
|
port #{PORT}
|
26
26
|
tag tcp
|
27
|
-
format grok
|
28
27
|
]
|
29
28
|
CONFIG = BASE_CONFIG + %[
|
30
29
|
bind 127.0.0.1
|
30
|
+
<parse>
|
31
|
+
@type grok
|
32
|
+
</parse>
|
31
33
|
]
|
32
34
|
IPv6_CONFIG = BASE_CONFIG + %[
|
33
35
|
bind ::1
|
36
|
+
<parse>
|
37
|
+
@type grok
|
38
|
+
</parse>
|
34
39
|
]
|
35
40
|
|
36
41
|
def create_driver(conf)
|
37
|
-
Fluent::Test::Driver::Input.new(Fluent::TcpInput).configure(conf)
|
42
|
+
Fluent::Test::Driver::Input.new(Fluent::Plugin::TcpInput).configure(conf)
|
38
43
|
end
|
39
44
|
|
40
|
-
|
41
|
-
configs = {
|
42
|
-
configs.
|
43
|
-
|
44
|
-
configs
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
45
|
+
data do
|
46
|
+
configs = {}
|
47
|
+
configs[:ipv4] = ["127.0.0.1", CONFIG]
|
48
|
+
configs[:ipv6] = ["::1", IPv6_CONFIG] if ipv6_enabled?
|
49
|
+
configs
|
50
|
+
end
|
51
|
+
def test_configure(data)
|
52
|
+
k, config = data
|
53
|
+
d = create_driver(config)
|
54
|
+
assert_equal PORT, d.instance.port
|
55
|
+
assert_equal k, d.instance.bind
|
56
|
+
assert_equal "\n", d.instance.delimiter
|
50
57
|
end
|
51
58
|
|
52
59
|
def test_grok_pattern
|
60
|
+
tests = [
|
61
|
+
{"msg" => "tcptest1\n", "expected" => "tcptest1"},
|
62
|
+
{"msg" => "tcptest2\n", "expected" => "tcptest2"},
|
63
|
+
]
|
64
|
+
config = %[
|
65
|
+
<parse>
|
66
|
+
@type grok
|
67
|
+
grok_pattern %{GREEDYDATA:message}
|
68
|
+
</parse>
|
69
|
+
]
|
70
|
+
|
71
|
+
internal_test_grok(config, tests)
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_grok_pattern_block_config
|
53
75
|
tests = [
|
54
76
|
{"msg" => "tcptest1\n", "expected" => "tcptest1"},
|
55
77
|
{"msg" => "tcptest2\n", "expected" => "tcptest2"},
|
56
78
|
]
|
57
79
|
block_config = %[
|
58
|
-
<
|
59
|
-
|
60
|
-
|
80
|
+
<parse>
|
81
|
+
@type grok
|
82
|
+
<grok>
|
83
|
+
pattern %{GREEDYDATA:message}
|
84
|
+
</grok>
|
85
|
+
</parse>
|
61
86
|
]
|
62
87
|
|
63
|
-
internal_test_grok("grok_pattern %{GREEDYDATA:message}", tests)
|
64
88
|
internal_test_grok(block_config, tests)
|
65
89
|
end
|
66
90
|
|
@@ -70,12 +94,15 @@ class TcpInputWithGrokTest < Test::Unit::TestCase
|
|
70
94
|
{"msg" => "The first word matches\n", "expected" => "The"}
|
71
95
|
]
|
72
96
|
block_config = %[
|
73
|
-
<
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
97
|
+
<parse>
|
98
|
+
@type grok
|
99
|
+
<grok>
|
100
|
+
pattern %{TIMESTAMP_ISO8601:message}
|
101
|
+
</grok>
|
102
|
+
<grok>
|
103
|
+
pattern %{WORD:message}
|
104
|
+
</grok>
|
105
|
+
</parse>
|
79
106
|
]
|
80
107
|
internal_test_grok(block_config, tests)
|
81
108
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-grok-parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kiyoto
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-02-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -131,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
131
131
|
version: '0'
|
132
132
|
requirements: []
|
133
133
|
rubyforge_project:
|
134
|
-
rubygems_version: 2.6.
|
134
|
+
rubygems_version: 2.6.8
|
135
135
|
signing_key:
|
136
136
|
specification_version: 4
|
137
137
|
summary: Fluentd plugin to support Logstash-inspired Grok format for parsing logs
|