fluent-plugin-grok-parser 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -2
- data/Rakefile +5 -5
- data/fluent-plugin-grok-parser.gemspec +3 -3
- data/lib/fluent/plugin/grok.rb +13 -13
- data/lib/fluent/plugin/parser_grok.rb +12 -12
- data/lib/fluent/plugin/parser_multiline_grok.rb +4 -4
- data/test/helper.rb +5 -1
- data/test/test_grok_parser.rb +34 -38
- data/test/test_grok_parser_in_tcp.rb +13 -14
- data/test/test_multiline_grok_parser.rb +4 -3
- 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: 12eb3847dea9ea73c534101a7ab66da42fdde1c9
|
4
|
+
data.tar.gz: a4266d71bffd2d8b090330f998465ca4ca284521
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2eaab2b69773e7a6438ea7f2826cf20141b32d1f479ff81019ce0d8a8705bff1398f7585b85a18fba3803b3f42acc60470424899c6d017771b52bb8f9c4b5239
|
7
|
+
data.tar.gz: 38d37a71b73564647b9d1e31000e3c34a75a4bf6c7c45adf7b7412a7924a407cbcde83e56dea9f15badb8b05e0a9527311af698f1b880158d1c254ba2b2ee412
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Grok Parser for Fluentd [![Build Status](https://travis-ci.org/
|
1
|
+
# Grok Parser for Fluentd [![Build Status](https://travis-ci.org/fluent/fluent-plugin-grok-parser.svg?branch=master)](https://travis-ci.org/fluent/fluent-plugin-grok-parser)
|
2
2
|
|
3
3
|
This is a Fluentd plugin to enable Logstash's Grok-like parsing logic.
|
4
4
|
|
@@ -169,7 +169,7 @@ Please see `patterns/*` for the patterns that are supported out of the box.
|
|
169
169
|
You can add your own Grok patterns by creating your own Grok file and telling the plugin to read it.
|
170
170
|
This is what the `custom_pattern_path` parameter is for.
|
171
171
|
|
172
|
-
```
|
172
|
+
```aconf
|
173
173
|
<source>
|
174
174
|
@type tail
|
175
175
|
path /path/to/log
|
@@ -232,6 +232,8 @@ Here is a sample config using the Grok parser with `in_tail` and the `types` par
|
|
232
232
|
|
233
233
|
If you want to use this plugin with Fluentd v0.12.x or earlier, you can use this plugin version v1.0.0.
|
234
234
|
|
235
|
+
See also: [Plugin Management | Fluentd](http://docs.fluentd.org/articles/plugin-management#ldquomdashgemfilerdquo-option)
|
236
|
+
|
235
237
|
## License
|
236
238
|
|
237
239
|
Apache 2.0 License
|
data/Rakefile
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
#!/usr/bin/env rake
|
2
2
|
require "bundler/gem_tasks"
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "rake/testtask"
|
4
|
+
require "rake/clean"
|
5
5
|
|
6
6
|
task :test => [:base_test]
|
7
7
|
|
8
|
-
desc
|
8
|
+
desc "Run test_unit based test"
|
9
9
|
Rake::TestTask.new(:base_test) do |t|
|
10
10
|
t.libs << "test"
|
11
11
|
t.test_files = (Dir["test/test_*.rb"] + Dir["test/plugin/test_*.rb"] - ["helper.rb"]).sort
|
@@ -13,8 +13,8 @@ Rake::TestTask.new(:base_test) do |t|
|
|
13
13
|
# t.warning = false
|
14
14
|
end
|
15
15
|
|
16
|
-
desc
|
17
|
-
task
|
16
|
+
desc "Import patterns from submodules"
|
17
|
+
task "patterns:import" do
|
18
18
|
`git submodule --quiet foreach pwd`.split($\).each do |submodule_path|
|
19
19
|
Dir.glob(File.join(submodule_path, "patterns/*")) do |pattern|
|
20
20
|
cp(pattern, "patterns/", verbose: true)
|
@@ -1,14 +1,14 @@
|
|
1
1
|
# coding: utf-8
|
2
|
-
lib = File.expand_path(
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
3
|
$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.0.
|
7
|
+
spec.version = "2.0.1"
|
8
8
|
spec.authors = ["kiyoto"]
|
9
9
|
spec.email = ["kiyoto@treasure-data.com"]
|
10
10
|
spec.summary = %q{Fluentd plugin to support Logstash-inspired Grok format for parsing logs}
|
11
|
-
spec.homepage = "https://github.com/
|
11
|
+
spec.homepage = "https://github.com/fluent/fluent-plugin-grok-parser"
|
12
12
|
spec.license = "Apache-2.0"
|
13
13
|
|
14
14
|
spec.files = `git ls-files`.split($/)
|
data/lib/fluent/plugin/grok.rb
CHANGED
@@ -27,26 +27,26 @@ module Fluent
|
|
27
27
|
if plugin.respond_to?(:firstline?)
|
28
28
|
@multiline_mode = true
|
29
29
|
end
|
30
|
-
if @conf[
|
31
|
-
@multiline_start_regexp = Regexp.compile(@conf[
|
30
|
+
if @conf["multiline_start_regexp"]
|
31
|
+
@multiline_start_regexp = Regexp.compile(@conf["multiline_start_regexp"][1..-2])
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
35
|
def add_patterns_from_file(path)
|
36
36
|
File.new(path).each_line do |line|
|
37
|
-
next if line[0] ==
|
37
|
+
next if line[0] == "#" || /^$/ =~ line
|
38
38
|
name, pat = line.chomp.split(/\s+/, 2)
|
39
39
|
@pattern_map[name] = pat
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
43
|
def setup
|
44
|
-
if @conf[
|
45
|
-
@parsers << expand_pattern_expression(@conf[
|
44
|
+
if @conf["grok_pattern"]
|
45
|
+
@parsers << expand_pattern_expression(@conf["grok_pattern"], @conf)
|
46
46
|
else
|
47
|
-
grok_confs = @conf.elements.select {|e| e.name ==
|
47
|
+
grok_confs = @conf.elements.select {|e| e.name == "grok"}
|
48
48
|
grok_confs.each do |grok_conf|
|
49
|
-
@parsers << expand_pattern_expression(grok_conf[
|
49
|
+
@parsers << expand_pattern_expression(grok_conf["pattern"], grok_conf)
|
50
50
|
end
|
51
51
|
end
|
52
52
|
end
|
@@ -56,18 +56,18 @@ module Fluent
|
|
56
56
|
def expand_pattern_expression(grok_pattern, conf)
|
57
57
|
regexp, types = expand_pattern(grok_pattern)
|
58
58
|
$log.info "Expanded the pattern #{conf['grok_pattern']} into #{regexp}"
|
59
|
-
options = nil
|
60
|
-
if @multiline_mode
|
61
|
-
options = Regexp::MULTILINE
|
62
|
-
end
|
63
59
|
unless types.empty?
|
64
60
|
conf["types"] = types.map{|subname,type| "#{subname}:#{type}" }.join(",")
|
65
61
|
end
|
66
|
-
|
62
|
+
_conf = conf.merge("expression" => regexp, "multiline" => @multiline_mode)
|
63
|
+
config = Fluent::Config::Element.new("parse", nil, _conf, [])
|
64
|
+
parser = Fluent::Plugin::RegexpParser.new
|
65
|
+
parser.configure(config)
|
66
|
+
parser
|
67
67
|
rescue GrokPatternNotFoundError => e
|
68
68
|
raise e
|
69
69
|
rescue => e
|
70
|
-
$log.error e
|
70
|
+
$log.error(error: e)
|
71
71
|
end
|
72
72
|
|
73
73
|
def expand_pattern(pattern)
|
@@ -2,17 +2,15 @@ require "fluent/plugin/grok"
|
|
2
2
|
|
3
3
|
module Fluent
|
4
4
|
module Plugin
|
5
|
-
class GrokPatternNotFoundError < Exception; end
|
6
|
-
|
7
5
|
class GrokParser < Parser
|
8
|
-
Fluent::Plugin.register_parser(
|
6
|
+
Fluent::Plugin.register_parser("grok", self)
|
9
7
|
|
10
|
-
desc
|
11
|
-
config_param :time_format, :string, :
|
12
|
-
desc
|
13
|
-
config_param :grok_pattern, :string, :
|
14
|
-
desc
|
15
|
-
config_param :custom_pattern_path, :string, :
|
8
|
+
desc "The format of the time field."
|
9
|
+
config_param :time_format, :string, default: nil
|
10
|
+
desc "The pattern of grok"
|
11
|
+
config_param :grok_pattern, :string, default: nil
|
12
|
+
desc "Path to the file that includes custom grok patterns"
|
13
|
+
config_param :custom_pattern_path, :string, default: nil
|
16
14
|
|
17
15
|
def initialize
|
18
16
|
super
|
@@ -24,14 +22,14 @@ module Fluent
|
|
24
22
|
|
25
23
|
@grok = Grok.new(self, conf)
|
26
24
|
|
27
|
-
default_pattern_dir = File.expand_path(
|
25
|
+
default_pattern_dir = File.expand_path("../../../../patterns/*", __FILE__)
|
28
26
|
Dir.glob(default_pattern_dir) do |pattern_file_path|
|
29
27
|
@grok.add_patterns_from_file(pattern_file_path)
|
30
28
|
end
|
31
29
|
|
32
30
|
if @custom_pattern_path
|
33
31
|
if Dir.exist? @custom_pattern_path
|
34
|
-
Dir.glob(@custom_pattern_path +
|
32
|
+
Dir.glob(@custom_pattern_path + "/*") do |pattern_file_path|
|
35
33
|
@grok.add_patterns_from_file(pattern_file_path)
|
36
34
|
end
|
37
35
|
elsif File.exist? @custom_pattern_path
|
@@ -51,7 +49,9 @@ module Fluent
|
|
51
49
|
end
|
52
50
|
end
|
53
51
|
end
|
54
|
-
|
52
|
+
@default_parser.parse(text) do |time, record|
|
53
|
+
yield time, record
|
54
|
+
end
|
55
55
|
end
|
56
56
|
end
|
57
57
|
end
|
@@ -1,12 +1,12 @@
|
|
1
|
-
require
|
1
|
+
require "fluent/plugin/parser_grok"
|
2
2
|
|
3
3
|
module Fluent
|
4
4
|
module Plugin
|
5
5
|
class MultilineGrokParser < GrokParser
|
6
|
-
Fluent::Plugin.register_parser(
|
6
|
+
Fluent::Plugin.register_parser("multiline_grok", self)
|
7
7
|
|
8
|
-
desc
|
9
|
-
config_param :multiline_start_regexp, :string, :
|
8
|
+
desc "The regexp to match beginning of multiline"
|
9
|
+
config_param :multiline_start_regexp, :string, default: nil
|
10
10
|
|
11
11
|
def initialize
|
12
12
|
super
|
data/test/helper.rb
CHANGED
@@ -1,6 +1,10 @@
|
|
1
|
+
require "fluent/test"
|
2
|
+
require "fluent/test/helpers"
|
1
3
|
require "fluent/test/driver/input"
|
2
4
|
require "fluent/test/driver/parser"
|
3
5
|
|
6
|
+
Test::Unit::TestCase.include(Fluent::Test::Helpers)
|
7
|
+
|
4
8
|
def unused_port
|
5
9
|
s = TCPServer.open(0)
|
6
10
|
port = s.addr[1]
|
@@ -9,7 +13,7 @@ def unused_port
|
|
9
13
|
end
|
10
14
|
|
11
15
|
def ipv6_enabled?
|
12
|
-
require
|
16
|
+
require "socket"
|
13
17
|
|
14
18
|
begin
|
15
19
|
TCPServer.open("::1", 0)
|
data/test/test_grok_parser.rb
CHANGED
@@ -1,10 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require 'tempfile'
|
5
|
-
|
6
|
-
|
7
|
-
include Fluent
|
1
|
+
require "helper"
|
2
|
+
require "tempfile"
|
3
|
+
require "fluent/plugin/parser_grok"
|
8
4
|
|
9
5
|
def str2time(str_time, format = nil)
|
10
6
|
if format
|
@@ -17,40 +13,40 @@ end
|
|
17
13
|
class GrokParserTest < ::Test::Unit::TestCase
|
18
14
|
class Timestamp < self
|
19
15
|
def test_timestamp_iso8601
|
20
|
-
internal_test_grok_pattern(
|
21
|
-
|
16
|
+
internal_test_grok_pattern("%{TIMESTAMP_ISO8601:time}", "Some stuff at 2014-01-01T00:00:00+0900",
|
17
|
+
event_time("2014-01-01T00:00:00+0900"), {})
|
22
18
|
end
|
23
19
|
|
24
20
|
def test_datestamp_rfc822_with_zone
|
25
|
-
internal_test_grok_pattern(
|
26
|
-
|
21
|
+
internal_test_grok_pattern("%{DATESTAMP_RFC822:time}", "Some stuff at Mon Aug 15 2005 15:52:01 UTC",
|
22
|
+
event_time("Mon Aug 15 2005 15:52:01 UTC"), {})
|
27
23
|
end
|
28
24
|
|
29
25
|
def test_datestamp_rfc822_with_numeric_zone
|
30
|
-
internal_test_grok_pattern(
|
31
|
-
|
26
|
+
internal_test_grok_pattern("%{DATESTAMP_RFC2822:time}", "Some stuff at Mon, 15 Aug 2005 15:52:01 +0000",
|
27
|
+
event_time("Mon, 15 Aug 2005 15:52:01 +0000"), {})
|
32
28
|
end
|
33
29
|
|
34
30
|
def test_syslogtimestamp
|
35
|
-
internal_test_grok_pattern(
|
36
|
-
|
31
|
+
internal_test_grok_pattern("%{SYSLOGTIMESTAMP:time}", "Some stuff at Aug 01 00:00:00",
|
32
|
+
event_time("Aug 01 00:00:00"), {})
|
37
33
|
end
|
38
34
|
end
|
39
35
|
|
40
36
|
def test_call_for_grok_pattern_not_found
|
41
|
-
assert_raise Grok::GrokPatternNotFoundError do
|
42
|
-
internal_test_grok_pattern(
|
37
|
+
assert_raise Fluent::Grok::GrokPatternNotFoundError do
|
38
|
+
internal_test_grok_pattern("%{THIS_PATTERN_DOESNT_EXIST}", "Some stuff at somewhere", nil, {})
|
43
39
|
end
|
44
40
|
end
|
45
41
|
|
46
42
|
def test_call_for_multiple_fields
|
47
|
-
internal_test_grok_pattern(
|
43
|
+
internal_test_grok_pattern("%{MAC:mac_address} %{IP:ip_address}", "this.wont.match DEAD.BEEF.1234 127.0.0.1", nil,
|
48
44
|
{"mac_address" => "DEAD.BEEF.1234", "ip_address" => "127.0.0.1"})
|
49
45
|
end
|
50
46
|
|
51
47
|
def test_call_for_complex_pattern
|
52
|
-
internal_test_grok_pattern(
|
53
|
-
str2time(
|
48
|
+
internal_test_grok_pattern("%{COMBINEDAPACHELOG}", '127.0.0.1 192.168.0.1 - [28/Feb/2013:12:00:00 +0900] "GET / HTTP/1.1" 200 777 "-" "Opera/12.0"',
|
49
|
+
str2time("28/Feb/2013:12:00:00 +0900", "%d/%b/%Y:%H:%M:%S %z"),
|
54
50
|
{
|
55
51
|
"clientip" => "127.0.0.1",
|
56
52
|
"ident" => "192.168.0.1",
|
@@ -73,7 +69,7 @@ class GrokParserTest < ::Test::Unit::TestCase
|
|
73
69
|
pattern_file.write("MY_AWESOME_PATTERN %{GREEDYDATA:message}\n")
|
74
70
|
pattern_file.close
|
75
71
|
begin
|
76
|
-
internal_test_grok_pattern(
|
72
|
+
internal_test_grok_pattern("%{MY_AWESOME_PATTERN:message}", "this is awesome",
|
77
73
|
nil, {"message" => "this is awesome"},
|
78
74
|
"custom_pattern_path" => pattern_file.path
|
79
75
|
)
|
@@ -84,53 +80,53 @@ class GrokParserTest < ::Test::Unit::TestCase
|
|
84
80
|
|
85
81
|
class OptionalType < self
|
86
82
|
def test_simple
|
87
|
-
internal_test_grok_pattern(
|
88
|
-
|
83
|
+
internal_test_grok_pattern("%{INT:user_id:integer} paid %{NUMBER:paid_amount:float}",
|
84
|
+
"12345 paid 6789.10", nil,
|
89
85
|
{"user_id" => 12345, "paid_amount" => 6789.1 })
|
90
86
|
end
|
91
87
|
|
92
88
|
def test_array
|
93
|
-
internal_test_grok_pattern(
|
94
|
-
|
89
|
+
internal_test_grok_pattern("%{GREEDYDATA:message:array}",
|
90
|
+
"a,b,c,d", nil,
|
95
91
|
{"message" => %w(a b c d)})
|
96
92
|
end
|
97
93
|
|
98
94
|
def test_array_with_delimiter
|
99
|
-
internal_test_grok_pattern(
|
100
|
-
|
95
|
+
internal_test_grok_pattern("%{GREEDYDATA:message:array:|}",
|
96
|
+
"a|b|c|d", nil,
|
101
97
|
{"message" => %w(a b c d)})
|
102
98
|
end
|
103
99
|
|
104
100
|
def test_timestamp_iso8601
|
105
|
-
internal_test_grok_pattern(
|
106
|
-
nil, {"stamp" =>
|
101
|
+
internal_test_grok_pattern("%{TIMESTAMP_ISO8601:stamp:time}", "Some stuff at 2014-01-01T00:00:00+0900",
|
102
|
+
nil, {"stamp" => event_time("2014-01-01T00:00:00+0900")})
|
107
103
|
end
|
108
104
|
|
109
105
|
def test_datestamp_rfc822_with_zone
|
110
|
-
internal_test_grok_pattern(
|
111
|
-
nil, {"stamp" =>
|
106
|
+
internal_test_grok_pattern("%{DATESTAMP_RFC822:stamp:time}", "Some stuff at Mon Aug 15 2005 15:52:01 UTC",
|
107
|
+
nil, {"stamp" => event_time("Mon Aug 15 2005 15:52:01 UTC")})
|
112
108
|
end
|
113
109
|
|
114
110
|
def test_datestamp_rfc822_with_numeric_zone
|
115
|
-
internal_test_grok_pattern(
|
116
|
-
nil, {"stamp" =>
|
111
|
+
internal_test_grok_pattern("%{DATESTAMP_RFC2822:stamp:time}", "Some stuff at Mon, 15 Aug 2005 15:52:01 +0000",
|
112
|
+
nil, {"stamp" => event_time("Mon, 15 Aug 2005 15:52:01 +0000")})
|
117
113
|
end
|
118
114
|
|
119
115
|
def test_syslogtimestamp
|
120
|
-
internal_test_grok_pattern(
|
121
|
-
nil, {"stamp" =>
|
116
|
+
internal_test_grok_pattern("%{SYSLOGTIMESTAMP:stamp:time}", "Some stuff at Aug 01 00:00:00",
|
117
|
+
nil, {"stamp" => event_time("Aug 01 00:00:00")})
|
122
118
|
end
|
123
119
|
|
124
120
|
def test_timestamp_with_format
|
125
|
-
internal_test_grok_pattern(
|
126
|
-
nil, {"stamp" =>
|
121
|
+
internal_test_grok_pattern("%{TIMESTAMP_ISO8601:stamp:time:%Y-%m-%d %H%M}", "Some stuff at 2014-01-01 1000",
|
122
|
+
nil, {"stamp" => event_time("2014-01-01 10:00")})
|
127
123
|
end
|
128
124
|
end
|
129
125
|
|
130
126
|
private
|
131
127
|
|
132
128
|
def internal_test_grok_pattern(grok_pattern, text, expected_time, expected_record, options = {})
|
133
|
-
d
|
129
|
+
d = Fluent::Test::Driver::Parser.new(Fluent::Plugin::GrokParser).configure({"grok_pattern" => grok_pattern}.merge(options))
|
134
130
|
|
135
131
|
# for the new API
|
136
132
|
d.instance.parse(text) {|time, record|
|
@@ -1,6 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require 'fluent/plugin/in_tcp'
|
1
|
+
require "helper"
|
2
|
+
require "fluent/plugin/in_tcp"
|
4
3
|
|
5
4
|
class TcpInputWithGrokTest < Test::Unit::TestCase
|
6
5
|
if defined?(ServerEngine)
|
@@ -8,7 +7,7 @@ class TcpInputWithGrokTest < Test::Unit::TestCase
|
|
8
7
|
def startup
|
9
8
|
socket_manager_path = ServerEngine::SocketManager::Server.generate_path
|
10
9
|
@server = ServerEngine::SocketManager::Server.open(socket_manager_path)
|
11
|
-
ENV[
|
10
|
+
ENV["SERVERENGINE_SOCKETMANAGER_PATH"] = socket_manager_path.to_s
|
12
11
|
end
|
13
12
|
|
14
13
|
def shutdown
|
@@ -39,8 +38,8 @@ class TcpInputWithGrokTest < Test::Unit::TestCase
|
|
39
38
|
end
|
40
39
|
|
41
40
|
def test_configure
|
42
|
-
configs = {
|
43
|
-
configs.merge!(
|
41
|
+
configs = {"127.0.0.1" => CONFIG}
|
42
|
+
configs.merge!("::1" => IPv6_CONFIG) if ipv6_enabled?
|
44
43
|
|
45
44
|
configs.each_pair { |k, v|
|
46
45
|
d = create_driver(v)
|
@@ -52,8 +51,8 @@ class TcpInputWithGrokTest < Test::Unit::TestCase
|
|
52
51
|
|
53
52
|
def test_grok_pattern
|
54
53
|
tests = [
|
55
|
-
{
|
56
|
-
{
|
54
|
+
{"msg" => "tcptest1\n", "expected" => "tcptest1"},
|
55
|
+
{"msg" => "tcptest2\n", "expected" => "tcptest2"},
|
57
56
|
]
|
58
57
|
block_config = %[
|
59
58
|
<grok>
|
@@ -61,14 +60,14 @@ class TcpInputWithGrokTest < Test::Unit::TestCase
|
|
61
60
|
</grok>
|
62
61
|
]
|
63
62
|
|
64
|
-
internal_test_grok(
|
63
|
+
internal_test_grok("grok_pattern %{GREEDYDATA:message}", tests)
|
65
64
|
internal_test_grok(block_config, tests)
|
66
65
|
end
|
67
66
|
|
68
67
|
def test_grok_multi_patterns
|
69
68
|
tests = [
|
70
|
-
{
|
71
|
-
{
|
69
|
+
{"msg" => "Current time is 2014-01-01T00:00:00+0900\n", "expected" => "2014-01-01T00:00:00+0900"},
|
70
|
+
{"msg" => "The first word matches\n", "expected" => "The"}
|
72
71
|
]
|
73
72
|
block_config = %[
|
74
73
|
<grok>
|
@@ -85,8 +84,8 @@ class TcpInputWithGrokTest < Test::Unit::TestCase
|
|
85
84
|
d = create_driver(BASE_CONFIG + conf)
|
86
85
|
d.run(expect_emits: tests.size) do
|
87
86
|
tests.each {|test|
|
88
|
-
TCPSocket.open(
|
89
|
-
s.send(test[
|
87
|
+
TCPSocket.open("127.0.0.1", PORT) do |s|
|
88
|
+
s.send(test["msg"], 0)
|
90
89
|
end
|
91
90
|
}
|
92
91
|
end
|
@@ -97,7 +96,7 @@ class TcpInputWithGrokTest < Test::Unit::TestCase
|
|
97
96
|
def compare_test_result(events, tests)
|
98
97
|
assert_equal(2, events.size)
|
99
98
|
events.each_index {|i|
|
100
|
-
assert_equal(tests[i][
|
99
|
+
assert_equal(tests[i]["expected"], events[i][2]["message"])
|
101
100
|
}
|
102
101
|
end
|
103
102
|
end
|
@@ -1,7 +1,8 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "helper"
|
2
|
+
require "fluent/plugin/parser_multiline_grok"
|
3
|
+
require "fluent/config/parser"
|
3
4
|
|
4
|
-
require
|
5
|
+
require "stringio"
|
5
6
|
|
6
7
|
class MultilineGrokParserTest < Test::Unit::TestCase
|
7
8
|
def test_multiline
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-grok-parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kiyoto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -109,7 +109,7 @@ files:
|
|
109
109
|
- test/test_grok_parser.rb
|
110
110
|
- test/test_grok_parser_in_tcp.rb
|
111
111
|
- test/test_multiline_grok_parser.rb
|
112
|
-
homepage: https://github.com/
|
112
|
+
homepage: https://github.com/fluent/fluent-plugin-grok-parser
|
113
113
|
licenses:
|
114
114
|
- Apache-2.0
|
115
115
|
metadata: {}
|