fluent-plugin-ltsv-parser 0.0.6 → 0.0.7
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.
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
Gem::Specification.new do |gem|
|
3
3
|
gem.name = "fluent-plugin-ltsv-parser"
|
4
|
-
gem.version = "0.0.
|
4
|
+
gem.version = "0.0.7"
|
5
5
|
gem.authors = ["anarcher"]
|
6
6
|
gem.email = ["anarcher@gmail.com"]
|
7
7
|
gem.description = %q{fluentd plugin to ltsv parse single field, or to combine log structure into single field}
|
@@ -6,6 +6,7 @@ class Fluent::ParserOutput < Fluent::Output
|
|
6
6
|
config_param :key_name, :string
|
7
7
|
config_param :filter_in, :string , :default => ""
|
8
8
|
config_param :add_prefix, :string ,:default => nil
|
9
|
+
config_param :min_field, :integer , :default => nil
|
9
10
|
|
10
11
|
def initialize
|
11
12
|
super
|
@@ -46,17 +47,22 @@ class Fluent::ParserOutput < Fluent::Output
|
|
46
47
|
private
|
47
48
|
|
48
49
|
def filter(record)
|
49
|
-
if @filter_in.length
|
50
|
-
|
51
|
-
|
50
|
+
if @filter_in.length <= 0 then
|
51
|
+
return record
|
52
|
+
end
|
53
|
+
|
54
|
+
_record = record.select{ |x| @filter_in.include? x }
|
55
|
+
|
56
|
+
if not @min_field.nil? then
|
57
|
+
if _record.keys.length >= @min_field then
|
52
58
|
return _record
|
53
59
|
else
|
54
60
|
log.warn("#{record} has an missing fields")
|
61
|
+
nil
|
55
62
|
end
|
56
|
-
else
|
57
|
-
return record
|
58
63
|
end
|
59
|
-
|
64
|
+
|
65
|
+
return _record
|
60
66
|
end
|
61
67
|
|
62
68
|
def parse(text)
|