fluent-mixin-rewrite-tag-name 0.0.2 → 0.0.3
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.
- data/README.md +1 -3
- data/fluent-mixin-rewrite-tag-name.gemspec +1 -1
- data/lib/fluent/mixin/rewrite_tag_name.rb +4 -15
- data/test/plugin.rb +0 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -21,7 +21,6 @@ For example with `td.apache.access` tag, it will get `td` by `${tag_parts[0]}` a
|
|
21
21
|
**Note**
|
22
22
|
|
23
23
|
* To support upcase placeholder, set `enable_placeholder_upcase true` in configuration.
|
24
|
-
* To support hostname placeholder, set `enable_placeholder_upcase true` in configuration.
|
25
24
|
* Currently, range expression ```${tag_parts[0..2]}``` is not supported.
|
26
25
|
|
27
26
|
#### Placeholder Option
|
@@ -44,8 +43,7 @@ Adding this mixin plugin, it will enabled to use these placeholder in your plugi
|
|
44
43
|
# it will be rewrited to be 'customprefix.web10-222' when short hostname is 'web10-222'.
|
45
44
|
tag customprefix.${hostname}
|
46
45
|
|
47
|
-
# to use hostname placeholder,
|
48
|
-
enable_placeholder_hostname true
|
46
|
+
# to use short hostname placeholder, add option like below.
|
49
47
|
hostname_command hostname -s
|
50
48
|
</source>
|
51
49
|
```
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "fluent-mixin-rewrite-tag-name"
|
7
|
-
spec.version = "0.0.
|
7
|
+
spec.version = "0.0.3"
|
8
8
|
spec.authors = ["Kentaro Yoshida"]
|
9
9
|
spec.email = ["y.ken.studio@gmail.com"]
|
10
10
|
spec.summary = %q{Fluentd mixin plugin to provides placeholder function for rewriting tag for your any plugins as like fluent-plugin-rewrite-tag-filter. It will let you get easy to implement tag placeholder for your own plugins.}
|
@@ -3,7 +3,7 @@ module Fluent
|
|
3
3
|
module RewriteTagName
|
4
4
|
include RecordFilterMixin
|
5
5
|
attr_accessor :tag, :hostname_command
|
6
|
-
attr_accessor :enable_placeholder_upcase
|
6
|
+
attr_accessor :enable_placeholder_upcase
|
7
7
|
|
8
8
|
DEFAULT_HOSTNAME_COMMAND = 'hostname'
|
9
9
|
|
@@ -19,15 +19,9 @@ module Fluent
|
|
19
19
|
@placeholder_expander.enable_placeholder_upcase
|
20
20
|
end
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
if @enable_placeholder_hostname
|
26
|
-
hostname_command = @hostname_command || DEFAULT_HOSTNAME_COMMAND
|
27
|
-
hostname = `#{hostname_command}`.chomp
|
28
|
-
@placeholder_expander.enable_placeholder_hostname
|
29
|
-
@placeholder_expander.set_hostname(hostname)
|
30
|
-
end
|
22
|
+
hostname_command = @hostname_command || DEFAULT_HOSTNAME_COMMAND
|
23
|
+
hostname = `#{hostname_command}`.chomp
|
24
|
+
@placeholder_expander.set_hostname(hostname)
|
31
25
|
end
|
32
26
|
|
33
27
|
def filter_record(tag, time, record)
|
@@ -52,7 +46,6 @@ module Fluent
|
|
52
46
|
def initialize
|
53
47
|
@placeholders = {}
|
54
48
|
@enable_options = {
|
55
|
-
:hostname => false,
|
56
49
|
:upcase => false,
|
57
50
|
}
|
58
51
|
end
|
@@ -64,10 +57,6 @@ module Fluent
|
|
64
57
|
}
|
65
58
|
end
|
66
59
|
|
67
|
-
def enable_placeholder_hostname
|
68
|
-
@enable_options[:hostname] = true
|
69
|
-
end
|
70
|
-
|
71
60
|
def enable_placeholder_upcase
|
72
61
|
@enable_options[:upcase] = true
|
73
62
|
end
|
data/test/plugin.rb
CHANGED
@@ -7,7 +7,6 @@ class Fluent::RewriteTagNameMixinOutput < Fluent::Output
|
|
7
7
|
include Fluent::HandleTagNameMixin
|
8
8
|
include Fluent::Mixin::RewriteTagName
|
9
9
|
config_set_default :enable_placeholder_upcase, false
|
10
|
-
config_set_default :enable_placeholder_hostname, true
|
11
10
|
|
12
11
|
def configure(conf)
|
13
12
|
super
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-mixin-rewrite-tag-name
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-01-
|
12
|
+
date: 2014-01-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|