fluent-plugin-dedot_filter 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c3a64a0d6bbde97cc51e18590b488c40b37878e6
4
+ data.tar.gz: 61e8dcd3221fbecea0b276a0273b6fbeabaab46e
5
+ SHA512:
6
+ metadata.gz: 52e9169593bd5d2aff53d2dc4a28326367177a6ef95f9adf04de04933b3e7240dd86165f69aefd726db36d460422bd595233d9b3784529f35dbcd0a60e1c510b
7
+ data.tar.gz: 3a8725588c1d0e7e17c234bc17db66b38e5fe19d7db2a6fc66e8759f09805a2db5cbca05639c5935915f23c1b8046eceea6cf025fe0ca41faa0a2caa8f4cf172
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --require spec_helper
3
+ --format doc
data/README.md CHANGED
@@ -21,6 +21,7 @@ td-agent-gem install fluent-plugin-dedot_filter
21
21
  @type dedot
22
22
  de_dot true
23
23
  de_dot_separator _
24
+ de_dot_nested false
24
25
  </filter>
25
26
  ```
26
27
 
@@ -28,8 +29,10 @@ td-agent-gem install fluent-plugin-dedot_filter
28
29
 
29
30
  * `de_dot` (default: true)
30
31
  * `de_dot_separator` (default: '_')
32
+ * `de_dot_nested` (default: false)
31
33
 
32
34
  `de_dot_separator` cannot be or contain '.'.
35
+ `de_dot_nested` will cause the plugin to recurse through nested structures (hashes and arrays), and remove dots in those key-names too.
33
36
 
34
37
  ## License
35
38
 
@@ -27,6 +27,10 @@ Gem::Specification.new do |spec|
27
27
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
28
  spec.require_paths = ["lib"]
29
29
 
30
+ spec.add_runtime_dependency "fluentd", ">= 0"
31
+
30
32
  spec.add_development_dependency "bundler", "~> 1.11"
31
33
  spec.add_development_dependency "rake", "~> 10.0"
34
+ spec.add_development_dependency "rspec"
35
+ spec.add_development_dependency "test-unit"
32
36
  end
@@ -5,6 +5,7 @@ module Fluent
5
5
 
6
6
  config_param :de_dot, :bool, default: true
7
7
  config_param :de_dot_separator, :string, default: '_'
8
+ config_param :de_dot_nested, :bool, default: false
8
9
 
9
10
  def initialize
10
11
  super
@@ -16,6 +17,11 @@ module Fluent
16
17
  if @de_dot && @de_dot_separator.include?(".")
17
18
  raise Fluent::ConfigError, "Invalid de_dot_separator: cannot be or contain '.'"
18
19
  end
20
+
21
+ if @de_dot && @de_dot_nested
22
+ log.info "DeDot will recurse nested hashes and arrays"
23
+ end
24
+
19
25
  end
20
26
 
21
27
  def filter(tag, time, record)
@@ -31,6 +37,16 @@ module Fluent
31
37
 
32
38
  record.each do |key, value|
33
39
  newkey = key.gsub(/\./, @de_dot_separator)
40
+
41
+ # Recurse hashes and arrays:
42
+ if @de_dot_nested
43
+ if value.is_a? Hash
44
+ value = de_dot value
45
+ elsif value.is_a? Array
46
+ value = value.map { |v| v.is_a?(Hash) ? de_dot(v) : v }
47
+ end
48
+ end
49
+
34
50
  newrecord[newkey] = value
35
51
  end
36
52
 
@@ -1,7 +1,7 @@
1
1
  module Fluent
2
2
  module Plugin
3
3
  module DedotFilter
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,64 +1,94 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
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
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Tomoyuki Sugimura
14
8
  autorequire:
15
9
  bindir: exe
16
10
  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
11
+ date: 2016-05-30 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'
20
+ type: :runtime
23
21
  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"
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.11'
34
34
  type: :development
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.11'
41
+ - !ruby/object:Gem::Dependency
37
42
  name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
38
63
  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"
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: test-unit
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
49
76
  type: :development
50
- version_requirements: *id002
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
51
83
  description: de-dot field name for elasticsearch 2.x
52
- email:
84
+ email:
53
85
  - tomoyuki.sugimura@gmail.com
54
86
  executables: []
55
-
56
87
  extensions: []
57
-
58
88
  extra_rdoc_files: []
59
-
60
- files:
61
- - .gitignore
89
+ files:
90
+ - ".gitignore"
91
+ - ".rspec"
62
92
  - Gemfile
63
93
  - LICENSE.txt
64
94
  - README.md
@@ -66,39 +96,28 @@ files:
66
96
  - fluent-plugin-dedot_filter.gemspec
67
97
  - lib/fluent/plugin/filter_dedot.rb
68
98
  - lib/fluent/plugin/filter_dedot/version.rb
69
- has_rdoc: true
70
99
  homepage: https://github.com/lunardial/fluent-plugin-dedot_filter
71
- licenses:
100
+ licenses:
72
101
  - MIT
102
+ metadata: {}
73
103
  post_install_message:
74
104
  rdoc_options: []
75
-
76
- require_paths:
105
+ require_paths:
77
106
  - lib
78
- required_ruby_version: !ruby/object:Gem::Requirement
79
- none: false
80
- requirements:
107
+ required_ruby_version: !ruby/object:Gem::Requirement
108
+ requirements:
81
109
  - - ">="
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:
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ required_rubygems_version: !ruby/object:Gem::Requirement
113
+ requirements:
90
114
  - - ">="
91
- - !ruby/object:Gem::Version
92
- hash: 3
93
- segments:
94
- - 0
95
- version: "0"
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
96
117
  requirements: []
97
-
98
118
  rubyforge_project:
99
- rubygems_version: 1.3.7
119
+ rubygems_version: 2.5.1
100
120
  signing_key:
101
- specification_version: 3
121
+ specification_version: 4
102
122
  summary: de-dot field name for elasticsearch 2.x
103
123
  test_files: []
104
-