fluent-plugin-filter_empty_keys 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.travis.yml +9 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +3 -0
- data/Gemfile.v0.12 +4 -0
- data/LICENSE +22 -0
- data/README.md +32 -0
- data/Rakefile +18 -0
- data/example.conf +7 -0
- data/fluent-plugin-filter_empty_keys.gemspec +24 -0
- data/lib/fluent/plugin/filter_empty_keys.rb +12 -0
- data/test/helper.rb +8 -0
- data/test/test_filter_empty_keys.rb +45 -0
- metadata +129 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3d0399e8d3016a5935a1a367c460cfb93955239e
|
4
|
+
data.tar.gz: 7e5da4cc2d21f1266718ae1254f21870b15f1811
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d4ab6e7b4c9da64befecb73f00d23316dbe6cdc649504fd8a859d4278847727f7c59dfb7ab23cca8bd5083d803ab11621fddc62fd0eb360ab05700d6ba50d113
|
7
|
+
data.tar.gz: defd246fb276b6853046dbfa7afbbf976fd93d57fbc15c0e2de888492dc21e94268433785e2b1b92b6458932cf3ecfa61d1b0a232fb6c271fd7874086053020d
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/Gemfile.v0.12
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Naotoshi Seo
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# fluent-plugin-filter_typecast
|
2
|
+
|
3
|
+
A Fluentd filter plugin to filter empty keys
|
4
|
+
|
5
|
+
## Requirements
|
6
|
+
|
7
|
+
Fluentd >= v0.12
|
8
|
+
|
9
|
+
## Install
|
10
|
+
|
11
|
+
Use RubyGems:
|
12
|
+
|
13
|
+
```
|
14
|
+
gem install fluent-plugin-filter_empty_keys
|
15
|
+
```
|
16
|
+
|
17
|
+
|
18
|
+
## ChangeLog
|
19
|
+
|
20
|
+
See [CHANGELOG.md](CHANGELOG.md) for details.
|
21
|
+
|
22
|
+
## Contributing
|
23
|
+
|
24
|
+
1. Fork it
|
25
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
26
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
27
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
28
|
+
5. Create new [Pull Request](../../pull/new/master)
|
29
|
+
|
30
|
+
## Copyright
|
31
|
+
|
32
|
+
Copyright (c) 2015 Naotoshi Seo. See [LICENSE](LICENSE) for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require "bundler/gem_tasks"
|
3
|
+
|
4
|
+
require 'rake/testtask'
|
5
|
+
desc 'Run test_unit based test'
|
6
|
+
Rake::TestTask.new(:test) do |t|
|
7
|
+
t.libs << "test"
|
8
|
+
t.test_files = Dir["test/**/test_*.rb"].sort
|
9
|
+
t.verbose = true
|
10
|
+
#t.warning = true
|
11
|
+
end
|
12
|
+
task :default => :test
|
13
|
+
|
14
|
+
desc 'Open an irb session preloaded with the gem library'
|
15
|
+
task :console do
|
16
|
+
sh 'irb -rubygems -I lib'
|
17
|
+
end
|
18
|
+
task :c => :console
|
data/example.conf
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "fluent-plugin-filter_empty_keys"
|
6
|
+
s.version = "0.0.2"
|
7
|
+
s.authors = ["Al-waleed Shihadeh"]
|
8
|
+
s.email = ["wshihadh@gmail.com"]
|
9
|
+
s.homepage = "https://github.com/wshihadeh/fluent-plugin-filter_empty_keys.git"
|
10
|
+
s.summary = "A Fluentd filter plugin to filter empty keys"
|
11
|
+
s.description = s.summary
|
12
|
+
s.licenses = ["MIT"]
|
13
|
+
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
|
19
|
+
s.add_runtime_dependency "fluentd", ">= 0.12"
|
20
|
+
s.add_development_dependency "rake"
|
21
|
+
s.add_development_dependency "test-unit"
|
22
|
+
s.add_development_dependency "pry"
|
23
|
+
s.add_development_dependency "pry-nav"
|
24
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'fluent/filter'
|
2
|
+
require 'fluent/parser'
|
3
|
+
|
4
|
+
module Fluent
|
5
|
+
class EmptyKeysFilter < Filter
|
6
|
+
Fluent::Plugin.register_filter('empty_keys', self)
|
7
|
+
|
8
|
+
def filter(tag, time, record)
|
9
|
+
record.reject{ |k,v| (v.nil? || v.to_s.empty?) }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/test/helper.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
require_relative 'helper'
|
2
|
+
require 'fluent/plugin/filter_empty_keys'
|
3
|
+
|
4
|
+
class TypecastFilterTest < Test::Unit::TestCase
|
5
|
+
include Fluent
|
6
|
+
|
7
|
+
setup do
|
8
|
+
Fluent::Test.setup
|
9
|
+
@time = Fluent::Engine.now
|
10
|
+
end
|
11
|
+
|
12
|
+
def create_driver(conf = '')
|
13
|
+
Test::FilterTestDriver.new(EmptyKeysFilter).configure(conf, true)
|
14
|
+
end
|
15
|
+
|
16
|
+
def filter(d, msgs)
|
17
|
+
d.run {
|
18
|
+
msgs.each {|msg|
|
19
|
+
d.filter(msg, @time)
|
20
|
+
}
|
21
|
+
}
|
22
|
+
d.filtered_as_array
|
23
|
+
end
|
24
|
+
|
25
|
+
test 'test_empty_keys' do
|
26
|
+
d = create_driver
|
27
|
+
msg = {
|
28
|
+
'integer' => 1,
|
29
|
+
'nil' => nil,
|
30
|
+
'time' => '2013-02-12 22:01:15 UTC',
|
31
|
+
'bool' => 'true',
|
32
|
+
'array' => 'a,b,c',
|
33
|
+
'empty' => '',
|
34
|
+
}
|
35
|
+
filtered = filter(d, [msg]).first[2]
|
36
|
+
assert_equal 4, filtered.count
|
37
|
+
assert_equal true, filtered.key?("integer")
|
38
|
+
assert_equal false, filtered.key?("nil")
|
39
|
+
assert_equal true, filtered.key?("time")
|
40
|
+
assert_equal true, filtered.key?("bool")
|
41
|
+
assert_equal true, filtered.key?("array")
|
42
|
+
assert_equal false, filtered.key?("empty")
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
metadata
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fluent-plugin-filter_empty_keys
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Al-waleed Shihadeh
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-07-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: fluentd
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.12'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.12'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: test-unit
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry-nav
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: A Fluentd filter plugin to filter empty keys
|
84
|
+
email:
|
85
|
+
- wshihadh@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- ".travis.yml"
|
92
|
+
- CHANGELOG.md
|
93
|
+
- Gemfile
|
94
|
+
- Gemfile.v0.12
|
95
|
+
- LICENSE
|
96
|
+
- README.md
|
97
|
+
- Rakefile
|
98
|
+
- example.conf
|
99
|
+
- fluent-plugin-filter_empty_keys.gemspec
|
100
|
+
- lib/fluent/plugin/filter_empty_keys.rb
|
101
|
+
- test/helper.rb
|
102
|
+
- test/test_filter_empty_keys.rb
|
103
|
+
homepage: https://github.com/wshihadeh/fluent-plugin-filter_empty_keys.git
|
104
|
+
licenses:
|
105
|
+
- MIT
|
106
|
+
metadata: {}
|
107
|
+
post_install_message:
|
108
|
+
rdoc_options: []
|
109
|
+
require_paths:
|
110
|
+
- lib
|
111
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
116
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
requirements: []
|
122
|
+
rubyforge_project:
|
123
|
+
rubygems_version: 2.6.14
|
124
|
+
signing_key:
|
125
|
+
specification_version: 4
|
126
|
+
summary: A Fluentd filter plugin to filter empty keys
|
127
|
+
test_files:
|
128
|
+
- test/helper.rb
|
129
|
+
- test/test_filter_empty_keys.rb
|