fluent-plugin-ltsv-parser 0.0.10 → 0.0.11

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.10"
4
+ gem.version = "0.0.11"
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}
@@ -7,6 +7,7 @@ class Fluent::ParserOutput < Fluent::Output
7
7
  config_param :filter_in, :string , :default => ""
8
8
  config_param :add_prefix, :string ,:default => nil
9
9
  config_param :min_field, :integer , :default => nil
10
+ config_param :required_fields,:string, :default => nil
10
11
  config_param :transform_values,:string,:default => nil
11
12
 
12
13
  def initialize
@@ -27,10 +28,13 @@ class Fluent::ParserOutput < Fluent::Output
27
28
  end
28
29
 
29
30
  @filter_in = @filter_in.split(",").map(&:strip).select{ |e| e != "" }
31
+ @required_fields = @required_fields.split(",").map(&:strip).select{ |e| e != "" }
30
32
 
31
33
  if @transform_values then
32
34
  @transform_values = Hash[@transform_values.split(",").map{|p| p.split(":",2)}]
33
35
  end
36
+
37
+
34
38
  end
35
39
 
36
40
  def emit(tag,es,chain)
@@ -54,6 +58,12 @@ class Fluent::ParserOutput < Fluent::Output
54
58
  private
55
59
 
56
60
  def filter(record)
61
+ if @required_fields.length > 0 then
62
+ if record.count { |k,v| @required_fields.include? k } != @required_fields.length then
63
+ return nil
64
+ end
65
+ end
66
+
57
67
  if @filter_in.length <= 0 then
58
68
  return record
59
69
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-ltsv-parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-09-29 00:00:00.000000000 Z
12
+ date: 2014-10-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake