fluent-plugin-retag 0.0.1 → 0.0.2
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.
- checksums.yaml +7 -0
- data/Gemfile +2 -0
- data/README.md +1 -1
- data/fluent-plugin-retag.gemspec +1 -1
- data/lib/fluent/plugin/out_retag.rb +27 -5
- metadata +12 -18
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c1a56b2c7c9ff8c152f581ebef1909dc4ba0749f
|
4
|
+
data.tar.gz: 109309b4d2773227e2d5e79ba5513228ebab9612
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bb325a2f3a08c6590f9cff36f812d6e70c46f02c673272c83f63350b1e8db4034850aff91adb1c9019ef576d751e6e9108fc2d620f3fc8b7c3f0316fc522dc51
|
7
|
+
data.tar.gz: 666943f651598f0429ea4fcfeecc48d15907d6bfe3563783230cca5d0e954f28c43013164bc2f49a2f82c92b88665bd60ab90ef0f244e5447294dbe8c93d1557
|
data/Gemfile
CHANGED
data/README.md
CHANGED
data/fluent-plugin-retag.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |gem|
|
6
6
|
gem.name = "fluent-plugin-retag"
|
7
|
-
gem.version = "0.0.
|
7
|
+
gem.version = "0.0.2"
|
8
8
|
gem.authors = ["Masahiro Yamauchi"]
|
9
9
|
gem.email = ["sgt.yamauchi@gmail.com"]
|
10
10
|
gem.description = %q{Output filter plugin to retag}
|
@@ -4,14 +4,16 @@ class Fluent::RetagOutput < Fluent::Output
|
|
4
4
|
config_param :tag, :string, :default => nil
|
5
5
|
config_param :remove_prefix, :string, :default => nil
|
6
6
|
config_param :add_prefix, :string, :default => nil
|
7
|
+
config_param :remove_suffix, :string, :default => nil
|
8
|
+
config_param :add_suffix, :string, :default => nil
|
7
9
|
|
8
10
|
def configure(conf)
|
9
11
|
super
|
10
|
-
if not @tag and not @remove_prefix and not @add_prefix
|
11
|
-
raise Fluent::ConfigError, "missing
|
12
|
+
if not @tag and not @remove_prefix and not @add_prefix and not @remove_suffix and not @add_suffix
|
13
|
+
raise Fluent::ConfigError, "missing remove_prefix and add_prefix and remove_suffix and add_suffix"
|
12
14
|
end
|
13
|
-
if @tag and (@remove_prefix or @add_prefix)
|
14
|
-
raise Fluent::ConfigError, "
|
15
|
+
if @tag and (@remove_prefix or @add_prefix or @remove_suffix or @add_suffix)
|
16
|
+
raise Fluent::ConfigError, "tag and remove_prefix/add_prefix/remove_suffix/add_suffix must not be specified"
|
15
17
|
end
|
16
18
|
if @remove_prefix
|
17
19
|
@removed_prefix_string = @remove_prefix + '.'
|
@@ -20,12 +22,25 @@ class Fluent::RetagOutput < Fluent::Output
|
|
20
22
|
if @add_prefix
|
21
23
|
@added_prefix_string = @add_prefix + '.'
|
22
24
|
end
|
25
|
+
|
26
|
+
if @remove_suffix
|
27
|
+
@removed_suffix_string = '.' + @remove_suffix
|
28
|
+
@removed_suffix_length = @removed_suffix_string.length
|
29
|
+
@removed_suffix_pos = 0 - @removed_suffix_length
|
30
|
+
end
|
31
|
+
if @add_suffix
|
32
|
+
@added_suffix_string = '.' + @add_suffix
|
33
|
+
end
|
23
34
|
end
|
24
35
|
|
25
36
|
def emit(tag, es, chain)
|
26
37
|
tag = if @tag
|
27
38
|
@tag
|
28
39
|
else
|
40
|
+
if @remove_suffix and
|
41
|
+
((tag.end_with?(@removed_suffix_string) and tag.length > @removed_suffix_length) or tag == @remove_suffix)
|
42
|
+
tag = tag[0...@removed_suffix_pos]
|
43
|
+
end
|
29
44
|
if @remove_prefix and
|
30
45
|
( (tag.start_with?(@removed_prefix_string) and tag.length > @removed_length) or tag == @remove_prefix)
|
31
46
|
tag = tag[@removed_length..-1]
|
@@ -37,10 +52,17 @@ class Fluent::RetagOutput < Fluent::Output
|
|
37
52
|
@add_prefix
|
38
53
|
end
|
39
54
|
end
|
55
|
+
if @add_suffix
|
56
|
+
tag = if tag and tag.length > 0
|
57
|
+
tag + @added_suffix_string
|
58
|
+
else
|
59
|
+
@add_suffix
|
60
|
+
end
|
61
|
+
end
|
40
62
|
tag
|
41
63
|
end
|
42
64
|
es.each do |time,record|
|
43
|
-
|
65
|
+
router.emit(tag, time, record)
|
44
66
|
end
|
45
67
|
chain.next
|
46
68
|
end
|
metadata
CHANGED
@@ -1,46 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-retag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Masahiro Yamauchi
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2016-06-08 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: fluentd
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: fluentd
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
description: Output filter plugin to retag
|
@@ -50,7 +45,7 @@ executables: []
|
|
50
45
|
extensions: []
|
51
46
|
extra_rdoc_files: []
|
52
47
|
files:
|
53
|
-
- .gitignore
|
48
|
+
- ".gitignore"
|
54
49
|
- Gemfile
|
55
50
|
- LICENSE.txt
|
56
51
|
- README.md
|
@@ -61,27 +56,26 @@ files:
|
|
61
56
|
- test/plugin/test_out_retag.rb
|
62
57
|
homepage: https://github.com/algas/fluent-plugin-retag
|
63
58
|
licenses: []
|
59
|
+
metadata: {}
|
64
60
|
post_install_message:
|
65
61
|
rdoc_options: []
|
66
62
|
require_paths:
|
67
63
|
- lib
|
68
64
|
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
-
none: false
|
70
65
|
requirements:
|
71
|
-
- -
|
66
|
+
- - ">="
|
72
67
|
- !ruby/object:Gem::Version
|
73
68
|
version: '0'
|
74
69
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
-
none: false
|
76
70
|
requirements:
|
77
|
-
- -
|
71
|
+
- - ">="
|
78
72
|
- !ruby/object:Gem::Version
|
79
73
|
version: '0'
|
80
74
|
requirements: []
|
81
75
|
rubyforge_project: fluent-plugin-retag
|
82
|
-
rubygems_version:
|
76
|
+
rubygems_version: 2.5.1
|
83
77
|
signing_key:
|
84
|
-
specification_version:
|
78
|
+
specification_version: 4
|
85
79
|
summary: Output filter plugin to retag
|
86
80
|
test_files:
|
87
81
|
- test/helper.rb
|