fluentd 0.12.33 → 0.12.34
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/ChangeLog +15 -1
- data/lib/fluent/plugin/in_http.rb +2 -0
- data/lib/fluent/plugin/in_syslog.rb +14 -7
- data/lib/fluent/plugin/in_tcp.rb +1 -1
- data/lib/fluent/plugin/in_udp.rb +12 -2
- data/lib/fluent/plugin/socket_util.rb +9 -4
- data/lib/fluent/root_agent.rb +5 -0
- data/lib/fluent/version.rb +1 -1
- data/test/plugin/test_in_http.rb +16 -0
- data/test/plugin/test_in_syslog.rb +53 -5
- data/test/plugin/test_in_udp.rb +10 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffd21d1304c2f951d877baf533d64ddb647805de
|
4
|
+
data.tar.gz: 44faf3d4806bfc29b9cf2a1eab46b4fffd2c7b21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e30eb92f16978286232710abdb1512144cfbe44c8b96b1acbe200530e9aa3b446e609c1d69b2b5b4ca82e3d3101f6755e0c090061713f90af6a0e024b736780e
|
7
|
+
data.tar.gz: f9bb8a3b4019a9de03ad06f6486f74de29abf5c49cf6a98eecc8720776ad8cf4aa01fd8a72c161c95092786bafec953cdda4d2a10d721cdb4de43abe9f14b819
|
data/ChangeLog
CHANGED
@@ -1,10 +1,24 @@
|
|
1
1
|
# v0.12
|
2
2
|
|
3
|
+
## Release 0.12.34 - 2017/03/25
|
4
|
+
|
5
|
+
### New features / Enhancement
|
6
|
+
|
7
|
+
* in_syslog/in_udp/in_tcp: Fix hostname lookup and unify parameter name to source_hostname_key
|
8
|
+
https://github.com/fluent/fluentd/pull/1515
|
9
|
+
* in_http: Support application/msgpack header
|
10
|
+
https://github.com/fluent/fluentd/pull/1506
|
11
|
+
|
12
|
+
### Bug fixes
|
13
|
+
|
14
|
+
* engine: Label's plugins should be flushed when receive signal
|
15
|
+
https://github.com/fluent/fluentd/pull/1508
|
16
|
+
|
3
17
|
## Release 0.12.33 - 2017/03/09
|
4
18
|
|
5
19
|
### New features / Enhancement
|
6
20
|
|
7
|
-
*
|
21
|
+
* parser_syslog: Backport 'Support rfc5424 syslog format'
|
8
22
|
https://github.com/fluent/fluentd/pull/1495
|
9
23
|
* in_forward: Add source_address_key and fix source_hostname_key parameters
|
10
24
|
https://github.com/fluent/fluentd/pull/1490
|
@@ -355,6 +355,8 @@ module Fluent
|
|
355
355
|
params.update WEBrick::HTTPUtils.parse_form_data(@body, boundary)
|
356
356
|
elsif @content_type =~ /^application\/json/
|
357
357
|
params['json'] = @body
|
358
|
+
elsif @content_type =~ /^application\/msgpack/
|
359
|
+
params['msgpack'] = @body
|
358
360
|
end
|
359
361
|
path_info = uri.path
|
360
362
|
|
@@ -88,15 +88,18 @@ module Fluent
|
|
88
88
|
end
|
89
89
|
end
|
90
90
|
desc 'If true, add source host to event record.'
|
91
|
-
config_param :include_source_host, :bool, default: false
|
91
|
+
config_param :include_source_host, :bool, default: false, deprecated: "use source_hostname_key instead"
|
92
92
|
desc 'Specify key of source host when include_source_host is true.'
|
93
|
-
config_param :source_host_key, :string, default: 'source_host'.freeze
|
93
|
+
config_param :source_host_key, :string, default: 'source_host'.freeze, deprecated: "use source_hostname_key instead"
|
94
|
+
desc "The field name of the client's hostname."
|
95
|
+
config_param :source_hostname_key, :string, default: nil
|
94
96
|
desc 'The field name of the priority.'
|
95
97
|
config_param :priority_key, :string, default: nil
|
96
98
|
desc 'The field name of the facility.'
|
97
99
|
config_param :facility_key, :string, default: nil
|
98
|
-
|
100
|
+
desc "The max bytes of message"
|
99
101
|
config_param :message_length_limit, :size, default: 2048
|
102
|
+
config_param :blocking_timeout, :time, default: 0.5
|
100
103
|
|
101
104
|
def configure(conf)
|
102
105
|
super
|
@@ -110,6 +113,10 @@ module Fluent
|
|
110
113
|
@parser.configure(conf)
|
111
114
|
@use_default = true
|
112
115
|
end
|
116
|
+
|
117
|
+
if @source_hostname_key.nil? && @include_source_host
|
118
|
+
@source_hostname_key = @source_host_key
|
119
|
+
end
|
113
120
|
end
|
114
121
|
|
115
122
|
def start
|
@@ -162,7 +169,7 @@ module Fluent
|
|
162
169
|
|
163
170
|
record[@priority_key] = priority if @priority_key
|
164
171
|
record[@facility_key] = facility if @facility_key
|
165
|
-
record[@
|
172
|
+
record[@source_hostname_key] = addr[2] if @source_hostname_key
|
166
173
|
|
167
174
|
tag = "#{@tag}.#{facility}.#{priority}"
|
168
175
|
emit(tag, time, record)
|
@@ -185,7 +192,7 @@ module Fluent
|
|
185
192
|
|
186
193
|
record[@priority_key] = priority if @priority_key
|
187
194
|
record[@facility_key] = facility if @facility_key
|
188
|
-
record[@
|
195
|
+
record[@source_hostname_key] = addr[2] if @source_hostname_key
|
189
196
|
|
190
197
|
tag = "#{@tag}.#{facility}.#{priority}"
|
191
198
|
emit(tag, time, record)
|
@@ -202,10 +209,10 @@ module Fluent
|
|
202
209
|
if @protocol_type == :udp
|
203
210
|
@usock = SocketUtil.create_udp_socket(@bind)
|
204
211
|
@usock.bind(@bind, @port)
|
205
|
-
SocketUtil::UdpHandler.new(@usock, log, @message_length_limit, callback)
|
212
|
+
SocketUtil::UdpHandler.new(@usock, log, @message_length_limit, callback, !!@source_hostname_key)
|
206
213
|
else
|
207
214
|
# syslog family add "\n" to each message and this seems only way to split messages in tcp stream
|
208
|
-
Coolio::TCPServer.new(@bind, @port, SocketUtil::TcpHandler, log, "\n", callback)
|
215
|
+
Coolio::TCPServer.new(@bind, @port, SocketUtil::TcpHandler, log, "\n", callback, !!@source_hostname_key)
|
209
216
|
end
|
210
217
|
end
|
211
218
|
|
data/lib/fluent/plugin/in_tcp.rb
CHANGED
@@ -28,7 +28,7 @@ module Fluent
|
|
28
28
|
|
29
29
|
def listen(callback)
|
30
30
|
log.info "listening tcp socket on #{@bind}:#{@port}"
|
31
|
-
Coolio::TCPServer.new(@bind, @port, SocketUtil::TcpHandler, log, @delimiter, callback)
|
31
|
+
Coolio::TCPServer.new(@bind, @port, SocketUtil::TcpHandler, log, @delimiter, callback, !!@source_hostname_key)
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
data/lib/fluent/plugin/in_udp.rb
CHANGED
@@ -21,13 +21,23 @@ module Fluent
|
|
21
21
|
Plugin.register_input('udp', self)
|
22
22
|
|
23
23
|
config_set_default :port, 5160
|
24
|
-
|
24
|
+
|
25
|
+
desc "Deprecated parameter. Use message_length_limit instead"
|
26
|
+
config_param :body_size_limit, :size, default: nil, deprecated: "use message_length_limit instead."
|
27
|
+
desc "The max bytes of message"
|
28
|
+
config_param :message_length_limit, :size, default: 4096
|
29
|
+
|
30
|
+
def configure(conf)
|
31
|
+
super
|
32
|
+
|
33
|
+
@message_length_limit = @body_size_limit if @body_size_limit
|
34
|
+
end
|
25
35
|
|
26
36
|
def listen(callback)
|
27
37
|
log.info "listening udp socket on #{@bind}:#{@port}"
|
28
38
|
@usock = SocketUtil.create_udp_socket(@bind)
|
29
39
|
@usock.bind(@bind, @port)
|
30
|
-
SocketUtil::UdpHandler.new(@usock, log, @
|
40
|
+
SocketUtil::UdpHandler.new(@usock, log, @message_length_limit, callback, !!@source_hostname_key)
|
31
41
|
end
|
32
42
|
end
|
33
43
|
end
|
@@ -32,9 +32,10 @@ module Fluent
|
|
32
32
|
module_function :create_udp_socket
|
33
33
|
|
34
34
|
class UdpHandler < Coolio::IO
|
35
|
-
def initialize(io, log, body_size_limit, callback)
|
35
|
+
def initialize(io, log, body_size_limit, callback, resolve_hostname = false)
|
36
36
|
super(io)
|
37
37
|
@io = io
|
38
|
+
@io.do_not_reverse_lookup = !resolve_hostname
|
38
39
|
@log = log
|
39
40
|
@body_size_limit = body_size_limit
|
40
41
|
@callback = callback
|
@@ -52,9 +53,10 @@ module Fluent
|
|
52
53
|
class TcpHandler < Coolio::Socket
|
53
54
|
PEERADDR_FAILED = ["?", "?", "name resolusion failed", "?"]
|
54
55
|
|
55
|
-
def initialize(io, log, delimiter, callback)
|
56
|
+
def initialize(io, log, delimiter, callback, resolve_hostname = false)
|
56
57
|
super(io)
|
57
58
|
if io.is_a?(TCPSocket)
|
59
|
+
io.do_not_reverse_lookup = resolve_hostname
|
58
60
|
@addr = (io.peeraddr rescue PEERADDR_FAILED)
|
59
61
|
|
60
62
|
opt = [1, @timeout.to_i].pack('I!I!') # { int l_onoff; int l_linger; }
|
@@ -104,13 +106,16 @@ module Fluent
|
|
104
106
|
config_param :port, :integer, default: 5150
|
105
107
|
desc 'The bind address to listen to.'
|
106
108
|
config_param :bind, :string, default: '0.0.0.0'
|
109
|
+
desc "Deprecated parameter. Use source_hostname_key instead"
|
110
|
+
config_param :source_host_key, :string, default: nil, deprecated: "Use source_hostname_key instead"
|
107
111
|
desc "The field name of the client's hostname."
|
108
|
-
config_param :
|
112
|
+
config_param :source_hostname_key, :string, default: nil
|
109
113
|
config_param :blocking_timeout, :time, default: 0.5
|
110
114
|
|
111
115
|
def configure(conf)
|
112
116
|
super
|
113
117
|
|
118
|
+
@source_hostname_key = @source_host_key if @source_host_key
|
114
119
|
@parser = Plugin.new_parser(@format)
|
115
120
|
@parser.configure(conf)
|
116
121
|
end
|
@@ -145,7 +150,7 @@ module Fluent
|
|
145
150
|
return
|
146
151
|
end
|
147
152
|
|
148
|
-
record[@
|
153
|
+
record[@source_hostname_key] = addr[2] if @source_hostname_key
|
149
154
|
router.emit(@tag, time, record)
|
150
155
|
}
|
151
156
|
rescue => e
|
data/lib/fluent/root_agent.rb
CHANGED
@@ -138,6 +138,11 @@ module Fluent
|
|
138
138
|
super
|
139
139
|
end
|
140
140
|
|
141
|
+
def flush!
|
142
|
+
super
|
143
|
+
@labels.each{ |name, label| label.flush! }
|
144
|
+
end
|
145
|
+
|
141
146
|
def suppress_interval(interval_time)
|
142
147
|
@suppress_emit_error_log_interval = interval_time
|
143
148
|
@next_emit_error_log_time = Time.now.to_i
|
data/lib/fluent/version.rb
CHANGED
data/test/plugin/test_in_http.rb
CHANGED
@@ -205,6 +205,22 @@ class HttpInputTest < Test::Unit::TestCase
|
|
205
205
|
end
|
206
206
|
end
|
207
207
|
|
208
|
+
def test_application_msgpack
|
209
|
+
d = create_driver
|
210
|
+
|
211
|
+
time = Time.parse("2011-01-02 13:14:15 UTC").to_i
|
212
|
+
|
213
|
+
d.expect_emit "tag1", time, {"a"=>1}
|
214
|
+
d.expect_emit "tag2", time, {"a"=>2}
|
215
|
+
|
216
|
+
d.run do
|
217
|
+
d.expected_emits.each {|tag,time,record|
|
218
|
+
res = post("/#{tag}?time=#{time.to_s}", record.to_msgpack, {"content-type"=>"application/msgpack; charset=utf-8"})
|
219
|
+
assert_equal "200", res.code
|
220
|
+
}
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
208
224
|
def test_msgpack
|
209
225
|
d = create_driver
|
210
226
|
|
@@ -155,15 +155,18 @@ class SyslogInputTest < Test::Unit::TestCase
|
|
155
155
|
compare_test_result(d.emits, tests)
|
156
156
|
end
|
157
157
|
|
158
|
-
|
159
|
-
|
158
|
+
LOCALHOST_HOSTNAME_GETTER = ->(){sock = UDPSocket.new(::Socket::AF_INET); sock.do_not_reverse_lookup = false; sock.connect("127.0.0.1", 2048); sock.peeraddr[2] }
|
159
|
+
LOCALHOST_HOSTNAME = LOCALHOST_HOSTNAME_GETTER.call
|
160
|
+
|
161
|
+
data('old parameter' => 'include_source_host',
|
162
|
+
'new parameter' => 'source_hostname_key source_host')
|
163
|
+
def test_msg_size_with_include_source_host(param)
|
164
|
+
d = create_driver([CONFIG, param].join("\n"))
|
160
165
|
tests = create_test_case
|
161
166
|
|
162
|
-
host = nil
|
163
167
|
d.run do
|
164
168
|
u = UDPSocket.new
|
165
169
|
u.connect('127.0.0.1', PORT)
|
166
|
-
host = u.peeraddr[2]
|
167
170
|
tests.each {|test|
|
168
171
|
u.send(test['msg'], 0)
|
169
172
|
}
|
@@ -171,7 +174,7 @@ class SyslogInputTest < Test::Unit::TestCase
|
|
171
174
|
end
|
172
175
|
|
173
176
|
assert_equal 2, d.emits.size
|
174
|
-
compare_test_result(d.emits, tests, {host:
|
177
|
+
compare_test_result(d.emits, tests, {host: LOCALHOST_HOSTNAME})
|
175
178
|
end
|
176
179
|
|
177
180
|
def test_msg_size_with_include_priority
|
@@ -235,4 +238,49 @@ class SyslogInputTest < Test::Unit::TestCase
|
|
235
238
|
assert_equal(options[:facility], events[i][2]['facility']) if options[:facility]
|
236
239
|
}
|
237
240
|
end
|
241
|
+
|
242
|
+
class SyslogMessageFormatTest < self
|
243
|
+
def test_syslog_rfc5424_format
|
244
|
+
d = create_driver(CONFIG + 'message_format rfc5424')
|
245
|
+
tests = [
|
246
|
+
'<16>1 2017-02-06T13:14:15.003Z 192.168.0.1 fluentd - - - Hi, from Fluentd!',
|
247
|
+
'<16>1 2017-02-06T13:14:15.003Z 192.168.0.1 fluentd 11111 ID24224 [exampleSDID@20224 iut="3" eventSource="Application" eventID="11211"] Hi, from Fluentd!'
|
248
|
+
]
|
249
|
+
|
250
|
+
run_tests(d, tests)
|
251
|
+
compare_test_result(d)
|
252
|
+
end
|
253
|
+
|
254
|
+
def test_syslog_auto_format
|
255
|
+
d = create_driver(CONFIG + 'message_format auto')
|
256
|
+
tests = [
|
257
|
+
'<16>1 2017-02-06T13:14:15.003Z 192.168.0.1 fluentd - - - Hi, from Fluentd!',
|
258
|
+
'<6>Sep 11 00:00:00 localhost fluentd: Hi, from Fluentd!'
|
259
|
+
]
|
260
|
+
|
261
|
+
run_tests(d, tests)
|
262
|
+
compare_test_result(d)
|
263
|
+
end
|
264
|
+
|
265
|
+
def run_tests(d, tests)
|
266
|
+
d.run do
|
267
|
+
u = Fluent::SocketUtil.create_udp_socket('127.0.0.1')
|
268
|
+
u.connect('127.0.0.1', PORT)
|
269
|
+
tests.each {|test|
|
270
|
+
u.send(test, 0)
|
271
|
+
}
|
272
|
+
sleep 1
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
276
|
+
def compare_test_result(d)
|
277
|
+
emits = d.emits
|
278
|
+
assert_equal 2, emits.size
|
279
|
+
emits.each_index {|i|
|
280
|
+
record = emits[i][2]
|
281
|
+
assert_equal('fluentd', record['ident'])
|
282
|
+
assert_equal('Hi, from Fluentd!', record['message'])
|
283
|
+
}
|
284
|
+
end
|
285
|
+
end
|
238
286
|
end
|
data/test/plugin/test_in_udp.rb
CHANGED
@@ -32,10 +32,19 @@ class UdpInputTest < Test::Unit::TestCase
|
|
32
32
|
d = create_driver(v)
|
33
33
|
assert_equal PORT, d.instance.port
|
34
34
|
assert_equal k, d.instance.bind
|
35
|
-
assert_equal 4096, d.instance.
|
35
|
+
assert_equal 4096, d.instance.message_length_limit
|
36
36
|
}
|
37
37
|
end
|
38
38
|
|
39
|
+
data(
|
40
|
+
'message_length_limit' => 'message_length_limit 2048',
|
41
|
+
'body_size_limit' => 'body_size_limit 2048'
|
42
|
+
)
|
43
|
+
test 'message_length_limit/body_size_limit compatibility' do |param|
|
44
|
+
d = create_driver(CONFIG + param)
|
45
|
+
assert_equal 2048, d.instance.message_length_limit
|
46
|
+
end
|
47
|
+
|
39
48
|
def test_time_format
|
40
49
|
configs = {'127.0.0.1' => CONFIG}
|
41
50
|
configs.merge!('::1' => IPv6_CONFIG) if ipv6_enabled?
|
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: 0.12.
|
4
|
+
version: 0.12.34
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sadayuki Furuhashi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|