fluentd 1.5.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of fluentd might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +147 -0
- data/.gitlab/cicd-template.yaml +10 -0
- data/CHANGELOG.md +22 -0
- data/README.md +5 -0
- data/lib/fluent/command/fluentd.rb +2 -2
- data/lib/fluent/command/plugin_config_formatter.rb +14 -2
- data/lib/fluent/command/plugin_generator.rb +6 -1
- data/lib/fluent/plugin/in_monitor_agent.rb +61 -67
- data/lib/fluent/plugin/in_tail.rb +1 -1
- data/lib/fluent/plugin/out_forward.rb +3 -3
- data/lib/fluent/time.rb +19 -3
- data/lib/fluent/version.rb +1 -1
- data/test/plugin/test_in_monitor_agent.rb +13 -0
- data/test/plugin/test_in_tail.rb +1 -1
- data/test/test_time_parser.rb +8 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc00110d00a473f82be35d411b2efcad974613e6ac16db59538840bced53ce02
|
4
|
+
data.tar.gz: 4bcb347f931027fabff0516c589a6b439763a0f36e38c3707213955f8b2fce2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9eaf4fab8332a2ba7d172b6d63ed08eecab23f5bdcdbc56fe557b3a888bf155e3eb404bfa0a583dc3483fdee5ab5a415f8e63157379073299815c194bf45f2b3
|
7
|
+
data.tar.gz: be56a1d495a143a136a716f0b9142dfcc22d0c4ed88bd188ad0bc90e8253444eb47e70f6f7d4274855feb47c45f051ebd01fd399fbc046ab2d18ca8a9e321140
|
data/.gitlab-ci.yml
ADDED
@@ -0,0 +1,147 @@
|
|
1
|
+
include:
|
2
|
+
- local: '/.gitlab/cicd-template.yaml'
|
3
|
+
|
4
|
+
stages:
|
5
|
+
- build
|
6
|
+
- tests
|
7
|
+
|
8
|
+
2-1-10:
|
9
|
+
image: "ruby:2.1.10"
|
10
|
+
stage: build
|
11
|
+
allow_failure: true
|
12
|
+
extends: .install-template
|
13
|
+
script:
|
14
|
+
- bundle install --jobs=3 --retry=3
|
15
|
+
cache:
|
16
|
+
key: "$CI_COMMIT_REF_SLUG 2-1-10"
|
17
|
+
paths:
|
18
|
+
- ./*
|
19
|
+
|
20
|
+
2-2-10:
|
21
|
+
image: "ruby:2.2.10"
|
22
|
+
stage: build
|
23
|
+
allow_failure: true
|
24
|
+
extends: .install-template
|
25
|
+
script:
|
26
|
+
- bundle install --jobs=3 --retry=3
|
27
|
+
cache:
|
28
|
+
key: "$CI_COMMIT_REF_SLUG 2-2-10"
|
29
|
+
paths:
|
30
|
+
|
31
|
+
2-4-5:
|
32
|
+
image: "ruby:2.4.5"
|
33
|
+
stage: build
|
34
|
+
allow_failure: true
|
35
|
+
extends: .install-template
|
36
|
+
script:
|
37
|
+
- bundle install --jobs=3 --retry=3
|
38
|
+
cache:
|
39
|
+
key: "$CI_COMMIT_REF_SLUG 2-4-5"
|
40
|
+
paths:
|
41
|
+
|
42
|
+
2-5-5:
|
43
|
+
image: "ruby:2.5.5"
|
44
|
+
stage: build
|
45
|
+
allow_failure: true
|
46
|
+
extends: .install-template
|
47
|
+
script:
|
48
|
+
- bundle install --jobs=3 --retry=3
|
49
|
+
cache:
|
50
|
+
key: "$CI_COMMIT_REF_SLUG 2-5-5"
|
51
|
+
paths:
|
52
|
+
|
53
|
+
2-6-3:
|
54
|
+
image: "ruby:2.6.3"
|
55
|
+
stage: build
|
56
|
+
allow_failure: true
|
57
|
+
extends: .install-template
|
58
|
+
script:
|
59
|
+
- bundle install --jobs=3 --retry=3
|
60
|
+
cache:
|
61
|
+
key: "$CI_COMMIT_REF_SLUG 2-6-3"
|
62
|
+
paths:
|
63
|
+
|
64
|
+
rubyhead:
|
65
|
+
image: "ruby:latest"
|
66
|
+
stage: build
|
67
|
+
allow_failure: true
|
68
|
+
extends: .install-template
|
69
|
+
script:
|
70
|
+
- bundle install --jobs=3 --retry=3
|
71
|
+
cache:
|
72
|
+
key: "$CI_COMMIT_REF_SLUG latest"
|
73
|
+
paths:
|
74
|
+
- ./*
|
75
|
+
|
76
|
+
2-1-10-test:
|
77
|
+
image: "ruby:2.1.10"
|
78
|
+
stage: tests
|
79
|
+
allow_failure: true
|
80
|
+
extends: .test-template
|
81
|
+
script:
|
82
|
+
- bundle exec rake test
|
83
|
+
cache:
|
84
|
+
key: "$CI_COMMIT_REF_SLUG 2-1-10"
|
85
|
+
paths:
|
86
|
+
- ./*
|
87
|
+
|
88
|
+
2-2-10-test:
|
89
|
+
image: "ruby:2.2.10"
|
90
|
+
stage: tests
|
91
|
+
allow_failure: true
|
92
|
+
extends: .test-template
|
93
|
+
script:
|
94
|
+
- bundle exec rake test
|
95
|
+
cache:
|
96
|
+
key: "$CI_COMMIT_REF_SLUG 2-2-10"
|
97
|
+
paths:
|
98
|
+
- ./*
|
99
|
+
|
100
|
+
2-4-5-test:
|
101
|
+
image: "ruby:2.4.5"
|
102
|
+
stage: tests
|
103
|
+
allow_failure: true
|
104
|
+
extends: .test-template
|
105
|
+
script:
|
106
|
+
- bundle exec rake test
|
107
|
+
cache:
|
108
|
+
key: "$CI_COMMIT_REF_SLUG 2-4-5"
|
109
|
+
paths:
|
110
|
+
- ./*
|
111
|
+
|
112
|
+
2-5-5-test:
|
113
|
+
image: "ruby:2.5.5"
|
114
|
+
stage: tests
|
115
|
+
allow_failure: true
|
116
|
+
extends: .test-template
|
117
|
+
script:
|
118
|
+
- bundle exec rake test
|
119
|
+
cache:
|
120
|
+
key: "$CI_COMMIT_REF_SLUG 2-5-5"
|
121
|
+
paths:
|
122
|
+
- ./*
|
123
|
+
|
124
|
+
2-6-3-test:
|
125
|
+
image: "ruby:2.6.3"
|
126
|
+
stage: tests
|
127
|
+
allow_failure: true
|
128
|
+
extends: .test-template
|
129
|
+
script:
|
130
|
+
- bundle exec rake test
|
131
|
+
cache:
|
132
|
+
key: "$CI_COMMIT_REF_SLUG 2-6-3"
|
133
|
+
paths:
|
134
|
+
- ./*
|
135
|
+
|
136
|
+
rubyhead-test:
|
137
|
+
image: "ruby:latest"
|
138
|
+
stage: tests
|
139
|
+
allow_failure: true
|
140
|
+
extends: .test-template
|
141
|
+
script:
|
142
|
+
- bundle exec rake test
|
143
|
+
cache:
|
144
|
+
key: "$CI_COMMIT_REF_SLUG latest"
|
145
|
+
paths:
|
146
|
+
- ./*
|
147
|
+
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,27 @@
|
|
1
1
|
# v1.5
|
2
2
|
|
3
|
+
## Release v1.5.1 - 2019/06/05
|
4
|
+
|
5
|
+
### Enhancement
|
6
|
+
|
7
|
+
* in_tail: Increase read block size to reduce IO call
|
8
|
+
https://github.com/fluent/fluentd/pull/2418
|
9
|
+
* in_monitor_agent: Refactor code
|
10
|
+
https://github.com/fluent/fluentd/pull/2422
|
11
|
+
|
12
|
+
### Bug fixes
|
13
|
+
|
14
|
+
* out_forward: Fix socket handling of keepalive
|
15
|
+
https://github.com/fluent/fluentd/pull/2434
|
16
|
+
* parser: Fix the use of name based timezone
|
17
|
+
https://github.com/fluent/fluentd/pull/2421
|
18
|
+
* in_monitor_agent: Fix debug parameter handling
|
19
|
+
https://github.com/fluent/fluentd/pull/2423
|
20
|
+
* command: Fix error handling of log rotation age option
|
21
|
+
https://github.com/fluent/fluentd/pull/2427
|
22
|
+
* command: Fix ERB warning for ruby 2.6 or later
|
23
|
+
https://github.com/fluent/fluentd/pull/2430
|
24
|
+
|
3
25
|
## Release v1.5.0 - 2019/05/18
|
4
26
|
|
5
27
|
### New feature
|
data/README.md
CHANGED
@@ -1,10 +1,15 @@
|
|
1
1
|
Fluentd: Open-Source Log Collector
|
2
2
|
===================================
|
3
|
+
Travis CI:
|
3
4
|
|
4
5
|
[<img src="https://travis-ci.org/fluent/fluentd.svg" />](https://travis-ci.org/fluent/fluentd) [![Code Climate](https://codeclimate.com/github/fluent/fluentd/badges/gpa.svg)](https://codeclimate.com/github/fluent/fluentd)
|
5
6
|
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/1189/badge)](https://bestpractices.coreinfrastructure.org/projects/1189)
|
6
7
|
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Ffluent%2Ffluentd.svg?type=shield)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Ffluent%2Ffluentd?ref=badge_shield)
|
7
8
|
|
9
|
+
GitLab CI:
|
10
|
+
|
11
|
+
[![pipeline status](https://gitlab.com/fluent/fluentd/badges/master/pipeline.svg)](https://gitlab.com/fluent/fluentd/commits/master)
|
12
|
+
|
8
13
|
[Fluentd](https://www.fluentd.org/) collects events from various data sources and writes them to files, RDBMS, NoSQL, IaaS, SaaS, Hadoop and so on. Fluentd helps you unify your logging infrastructure (Learn more about the [Unified Logging Layer](https://www.fluentd.org/blog/unified-logging-layer)).
|
9
14
|
|
10
15
|
<p align="center">
|
@@ -92,8 +92,8 @@ op.on('--log-rotate-age AGE', 'generations to keep rotated log files') {|age|
|
|
92
92
|
else
|
93
93
|
begin
|
94
94
|
opts[:log_rotate_age] = Integer(age)
|
95
|
-
rescue TypeError
|
96
|
-
usage "log-rotate-age should be #{
|
95
|
+
rescue TypeError, ArgumentError
|
96
|
+
usage "log-rotate-age should be #{ROTATE_AGE.join(', ')} or a number"
|
97
97
|
end
|
98
98
|
end
|
99
99
|
}
|
@@ -164,7 +164,13 @@ class FluentPluginConfigFormatter
|
|
164
164
|
params.each do |name, config|
|
165
165
|
next if name == :section
|
166
166
|
template_name = @compact ? "param.md-compact.erb" : "param.md.erb"
|
167
|
-
|
167
|
+
template = template_path(template_name).read
|
168
|
+
dumped <<
|
169
|
+
if ERB.instance_method(:initialize).parameters.assoc(:key) # Ruby 2.6+
|
170
|
+
ERB.new(template, trim_mode: "-")
|
171
|
+
else
|
172
|
+
ERB.new(template, nil, "-")
|
173
|
+
end.result(binding)
|
168
174
|
end
|
169
175
|
dumped << "\n"
|
170
176
|
sections.each do |section_name, sub_section|
|
@@ -172,7 +178,13 @@ class FluentPluginConfigFormatter
|
|
172
178
|
multi = sub_section.delete(:multi)
|
173
179
|
alias_name = sub_section.delete(:alias)
|
174
180
|
sub_section.delete(:section)
|
175
|
-
|
181
|
+
template = template_path("section.md.erb").read
|
182
|
+
dumped <<
|
183
|
+
if ERB.instance_method(:initialize).parameters.assoc(:key) # Ruby 2.6+
|
184
|
+
ERB.new(template, trim_mode: "-")
|
185
|
+
else
|
186
|
+
ERB.new(template, nil, "-")
|
187
|
+
end.result(binding)
|
176
188
|
end
|
177
189
|
dumped
|
178
190
|
end
|
@@ -72,7 +72,12 @@ class FluentPluginGenerator
|
|
72
72
|
|
73
73
|
def template(source, dest)
|
74
74
|
dest.dirname.mkpath
|
75
|
-
contents =
|
75
|
+
contents =
|
76
|
+
if ERB.instance_method(:initialize).parameters.assoc(:key) # Ruby 2.6+
|
77
|
+
ERB.new(source.read, trim_mode: "-")
|
78
|
+
else
|
79
|
+
ERB.new(source.read, nil, "-")
|
80
|
+
end.result(binding)
|
76
81
|
label = create_label(dest, contents)
|
77
82
|
puts "\t#{label} #{dest}"
|
78
83
|
if label == "conflict"
|
@@ -50,7 +50,7 @@ module Fluent::Plugin
|
|
50
50
|
|
51
51
|
def do_GET(req, res)
|
52
52
|
begin
|
53
|
-
code, header, body = process(req
|
53
|
+
code, header, body = process(req)
|
54
54
|
rescue
|
55
55
|
code, header, body = render_json_error(500, {
|
56
56
|
'message '=> 'Internal Server Error',
|
@@ -67,85 +67,35 @@ module Fluent::Plugin
|
|
67
67
|
res.body = body
|
68
68
|
end
|
69
69
|
|
70
|
-
def build_object(req,
|
70
|
+
def build_object(req, opts)
|
71
71
|
unless req.path_info == ""
|
72
72
|
return render_json_error(404, "Not found")
|
73
73
|
end
|
74
74
|
|
75
|
-
|
76
|
-
if
|
77
|
-
begin
|
78
|
-
qs = CGI.parse(req.query_string)
|
79
|
-
rescue
|
80
|
-
return render_json_error(400, "Invalid query string")
|
81
|
-
end
|
82
|
-
else
|
83
|
-
qs = Hash.new {|h,k| [] }
|
84
|
-
end
|
85
|
-
|
86
|
-
# if ?debug=1 is set, set :with_debug_info for get_monitor_info
|
87
|
-
# and :pretty_json for render_json_error
|
88
|
-
opts = {with_config: @agent.include_config, with_retry: @agent.include_retry}
|
89
|
-
if s = qs['debug'] and s[0]
|
90
|
-
opts[:with_debug_info] = true
|
91
|
-
opts[:pretty_json] = true
|
92
|
-
end
|
93
|
-
|
94
|
-
if ivars = (qs['with_ivars'] || []).first
|
95
|
-
opts[:ivars] = ivars.split(',')
|
96
|
-
end
|
97
|
-
|
98
|
-
if with_config = get_search_parameter(qs, 'with_config'.freeze)
|
99
|
-
opts[:with_config] = Fluent::Config.bool_value(with_config)
|
100
|
-
end
|
101
|
-
|
102
|
-
if with_retry = get_search_parameter(qs, 'with_retry'.freeze)
|
103
|
-
opts[:with_retry] = Fluent::Config.bool_value(with_retry)
|
104
|
-
end
|
105
|
-
|
106
|
-
if tag = get_search_parameter(qs, 'tag'.freeze)
|
75
|
+
qs = opts[:query]
|
76
|
+
if tag = qs['tag'.freeze].first
|
107
77
|
# ?tag= to search an output plugin by match pattern
|
108
78
|
if obj = @agent.plugin_info_by_tag(tag, opts)
|
109
79
|
list = [obj]
|
110
80
|
else
|
111
81
|
list = []
|
112
82
|
end
|
113
|
-
|
114
|
-
elsif plugin_id = get_search_parameter(qs, '@id'.freeze)
|
83
|
+
elsif plugin_id = (qs['@id'.freeze].first || qs['id'.freeze].first)
|
115
84
|
# ?@id= to search a plugin by 'id <plugin_id>' config param
|
116
85
|
if obj = @agent.plugin_info_by_id(plugin_id, opts)
|
117
86
|
list = [obj]
|
118
87
|
else
|
119
88
|
list = []
|
120
89
|
end
|
121
|
-
|
122
|
-
elsif plugin_id = get_search_parameter(qs, 'id'.freeze)
|
123
|
-
# Without @ version of ?@id= for backward compatibility
|
124
|
-
if obj = @agent.plugin_info_by_id(plugin_id, opts)
|
125
|
-
list = [obj]
|
126
|
-
else
|
127
|
-
list = []
|
128
|
-
end
|
129
|
-
|
130
|
-
elsif plugin_type = get_search_parameter(qs, '@type'.freeze)
|
90
|
+
elsif plugin_type = (qs['@type'.freeze].first || qs['type'.freeze].first)
|
131
91
|
# ?@type= to search plugins by 'type <type>' config param
|
132
92
|
list = @agent.plugins_info_by_type(plugin_type, opts)
|
133
|
-
|
134
|
-
elsif plugin_type = get_search_parameter(qs, 'type'.freeze)
|
135
|
-
# Without @ version of ?@type= for backward compatibility
|
136
|
-
list = @agent.plugins_info_by_type(plugin_type, opts)
|
137
|
-
|
138
93
|
else
|
139
94
|
# otherwise show all plugins
|
140
95
|
list = @agent.plugins_info_all(opts)
|
141
96
|
end
|
142
97
|
|
143
|
-
|
144
|
-
end
|
145
|
-
|
146
|
-
def get_search_parameter(qs, param_name)
|
147
|
-
return nil unless qs.has_key?(param_name)
|
148
|
-
qs[param_name].first
|
98
|
+
list
|
149
99
|
end
|
150
100
|
|
151
101
|
def render_json(obj, opts={})
|
@@ -160,11 +110,52 @@ module Fluent::Plugin
|
|
160
110
|
end
|
161
111
|
[code, {'Content-Type'=>'application/json'}, js]
|
162
112
|
end
|
113
|
+
|
114
|
+
private
|
115
|
+
|
116
|
+
def build_option(req)
|
117
|
+
qs = Hash.new { |_, _| [] }
|
118
|
+
# parse ?=query string
|
119
|
+
if req.query_string
|
120
|
+
begin
|
121
|
+
qs.merge!(CGI.parse(req.query_string))
|
122
|
+
rescue
|
123
|
+
return render_json_error(400, "Invalid query string")
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
# if ?debug=1 is set, set :with_debug_info for get_monitor_info
|
128
|
+
# and :pretty_json for render_json_error
|
129
|
+
opts = { query: qs }
|
130
|
+
if qs['debug'.freeze].first
|
131
|
+
opts[:with_debug_info] = true
|
132
|
+
opts[:pretty_json] = true
|
133
|
+
end
|
134
|
+
|
135
|
+
if ivars = qs['with_ivars'.freeze].first
|
136
|
+
opts[:ivars] = ivars.split(',')
|
137
|
+
end
|
138
|
+
|
139
|
+
if with_config = qs['with_config'.freeze].first
|
140
|
+
opts[:with_config] = Fluent::Config.bool_value(with_config)
|
141
|
+
else
|
142
|
+
opts[:with_config] = @agent.include_config
|
143
|
+
end
|
144
|
+
|
145
|
+
if with_retry = qs['with_retry'.freeze].first
|
146
|
+
opts[:with_retry] = Fluent::Config.bool_value(with_retry)
|
147
|
+
else
|
148
|
+
opts[:with_retry] = @agent.include_retry
|
149
|
+
end
|
150
|
+
|
151
|
+
opts
|
152
|
+
end
|
163
153
|
end
|
164
154
|
|
165
155
|
class LTSVMonitorServlet < MonitorServlet
|
166
|
-
def process(req
|
167
|
-
|
156
|
+
def process(req)
|
157
|
+
opts = build_option(req)
|
158
|
+
list = build_object(req, opts)
|
168
159
|
return unless list
|
169
160
|
|
170
161
|
normalized = JSON.parse(list.to_json)
|
@@ -186,8 +177,9 @@ module Fluent::Plugin
|
|
186
177
|
end
|
187
178
|
|
188
179
|
class JSONMonitorServlet < MonitorServlet
|
189
|
-
def process(req
|
190
|
-
|
180
|
+
def process(req)
|
181
|
+
opts = build_option(req)
|
182
|
+
list = build_object(req, opts)
|
191
183
|
return unless list
|
192
184
|
|
193
185
|
render_json({
|
@@ -197,7 +189,7 @@ module Fluent::Plugin
|
|
197
189
|
end
|
198
190
|
|
199
191
|
class ConfigMonitorServlet < MonitorServlet
|
200
|
-
def build_object(req,
|
192
|
+
def build_object(req, _opt)
|
201
193
|
{
|
202
194
|
'pid' => Process.pid,
|
203
195
|
'ppid' => Process.ppid
|
@@ -206,8 +198,9 @@ module Fluent::Plugin
|
|
206
198
|
end
|
207
199
|
|
208
200
|
class LTSVConfigMonitorServlet < ConfigMonitorServlet
|
209
|
-
def process(req
|
210
|
-
|
201
|
+
def process(req)
|
202
|
+
opts = build_option(req)
|
203
|
+
result = build_object(req, opts)
|
211
204
|
|
212
205
|
row = []
|
213
206
|
JSON.parse(result.to_json).each_pair { |k, v|
|
@@ -220,9 +213,10 @@ module Fluent::Plugin
|
|
220
213
|
end
|
221
214
|
|
222
215
|
class JSONConfigMonitorServlet < ConfigMonitorServlet
|
223
|
-
def process(req
|
224
|
-
|
225
|
-
|
216
|
+
def process(req)
|
217
|
+
opts = build_option(req)
|
218
|
+
result = build_object(req, opts)
|
219
|
+
render_json(result, opts)
|
226
220
|
end
|
227
221
|
end
|
228
222
|
|
@@ -638,7 +638,7 @@ module Fluent::Plugin
|
|
638
638
|
@active_socks[key] = TimedSocket.new(timeout, yield, 0)
|
639
639
|
end
|
640
640
|
|
641
|
-
@active_socks[key].ref += 1
|
641
|
+
@active_socks[key].ref += 1
|
642
642
|
@active_socks[key].sock
|
643
643
|
end
|
644
644
|
end
|
@@ -1084,10 +1084,10 @@ module Fluent::Plugin
|
|
1084
1084
|
begin
|
1085
1085
|
yield(sock)
|
1086
1086
|
rescue
|
1087
|
-
@socket_cache.revoke
|
1087
|
+
@socket_cache.revoke if @keepalive
|
1088
1088
|
raise
|
1089
1089
|
else
|
1090
|
-
@socket_cache.dec_ref
|
1090
|
+
@socket_cache.dec_ref if @keepalive
|
1091
1091
|
ensure
|
1092
1092
|
sock.close unless @keepalive
|
1093
1093
|
end
|
data/lib/fluent/time.rb
CHANGED
@@ -203,7 +203,13 @@ module Fluent
|
|
203
203
|
# unixtime_in_expected_tz = unixtime_in_localtime + offset_diff
|
204
204
|
offset_diff = case
|
205
205
|
when format_with_timezone then nil
|
206
|
-
when timezone then
|
206
|
+
when timezone then
|
207
|
+
offset = Fluent::Timezone.utc_offset(timezone)
|
208
|
+
if offset.respond_to?(:call)
|
209
|
+
->(t) { Time.now.localtime.utc_offset - offset.call(t) }
|
210
|
+
else
|
211
|
+
Time.now.localtime.utc_offset - offset
|
212
|
+
end
|
207
213
|
when localtime then 0
|
208
214
|
else Time.now.localtime.utc_offset # utc
|
209
215
|
end
|
@@ -214,8 +220,18 @@ module Fluent
|
|
214
220
|
when format_with_timezone && strptime then ->(v){ Fluent::EventTime.from_time(strptime.exec(v)) }
|
215
221
|
when format_with_timezone then ->(v){ Fluent::EventTime.from_time(Time.strptime(v, format)) }
|
216
222
|
when format == '%iso8601' then ->(v){ Fluent::EventTime.from_time(Time.iso8601(v)) }
|
217
|
-
when strptime then
|
218
|
-
|
223
|
+
when strptime then
|
224
|
+
if offset_diff.respond_to?(:call)
|
225
|
+
->(v) { t = strptime.exec(v); Fluent::EventTime.new(t.to_i + offset_diff.call(t), t.nsec) }
|
226
|
+
else
|
227
|
+
->(v) { t = strptime.exec(v); Fluent::EventTime.new(t.to_i + offset_diff, t.nsec) }
|
228
|
+
end
|
229
|
+
when format then
|
230
|
+
if offset_diff.respond_to?(:call)
|
231
|
+
->(v){ t = Time.strptime(v, format); Fluent::EventTime.new(t.to_i + offset_diff.call(t), t.nsec) }
|
232
|
+
else
|
233
|
+
->(v){ t = Time.strptime(v, format); Fluent::EventTime.new(t.to_i + offset_diff, t.nsec) }
|
234
|
+
end
|
219
235
|
else ->(v){ Fluent::EventTime.parse(v) }
|
220
236
|
end
|
221
237
|
end
|
data/lib/fluent/version.rb
CHANGED
@@ -414,6 +414,19 @@ plugin_id:test_filter\tplugin_category:filter\ttype:test_filter\toutput_plugin:f
|
|
414
414
|
assert_equal(["/etc/fluent/plugin"], res["plugin_dirs"])
|
415
415
|
assert_nil(res["log_path"])
|
416
416
|
end
|
417
|
+
|
418
|
+
test "/api/config.json?debug=1" do
|
419
|
+
d = create_driver("
|
420
|
+
@type monitor_agent
|
421
|
+
bind '127.0.0.1'
|
422
|
+
port #{@port}
|
423
|
+
tag monitor
|
424
|
+
")
|
425
|
+
d.instance.start
|
426
|
+
# To check pretty print
|
427
|
+
assert_true !get("http://127.0.0.1:#{@port}/api/config.json").body.include?("\n")
|
428
|
+
assert_true get("http://127.0.0.1:#{@port}/api/config.json?debug=1").body.include?("\n")
|
429
|
+
end
|
417
430
|
end
|
418
431
|
|
419
432
|
sub_test_case "check retry of buffered plugins" do
|
data/test/plugin/test_in_tail.rb
CHANGED
@@ -196,7 +196,7 @@ class TailInputTest < Test::Unit::TestCase
|
|
196
196
|
config = CONFIG_READ_FROM_HEAD + config_element("", "", { "read_lines_limit" => limit }) + PARSE_SINGLE_LINE_CONFIG
|
197
197
|
end
|
198
198
|
d = create_driver(config)
|
199
|
-
msg = 'test' *
|
199
|
+
msg = 'test' * 2000 # in_tail reads 8192 bytes at once.
|
200
200
|
|
201
201
|
d.run(expect_emits: 1) do
|
202
202
|
File.open("#{TMP_DIR}/tail.txt", "ab") {|f|
|
data/test/test_time_parser.rb
CHANGED
@@ -80,6 +80,14 @@ class TimeParserTest < ::Test::Unit::TestCase
|
|
80
80
|
assert_equal_event_time(time, event_time("2016-09-02 18:42:31.123456789 -07:00", format: '%Y-%m-%d %H:%M:%S.%N %z'))
|
81
81
|
end
|
82
82
|
|
83
|
+
def test_parse_time_with_expected_timezone_name
|
84
|
+
time = with_timezone("UTC-09") do
|
85
|
+
parser = Fluent::TimeParser.new("%Y-%m-%d %H:%M:%S.%N", nil, "Europe/Zurich")
|
86
|
+
parser.parse("2016-12-02 18:42:31.123456789")
|
87
|
+
end
|
88
|
+
assert_equal_event_time(time, event_time("2016-12-02 18:42:31.123456789 +01:00", format: '%Y-%m-%d %H:%M:%S.%N %z'))
|
89
|
+
end
|
90
|
+
|
83
91
|
sub_test_case 'TimeMixin::Parser' do
|
84
92
|
class DummyForTimeParser
|
85
93
|
include Fluent::Configurable
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluentd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sadayuki Furuhashi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05
|
11
|
+
date: 2019-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|
@@ -331,6 +331,8 @@ files:
|
|
331
331
|
- ".github/ISSUE_TEMPLATE.md"
|
332
332
|
- ".github/PULL_REQUEST_TEMPLATE.md"
|
333
333
|
- ".gitignore"
|
334
|
+
- ".gitlab-ci.yml"
|
335
|
+
- ".gitlab/cicd-template.yaml"
|
334
336
|
- ".travis.yml"
|
335
337
|
- ADOPTERS.md
|
336
338
|
- AUTHORS
|