fluent-plugin-tag_rewrite 1.0.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.
- checksums.yaml +7 -0
- data/.gitignore +50 -0
- data/LICENSE +21 -0
- data/README.md +57 -0
- data/fluent-plugin-tag_rewrite.gemspec +17 -0
- data/lib/fluent/plugin/out_tag_rewrite.rb +40 -0
- metadata +68 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d32cd60a21f536469941e48224c67922d9bebed4
|
4
|
+
data.tar.gz: e3f2591cd0299070eed310973e1e433e154f224d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 75550eb8883e152d70d504c832e332b69ff94deaef57bf8667ffe56f6eddf1cd552794a015d0e0deba718dcad2c8ee6eef729226f968eca43de42b4bbda8d6a5
|
7
|
+
data.tar.gz: 3a66aab0d8cbb1186b5cf7c35626647f6c35bbc1672e1855591069fda212d3cefe1490c515c4d20b21a70b4a5c890e5cba038cdd1457a3ea5183ff2b1c598b0d
|
data/.gitignore
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
# Used by dotenv library to load environment variables.
|
14
|
+
# .env
|
15
|
+
|
16
|
+
## Specific to RubyMotion:
|
17
|
+
.dat*
|
18
|
+
.repl_history
|
19
|
+
build/
|
20
|
+
*.bridgesupport
|
21
|
+
build-iPhoneOS/
|
22
|
+
build-iPhoneSimulator/
|
23
|
+
|
24
|
+
## Specific to RubyMotion (use of CocoaPods):
|
25
|
+
#
|
26
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
27
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
28
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
29
|
+
#
|
30
|
+
# vendor/Pods/
|
31
|
+
|
32
|
+
## Documentation cache and generated files:
|
33
|
+
/.yardoc/
|
34
|
+
/_yardoc/
|
35
|
+
/doc/
|
36
|
+
/rdoc/
|
37
|
+
|
38
|
+
## Environment normalization:
|
39
|
+
/.bundle/
|
40
|
+
/vendor/bundle
|
41
|
+
/lib/bundler/man/
|
42
|
+
|
43
|
+
# for a library or gem, you might want to ignore these files since the code is
|
44
|
+
# intended to run in multiple environments; otherwise, check them in:
|
45
|
+
# Gemfile.lock
|
46
|
+
# .ruby-version
|
47
|
+
# .ruby-gemset
|
48
|
+
|
49
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
50
|
+
.rvmrc
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2019 tombola Ltd
|
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 all
|
13
|
+
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 THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
[<img src="https://badge.fury.io/rb/fluent-plugin-tag_rewrite.png" alt="Gem Version" />](http://badge.fury.io/rb/fluent-plugin-tag_rewrite)
|
2
|
+
# fluent-plugin-tag_rewrite
|
3
|
+
|
4
|
+
#### Overview
|
5
|
+
|
6
|
+
Rewrite tag for [Fluentd](https://www.fluentd.org). It is designed to rewrite the tags and re-emit the record with rewrited tag. Value can only be added at the start or the end of the tag.
|
7
|
+
|
8
|
+
This is an output plugin because fluentd's filter doesn't allow tag rewrite.
|
9
|
+
|
10
|
+
#### Installation
|
11
|
+
|
12
|
+
gem install fluent-plugin-tag_rewrite
|
13
|
+
|
14
|
+
#### Configuration
|
15
|
+
|
16
|
+
<match **>
|
17
|
+
@type tag_rewrite
|
18
|
+
tag_prefix start
|
19
|
+
tag_sufix end
|
20
|
+
</match>
|
21
|
+
|
22
|
+
Optional parameter is either tag_prefix or tag_sufix
|
23
|
+
|
24
|
+
#### Example
|
25
|
+
If your fluentd match configuration is the same as above followed by the match configuration like this:
|
26
|
+
|
27
|
+
<match start.fluent.**>
|
28
|
+
@type stdout
|
29
|
+
</match>
|
30
|
+
|
31
|
+
The output will be:
|
32
|
+
|
33
|
+
| original record | rewritten tag record |
|
34
|
+
|---------------------------------------|-------------------------------------------------|
|
35
|
+
| fluent.warn {"message":"[info]: ..."} | start.fluent.warn.end {"message":"[info]: ..."} |
|
36
|
+
|
37
|
+
## Requirements
|
38
|
+
|
39
|
+
| fluent-plugin-tag_rewrite | fluentd |
|
40
|
+
|-------------------|---------|
|
41
|
+
| >= 1.0.0 | >= v1.14.0 < 2 |
|
42
|
+
|
43
|
+
#### Contributing
|
44
|
+
|
45
|
+
1. Fork it ( http://github.com/tombolaltd/fluent-plugin-tag_rewrite/fork )
|
46
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
47
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
48
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
49
|
+
5. Create a new Pull Request
|
50
|
+
|
51
|
+
#### Copyright
|
52
|
+
|
53
|
+
Copyright (c) 2019 - [tombola](https://www.tombolaarcade.co.uk).
|
54
|
+
|
55
|
+
#### License
|
56
|
+
|
57
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
Gem::Specification.new do |gem|
|
3
|
+
gem.name = "fluent-plugin-tag_rewrite"
|
4
|
+
gem.description = "This input plugin allows you rewrite tag"
|
5
|
+
gem.homepage = "https://github.com/tombolaltd/fluent-plugin-tag_rewrite"
|
6
|
+
gem.summary = gem.description
|
7
|
+
gem.version = "1.0.0"
|
8
|
+
gem.license = 'MIT'
|
9
|
+
gem.authors = ["Sohaib Maroof"]
|
10
|
+
gem.email = "sohaib.maroof@tombola.com"
|
11
|
+
gem.has_rdoc = false
|
12
|
+
gem.files = `git ls-files`.split("\n")
|
13
|
+
gem.require_paths = ['lib']
|
14
|
+
gem.add_runtime_dependency "fluentd", [">= 0.14.0", "< 2"]
|
15
|
+
end
|
16
|
+
|
17
|
+
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require "fluent/plugin/output"
|
2
|
+
|
3
|
+
class Fluent::Plugin::TagRewriteOutput < Fluent::Plugin::Output
|
4
|
+
Fluent::Plugin.register_output("tag_rewrite", self)
|
5
|
+
|
6
|
+
helpers :event_emitter
|
7
|
+
|
8
|
+
config_param :tag_prefix, :string, :default => nil
|
9
|
+
config_param :tag_sufix, :string, :default => nil
|
10
|
+
|
11
|
+
def configure(conf)
|
12
|
+
super
|
13
|
+
|
14
|
+
if @tag_prefix.nil? && @tag_prefix.nil?
|
15
|
+
raise Fluent::ConfigError, "tag_prefix or tag_sufix has not been provided"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def multi_workers_ready?
|
20
|
+
true
|
21
|
+
end
|
22
|
+
|
23
|
+
def process(tag, es)
|
24
|
+
es.each do |time, record|
|
25
|
+
begin
|
26
|
+
rewrited_tag = tag
|
27
|
+
unless @tag_prefix.nil?
|
28
|
+
rewrited_tag = @tag_prefix + "." + rewrited_tag
|
29
|
+
end
|
30
|
+
unless @tag_sufix.nil?
|
31
|
+
rewrited_tag = rewrited_tag + "." + @tag_sufix
|
32
|
+
end
|
33
|
+
router.emit(rewrited_tag, time, record)
|
34
|
+
rescue
|
35
|
+
$log.error("unexpected error in append_tag", :error => $!.to_s)
|
36
|
+
$log.error_backtrace
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
metadata
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fluent-plugin-tag_rewrite
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sohaib Maroof
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-03-18 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.14.0
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '2'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.14.0
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '2'
|
33
|
+
description: This input plugin allows you rewrite tag
|
34
|
+
email: sohaib.maroof@tombola.com
|
35
|
+
executables: []
|
36
|
+
extensions: []
|
37
|
+
extra_rdoc_files: []
|
38
|
+
files:
|
39
|
+
- ".gitignore"
|
40
|
+
- LICENSE
|
41
|
+
- README.md
|
42
|
+
- fluent-plugin-tag_rewrite.gemspec
|
43
|
+
- lib/fluent/plugin/out_tag_rewrite.rb
|
44
|
+
homepage: https://github.com/tombolaltd/fluent-plugin-tag_rewrite
|
45
|
+
licenses:
|
46
|
+
- MIT
|
47
|
+
metadata: {}
|
48
|
+
post_install_message:
|
49
|
+
rdoc_options: []
|
50
|
+
require_paths:
|
51
|
+
- lib
|
52
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
requirements: []
|
63
|
+
rubyforge_project:
|
64
|
+
rubygems_version: 2.5.2.3
|
65
|
+
signing_key:
|
66
|
+
specification_version: 4
|
67
|
+
summary: This input plugin allows you rewrite tag
|
68
|
+
test_files: []
|