fluent-plugin-forest 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -2
- data/README.md +20 -22
- data/example/sample.conf +11 -0
- data/fluent-plugin-forest.gemspec +3 -2
- data/lib/fluent/plugin/out_forest.rb +6 -2
- data/test/output/out_forest_test.rb +1 -1
- metadata +19 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 713656d5a6d91a7d692f3027032eb4bfabb38a35
|
4
|
+
data.tar.gz: 7ec3aa61c288b897b637ada4de5453cb67671d8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da758cc90d2f132b293c415c1107e52e2b8b9534059eb50e1f3d731dd6810598aa491f87bc3482b13656125399c52b1c4e5e3b3a20bda0d358d6569535158998
|
7
|
+
data.tar.gz: 0da6213cf2fe98d140bb8c2c872c95b98dab99c9f58fac0496ceb19f3ac6b47f707a8ddf3e4407ddf40f8508de7cb8bd95a3ec9d4658d83a930b5a85a4c899cf
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -7,7 +7,7 @@ This is a plugin for [Fluentd](http://fluentd.org).
|
|
7
7
|
### ForestOutput
|
8
8
|
|
9
9
|
ForestOutput creates sub plugin instance of a output plugin dynamically per tag, from template configurations.
|
10
|
-
In template configurations, you can write configuration lines for overall tags by
|
10
|
+
In template configurations, you can write configuration lines for overall tags by `<template>`, and for specified tags by `<case TAG_PATTERN>`, and you can use \_\_TAG\_\_ (or ${tag}) placeholder at anywhere in `<template>` and `<case>`.
|
11
11
|
|
12
12
|
This plugin helps you if you are writing very long configurations by copy&paste with a little little diff for many tags.
|
13
13
|
|
@@ -31,27 +31,27 @@ You SHOULD NOT use ForestOutput for tags increasing infinitly.
|
|
31
31
|
If you are writing long long configurations like below:
|
32
32
|
|
33
33
|
<match service.blog>
|
34
|
-
type file
|
34
|
+
@type file
|
35
35
|
time_slice_format %Y%m%d%H
|
36
|
-
compress
|
36
|
+
compress gz
|
37
37
|
path /var/log/blog.*.log
|
38
38
|
</match>
|
39
39
|
<match service.portal>
|
40
|
-
type file
|
40
|
+
@type file
|
41
41
|
time_slice_format %Y%m%d%H
|
42
|
-
compress
|
42
|
+
compress gz
|
43
43
|
path /var/log/portal.*.log
|
44
44
|
</match>
|
45
45
|
<match service.news>
|
46
|
-
type file
|
46
|
+
@type file
|
47
47
|
time_slice_format %Y%m%d%H
|
48
|
-
compress
|
48
|
+
compress gz
|
49
49
|
path /var/log/news.*.log
|
50
50
|
</match>
|
51
51
|
<match service.sns>
|
52
|
-
type file
|
52
|
+
@type file
|
53
53
|
time_slice_format %Y%m%d%H
|
54
|
-
compress
|
54
|
+
compress gz
|
55
55
|
path /var/log/sns.*.log
|
56
56
|
</match>
|
57
57
|
# ...
|
@@ -59,12 +59,12 @@ If you are writing long long configurations like below:
|
|
59
59
|
You can write configuration with ForestOutput like below:
|
60
60
|
|
61
61
|
<match service.*>
|
62
|
-
type forest
|
62
|
+
@type forest
|
63
63
|
subtype file
|
64
64
|
remove_prefix service
|
65
65
|
<template>
|
66
66
|
time_slice_format %Y%m%d%H
|
67
|
-
compress
|
67
|
+
compress gz
|
68
68
|
path /var/log/${tag}.*.log
|
69
69
|
</template>
|
70
70
|
</match>
|
@@ -72,18 +72,17 @@ You can write configuration with ForestOutput like below:
|
|
72
72
|
If you want to place logs /var/archive for `service.search.**` as filename with hostname, without compression, `case` directive is useful:
|
73
73
|
|
74
74
|
<match service.*>
|
75
|
-
type forest
|
75
|
+
@type forest
|
76
76
|
subtype file
|
77
77
|
remove_prefix service
|
78
78
|
<template>
|
79
79
|
time_slice_format %Y%m%d%H
|
80
80
|
</template>
|
81
81
|
<case search.**>
|
82
|
-
compress no
|
83
82
|
path /var/archive/__TAG__.__HOSTNAME__.*.log
|
84
83
|
</case>
|
85
84
|
<case *>
|
86
|
-
compress
|
85
|
+
compress gz
|
87
86
|
path /var/log/__TAG__.*.log
|
88
87
|
</case>
|
89
88
|
</match>
|
@@ -91,16 +90,15 @@ If you want to place logs /var/archive for `service.search.**` as filename with
|
|
91
90
|
`case` configuration overwrites `template` configuration, so you can also write like this:
|
92
91
|
|
93
92
|
<match service.*>
|
94
|
-
type forest
|
93
|
+
@type forest
|
95
94
|
subtype file
|
96
95
|
remove_prefix service
|
97
96
|
<template>
|
98
97
|
time_slice_format %Y%m%d%H
|
99
|
-
compress
|
98
|
+
compress gz
|
100
99
|
path /var/log/__TAG__.*.log
|
101
100
|
</template>
|
102
101
|
<case search.**>
|
103
|
-
compress no
|
104
102
|
path /var/archive/__TAG__.*.log
|
105
103
|
</case>
|
106
104
|
</match>
|
@@ -108,21 +106,21 @@ If you want to place logs /var/archive for `service.search.**` as filename with
|
|
108
106
|
Version 0.2.0 or later, subsections adding/overwriting are supported. About the case below, three `<store>` subsections are defined for `search.**` pattern.
|
109
107
|
|
110
108
|
<match service.*>
|
111
|
-
type forest
|
109
|
+
@type forest
|
112
110
|
subtype copy
|
113
111
|
<template>
|
114
112
|
<store>
|
115
|
-
type file
|
113
|
+
@type file
|
116
114
|
path /path/to/copy1
|
117
115
|
</store>
|
118
116
|
<store>
|
119
|
-
type file
|
117
|
+
@type file
|
120
118
|
path /path/to/copy2
|
121
119
|
</store>
|
122
120
|
</template>
|
123
121
|
<case search.**>
|
124
122
|
<store>
|
125
|
-
type file
|
123
|
+
@type file
|
126
124
|
path /path/to/copy3
|
127
125
|
</store>
|
128
126
|
</case>
|
@@ -131,7 +129,7 @@ Version 0.2.0 or later, subsections adding/overwriting are supported. About the
|
|
131
129
|
Subsections with same arguments will be overwritten. See this example:
|
132
130
|
|
133
131
|
<match service.*>
|
134
|
-
type forest
|
132
|
+
@type forest
|
135
133
|
subtype route
|
136
134
|
<template>
|
137
135
|
<route {search,admin}.a>
|
data/example/sample.conf
ADDED
@@ -1,13 +1,13 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
Gem::Specification.new do |gem|
|
3
3
|
gem.name = "fluent-plugin-forest"
|
4
|
-
gem.version = "0.3.
|
4
|
+
gem.version = "0.3.1"
|
5
5
|
gem.authors = ["TAGOMORI Satoshi"]
|
6
6
|
gem.email = ["tagomoris@gmail.com"]
|
7
7
|
gem.description = %q{create sub-plugin dynamically per tags, with template configuration and parameters}
|
8
8
|
gem.summary = %q{plugin to create output plugin instances per tags dynamically}
|
9
9
|
gem.homepage = "https://github.com/tagomoris/fluent-plugin-forest"
|
10
|
-
gem.license = "
|
10
|
+
gem.license = "Apache-2.0"
|
11
11
|
|
12
12
|
gem.files = `git ls-files`.split($\)
|
13
13
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
@@ -15,5 +15,6 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.require_paths = ["lib"]
|
16
16
|
|
17
17
|
gem.add_development_dependency "rake"
|
18
|
+
gem.add_development_dependency "test-unit", "~> 3.1.7"
|
18
19
|
gem.add_runtime_dependency "fluentd"
|
19
20
|
end
|
@@ -141,7 +141,7 @@ class Fluent::ForestOutput < Fluent::MultiOutput
|
|
141
141
|
log.error e.backtrace.join("\n")
|
142
142
|
log.error "Cannot output messages with tag '#{tag}'"
|
143
143
|
output = nil
|
144
|
-
rescue StandardError => e
|
144
|
+
rescue StandardError, ScriptError => e
|
145
145
|
log.error "failed to configure/start sub output #{@subtype}: #{e.message}"
|
146
146
|
log.error e.backtrace.join("\n")
|
147
147
|
log.error "Cannot output messages with tag '#{tag}'"
|
@@ -168,7 +168,11 @@ class Fluent::ForestOutput < Fluent::MultiOutput
|
|
168
168
|
output = plant(tag)
|
169
169
|
end
|
170
170
|
if output
|
171
|
-
output.
|
171
|
+
if output.respond_to?(:emit_events)
|
172
|
+
output.emit_events(tag, es)
|
173
|
+
else
|
174
|
+
output.emit(tag, es, chain)
|
175
|
+
end
|
172
176
|
else
|
173
177
|
chain.next
|
174
178
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-forest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TAGOMORI Satoshi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: test-unit
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 3.1.7
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 3.1.7
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: fluentd
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,6 +66,7 @@ files:
|
|
52
66
|
- LICENSE.txt
|
53
67
|
- README.md
|
54
68
|
- Rakefile
|
69
|
+
- example/sample.conf
|
55
70
|
- fluent-plugin-forest.gemspec
|
56
71
|
- lib/fluent/plugin/out_forest.rb
|
57
72
|
- test/helper.rb
|
@@ -60,7 +75,7 @@ files:
|
|
60
75
|
- test/plugin/test_out_forest_test.rb
|
61
76
|
homepage: https://github.com/tagomoris/fluent-plugin-forest
|
62
77
|
licenses:
|
63
|
-
-
|
78
|
+
- Apache-2.0
|
64
79
|
metadata: {}
|
65
80
|
post_install_message:
|
66
81
|
rdoc_options: []
|
@@ -78,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
93
|
version: '0'
|
79
94
|
requirements: []
|
80
95
|
rubyforge_project:
|
81
|
-
rubygems_version: 2.
|
96
|
+
rubygems_version: 2.5.1
|
82
97
|
signing_key:
|
83
98
|
specification_version: 4
|
84
99
|
summary: plugin to create output plugin instances per tags dynamically
|