fluent-plugin-grok-parser 2.2.0 → 2.3.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 +4 -4
- data/README.md +2 -2
- data/fluent-plugin-grok-parser.gemspec +1 -1
- data/lib/fluent/plugin/grok.rb +4 -1
- data/test/test_grok_parser.rb +20 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb787befdf7b8b3d1451c48cff1462e0f3ca40db0bf3c97b3a76ae112e509cdf
|
4
|
+
data.tar.gz: f783cd9143f07e7c5c95cc5da9aeb3a80c20549befa29ca8bcc7814b31fde0ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3052cb7600aeeea43ac4c2d7ccf610cfc552e8d88c5e309487d90a843a054ff57d94ae139effa2d46e343a95a095b3c18b42f9d447d4e2b8e644103fd0ad2b6f
|
7
|
+
data.tar.gz: 9b48ea10a3f51661f9343d691271a0ac55a5c971834033401b54ecd6a001507e414bc5240d3d5ccaf4699e8b6d410d2142c697a269abb1fd7d855fea57adfa84
|
data/README.md
CHANGED
@@ -154,10 +154,10 @@ This generates following events:
|
|
154
154
|
@type tail
|
155
155
|
path /path/to/log
|
156
156
|
tag grokked_log
|
157
|
-
grok_name_key grok_name
|
158
|
-
grok_failure_key grokfailure
|
159
157
|
<parse>
|
160
158
|
@type grok
|
159
|
+
grok_name_key grok_name
|
160
|
+
grok_failure_key grokfailure
|
161
161
|
<grok>
|
162
162
|
name apache_log
|
163
163
|
pattern %{COMBINEDAPACHELOG}
|
@@ -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.
|
7
|
+
spec.version = "2.3.0"
|
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}
|
data/lib/fluent/plugin/grok.rb
CHANGED
@@ -33,6 +33,9 @@ module Fluent
|
|
33
33
|
if @plugin.respond_to?(:multiline_start_regexp) && @plugin.multiline_start_regexp
|
34
34
|
@multiline_start_regexp = Regexp.compile(@plugin.multiline_start_regexp[1..-2])
|
35
35
|
end
|
36
|
+
if @plugin.respond_to?(:keep_time_key)
|
37
|
+
@keep_time_key = @plugin.keep_time_key
|
38
|
+
end
|
36
39
|
end
|
37
40
|
|
38
41
|
def add_patterns_from_file(path)
|
@@ -68,7 +71,7 @@ module Fluent
|
|
68
71
|
unless types.empty?
|
69
72
|
_conf["types"] = types.map{|subname,type| "#{subname}:#{type}" }.join(",")
|
70
73
|
end
|
71
|
-
_conf = _conf.merge("expression" => regexp, "multiline" => @multiline_mode)
|
74
|
+
_conf = _conf.merge("expression" => regexp, "multiline" => @multiline_mode, "keep_time_key" => @keep_time_key)
|
72
75
|
config = Fluent::Config::Element.new("parse", nil, _conf, [])
|
73
76
|
parser = Fluent::Plugin::RegexpParser.new
|
74
77
|
parser.configure(config)
|
data/test/test_grok_parser.rb
CHANGED
@@ -301,6 +301,26 @@ class GrokParserTest < ::Test::Unit::TestCase
|
|
301
301
|
end
|
302
302
|
end
|
303
303
|
|
304
|
+
sub_test_case "keep_time_key" do
|
305
|
+
test "true" do
|
306
|
+
d = create_driver(%[
|
307
|
+
keep_time_key true
|
308
|
+
<grok>
|
309
|
+
pattern "%{TIMESTAMP_ISO8601:time}"
|
310
|
+
</grok>
|
311
|
+
])
|
312
|
+
expected = [
|
313
|
+
{ "time" => "2014-01-01T00:00:00+0900" }
|
314
|
+
]
|
315
|
+
records = []
|
316
|
+
d.instance.parse("Some stuff at 2014-01-01T00:00:00+0900") do |time, record|
|
317
|
+
assert_equal(event_time("2014-01-01T00:00:00+0900"), time)
|
318
|
+
records << record
|
319
|
+
end
|
320
|
+
assert_equal(expected, records)
|
321
|
+
end
|
322
|
+
end
|
323
|
+
|
304
324
|
private
|
305
325
|
|
306
326
|
def create_driver(conf)
|
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.
|
4
|
+
version: 2.3.0
|
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: 2018-
|
12
|
+
date: 2018-09-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|