fluent-plugin-dedot_filter 0.1.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.
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in fluent-plugin-dedot_filter.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 TODO: Write your name
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,37 @@
1
+ # fluent-plugin-dedot_filter
2
+
3
+ Fluentd Filter plugin to de-dot field name for elasticsearch 2.x.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```bash
10
+ # for fluentd
11
+ gem install fluent-plugin-dedot_filter
12
+
13
+ # for td-agent2
14
+ td-agent-gem install fluent-plugin-dedot_filter
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ ```xml
20
+ <filter access.apache>
21
+ @type dedot
22
+ de_dot true
23
+ de_dot_separator _
24
+ </filter>
25
+ ```
26
+
27
+ ## parameters
28
+
29
+ * `de_dot` (default: true)
30
+ * `de_dot_separator` (default: '_')
31
+
32
+ `de_dot_separator` cannot be or contain '.'.
33
+
34
+ ## License
35
+
36
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
37
+
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
@@ -0,0 +1,32 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'fluent/plugin/filter_dedot/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "fluent-plugin-dedot_filter"
8
+ spec.version = Fluent::Plugin::DedotFilter::VERSION
9
+ spec.authors = ["Tomoyuki Sugimura"]
10
+ spec.email = ["tomoyuki.sugimura@gmail.com"]
11
+
12
+ spec.summary = %q{de-dot field name for elasticsearch 2.x}
13
+ spec.description = %q{de-dot field name for elasticsearch 2.x}
14
+ spec.homepage = "https://github.com/lunardial/fluent-plugin-dedot_filter"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
18
+ # delete this section to allow pushing this gem to any host.
19
+ #if spec.respond_to?(:metadata)
20
+ # spac.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
21
+ #else
22
+ # raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
23
+ #end
24
+
25
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
+ spec.bindir = "exe"
27
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
+ spec.require_paths = ["lib"]
29
+
30
+ spec.add_development_dependency "bundler", "~> 1.11"
31
+ spec.add_development_dependency "rake", "~> 10.0"
32
+ end
@@ -0,0 +1,41 @@
1
+ module Fluent
2
+ class DedotFilter < Fluent::Filter
3
+
4
+ Fluent::Plugin.register_filter('dedot', self)
5
+
6
+ config_param :de_dot, :bool, default: true
7
+ config_param :de_dot_separator, :string, default: '_'
8
+
9
+ def initialize
10
+ super
11
+ end
12
+
13
+ def configure(conf)
14
+ super
15
+
16
+ if @de_dot && @de_dot_separator.include?(".")
17
+ raise Fluent::ConfigError, "Invalid de_dot_separator: cannot be or contain '.'"
18
+ end
19
+ end
20
+
21
+ def filter(tag, time, record)
22
+ begin
23
+ de_dot(record) if @de_dot
24
+ rescue => e
25
+ router.emit_error_event(tag, time, record, e)
26
+ end
27
+ end
28
+
29
+ def de_dot(record)
30
+ newrecord = {}
31
+
32
+ record.each do |key, value|
33
+ newkey = key.gsub(/\./, @de_dot_separator)
34
+ newrecord[newkey] = value
35
+ end
36
+
37
+ newrecord
38
+ end
39
+
40
+ end
41
+ end
@@ -0,0 +1,7 @@
1
+ module Fluent
2
+ module Plugin
3
+ module DedotFilter
4
+ VERSION = "0.1.0"
5
+ end
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,104 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fluent-plugin-dedot_filter
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Tomoyuki Sugimura
14
+ autorequire:
15
+ bindir: exe
16
+ cert_chain: []
17
+
18
+ date: 2016-03-05 00:00:00 +09:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: bundler
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 25
30
+ segments:
31
+ - 1
32
+ - 11
33
+ version: "1.11"
34
+ type: :development
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: rake
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ hash: 35
45
+ segments:
46
+ - 10
47
+ - 0
48
+ version: "10.0"
49
+ type: :development
50
+ version_requirements: *id002
51
+ description: de-dot field name for elasticsearch 2.x
52
+ email:
53
+ - tomoyuki.sugimura@gmail.com
54
+ executables: []
55
+
56
+ extensions: []
57
+
58
+ extra_rdoc_files: []
59
+
60
+ files:
61
+ - .gitignore
62
+ - Gemfile
63
+ - LICENSE.txt
64
+ - README.md
65
+ - Rakefile
66
+ - fluent-plugin-dedot_filter.gemspec
67
+ - lib/fluent/plugin/filter_dedot.rb
68
+ - lib/fluent/plugin/filter_dedot/version.rb
69
+ has_rdoc: true
70
+ homepage: https://github.com/lunardial/fluent-plugin-dedot_filter
71
+ licenses:
72
+ - MIT
73
+ post_install_message:
74
+ rdoc_options: []
75
+
76
+ require_paths:
77
+ - lib
78
+ required_ruby_version: !ruby/object:Gem::Requirement
79
+ none: false
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ hash: 3
84
+ segments:
85
+ - 0
86
+ version: "0"
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ none: false
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ hash: 3
93
+ segments:
94
+ - 0
95
+ version: "0"
96
+ requirements: []
97
+
98
+ rubyforge_project:
99
+ rubygems_version: 1.3.7
100
+ signing_key:
101
+ specification_version: 3
102
+ summary: de-dot field name for elasticsearch 2.x
103
+ test_files: []
104
+