fluent-plugin-ltsv-parser 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -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"
4
+ gem.version = "0.0.5"
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}
@@ -4,7 +4,7 @@ class Fluent::ParserOutput < Fluent::Output
4
4
  config_param :tag, :string, :default => nil
5
5
  config_param :reserve_data, :bool, :default => false
6
6
  config_param :key_name, :string
7
- config_param :filter_in, :string , :default => ""
7
+ config_param :key_fields, :string , :default => ""
8
8
  config_param :add_prefix, :string ,:default => nil
9
9
 
10
10
  def initialize
@@ -22,7 +22,7 @@ class Fluent::ParserOutput < Fluent::Output
22
22
  if @key_name[0] == ":"
23
23
  @key_name = @key_name[1..-1].to_sym
24
24
  end
25
- @filter_in = @filter_in.split(",").map(&:strip).select{ |e| e != "" }
25
+ @key_fields = @key_fields.split(",").map(&:strip).select{ |e| e != "" }
26
26
  end
27
27
 
28
28
  def emit(tag,es,chain)
@@ -46,11 +46,15 @@ class Fluent::ParserOutput < Fluent::Output
46
46
  private
47
47
 
48
48
  def filter(record)
49
- if @filter_in.length > 0 then
50
- _record = record.select{ |x| @filter_in.include? x }
51
- if _record.keys.length == @filter_in.length then
49
+ if @key_fields.length > 0 then
50
+ _record = record.select{ |x| @key_fields.include? x }
51
+ if _record.keys.length == @key_fields.length then
52
52
  return _record
53
+ else
54
+ log.warn("#{record} has an missing fields")
53
55
  end
56
+ else
57
+ return record
54
58
  end
55
59
  nil
56
60
  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.4
4
+ version: 0.0.5
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-17 00:00:00.000000000 Z
12
+ date: 2014-09-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake