fluentd 0.10.62 → 0.12.0.pre.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/.gitignore +1 -2
- data/.travis.yml +0 -4
- data/ChangeLog +0 -72
- data/Gemfile +0 -6
- data/Rakefile +12 -3
- data/example/in_http.conf +14 -0
- data/example/in_syslog.conf +15 -0
- data/example/in_tail.conf +14 -0
- data/example/in_tcp.conf +13 -0
- data/example/in_udp.conf +13 -0
- data/example/out_copy.conf +20 -0
- data/example/out_file.conf +13 -0
- data/example/out_forward.conf +30 -0
- data/fluent.conf +2 -12
- data/fluentd.gemspec +8 -11
- data/lib/fluent/agent.rb +180 -0
- data/lib/fluent/buffer.rb +6 -12
- data/lib/fluent/command/cat.rb +1 -3
- data/lib/fluent/command/debug.rb +1 -3
- data/lib/fluent/command/fluentd.rb +0 -10
- data/lib/fluent/config.rb +9 -3
- data/lib/fluent/config/basic_parser.rb +1 -6
- data/lib/fluent/config/configure_proxy.rb +25 -61
- data/lib/fluent/config/dsl.rb +16 -0
- data/lib/fluent/config/element.rb +21 -2
- data/lib/fluent/config/error.rb +16 -0
- data/lib/fluent/config/literal_parser.rb +9 -27
- data/lib/fluent/config/parser.rb +16 -0
- data/lib/fluent/config/section.rb +16 -2
- data/lib/fluent/config/types.rb +16 -1
- data/lib/fluent/config/v1_parser.rb +4 -12
- data/lib/fluent/configurable.rb +16 -0
- data/lib/fluent/engine.rb +43 -163
- data/lib/fluent/env.rb +16 -1
- data/lib/fluent/event.rb +20 -48
- data/lib/fluent/event_router.rb +187 -0
- data/lib/fluent/filter.rb +32 -0
- data/lib/fluent/formatter.rb +29 -101
- data/lib/fluent/input.rb +6 -4
- data/lib/fluent/label.rb +18 -0
- data/lib/fluent/load.rb +1 -3
- data/lib/fluent/log.rb +1 -3
- data/lib/fluent/match.rb +12 -19
- data/lib/fluent/mixin.rb +9 -25
- data/lib/fluent/output.rb +27 -45
- data/lib/fluent/parser.rb +93 -99
- data/lib/fluent/plugin.rb +22 -48
- data/lib/fluent/plugin/buf_file.rb +10 -7
- data/lib/fluent/plugin/buf_memory.rb +2 -3
- data/lib/fluent/plugin/buf_zfile.rb +75 -0
- data/lib/fluent/plugin/exec_util.rb +16 -0
- data/lib/fluent/plugin/in_debug_agent.rb +2 -3
- data/lib/fluent/plugin/in_exec.rb +2 -9
- data/lib/fluent/plugin/in_forward.rb +4 -22
- data/lib/fluent/plugin/in_gc_stat.rb +2 -3
- data/lib/fluent/plugin/in_http.rb +19 -59
- data/lib/fluent/plugin/in_monitor_agent.rb +21 -47
- data/lib/fluent/plugin/in_object_space.rb +2 -3
- data/lib/fluent/plugin/in_status.rb +2 -3
- data/lib/fluent/plugin/in_stream.rb +6 -16
- data/lib/fluent/plugin/in_syslog.rb +8 -17
- data/lib/fluent/plugin/in_tail.rb +17 -24
- data/lib/fluent/plugin/in_tcp.rb +16 -0
- data/lib/fluent/plugin/in_udp.rb +16 -0
- data/lib/fluent/plugin/out_copy.rb +3 -4
- data/lib/fluent/plugin/out_exec.rb +2 -4
- data/lib/fluent/plugin/out_exec_filter.rb +2 -13
- data/lib/fluent/plugin/out_file.rb +5 -6
- data/lib/fluent/plugin/out_forward.rb +4 -5
- data/lib/fluent/plugin/out_null.rb +2 -3
- data/lib/fluent/plugin/out_relabel.rb +26 -0
- data/lib/fluent/plugin/out_roundrobin.rb +3 -4
- data/lib/fluent/plugin/out_stdout.rb +2 -3
- data/lib/fluent/plugin/out_stream.rb +2 -3
- data/{test/scripts → lib}/fluent/plugin/out_test.rb +2 -3
- data/lib/fluent/plugin/socket_util.rb +19 -10
- data/lib/fluent/process.rb +4 -6
- data/lib/fluent/registry.rb +16 -0
- data/lib/fluent/root_agent.rb +212 -0
- data/lib/fluent/status.rb +2 -3
- data/lib/fluent/supervisor.rb +33 -54
- data/lib/fluent/test.rb +16 -0
- data/lib/fluent/test/base.rb +3 -17
- data/lib/fluent/test/input_test.rb +52 -7
- data/lib/fluent/test/output_test.rb +4 -20
- data/lib/fluent/version.rb +17 -1
- data/spec/config/config_parser_spec.rb +314 -0
- data/spec/config/configurable_spec.rb +524 -0
- data/spec/config/configure_proxy_spec.rb +96 -0
- data/spec/config/dsl_spec.rb +239 -0
- data/spec/config/helper.rb +49 -0
- data/spec/config/literal_parser_spec.rb +222 -0
- data/spec/config/section_spec.rb +97 -0
- data/spec/config/system_config_spec.rb +49 -0
- data/test/helper.rb +0 -25
- data/test/plugin/test_in_exec.rb +1 -1
- data/test/plugin/test_in_forward.rb +2 -1
- data/test/plugin/test_in_gc_stat.rb +1 -1
- data/test/plugin/test_in_http.rb +3 -78
- data/test/plugin/test_in_object_space.rb +1 -1
- data/test/plugin/test_in_status.rb +1 -1
- data/test/plugin/test_in_stream.rb +2 -1
- data/test/plugin/test_in_syslog.rb +2 -1
- data/test/plugin/test_in_tail.rb +6 -11
- data/test/plugin/test_in_tcp.rb +2 -1
- data/test/plugin/test_in_udp.rb +2 -1
- data/test/plugin/test_out_copy.rb +1 -12
- data/test/plugin/test_out_exec.rb +1 -1
- data/test/plugin/test_out_exec_filter.rb +1 -1
- data/test/plugin/test_out_file.rb +7 -96
- data/test/plugin/test_out_forward.rb +2 -1
- data/test/plugin/test_out_roundrobin.rb +1 -12
- data/test/plugin/test_out_stdout.rb +1 -1
- data/test/plugin/test_out_stream.rb +2 -1
- data/test/scripts/fluent/plugin/formatter_known.rb +1 -4
- data/test/scripts/fluent/plugin/parser_known.rb +1 -2
- data/test/test_config.rb +1 -1
- data/test/test_configdsl.rb +2 -1
- data/test/test_formatter.rb +3 -395
- data/test/test_match.rb +2 -1
- data/test/test_mixin.rb +3 -75
- data/test/test_output.rb +1 -112
- data/test/test_parser.rb +85 -152
- metadata +58 -167
- data/example/v1_literal_example.conf +0 -36
- data/lib/fluent/plugin/in_dummy.rb +0 -103
- data/lib/fluent/timezone.rb +0 -131
- data/test/config/assertions.rb +0 -42
- data/test/config/test_config_parser.rb +0 -389
- data/test/config/test_configurable.rb +0 -652
- data/test/config/test_configure_proxy.rb +0 -99
- data/test/config/test_dsl.rb +0 -237
- data/test/config/test_literal_parser.rb +0 -295
- data/test/config/test_section.rb +0 -112
- data/test/config/test_system_config.rb +0 -99
- data/test/config/test_types.rb +0 -63
- data/test/plugin/test_in_dummy.rb +0 -95
- data/test/test_event.rb +0 -168
- data/test/test_input.rb +0 -21
data/lib/fluent/config/parser.rb
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# Fluentd
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
1
17
|
module Fluent
|
2
18
|
module Config
|
3
19
|
require 'fluent/config/error'
|
@@ -1,3 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# Fluentd
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
1
17
|
require 'json'
|
2
18
|
|
3
19
|
module Fluent
|
@@ -14,8 +30,6 @@ module Fluent
|
|
14
30
|
@params = params
|
15
31
|
end
|
16
32
|
|
17
|
-
alias :object_id :__id__
|
18
|
-
|
19
33
|
def inspect
|
20
34
|
"<Fluent::Config::Section #{@params.to_json}>"
|
21
35
|
end
|
data/lib/fluent/config/types.rb
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# Fluentd
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
1
17
|
module Fluent
|
2
18
|
require 'json'
|
3
19
|
|
@@ -33,7 +49,6 @@ module Fluent
|
|
33
49
|
end
|
34
50
|
|
35
51
|
def self.bool_value(str)
|
36
|
-
return nil if str.nil?
|
37
52
|
case str.to_s
|
38
53
|
when 'true', 'yes'
|
39
54
|
true
|
@@ -50,9 +50,6 @@ module Fluent
|
|
50
50
|
return root
|
51
51
|
end
|
52
52
|
|
53
|
-
ELEM_SYMBOLS = ['match', 'source', 'filter', 'system']
|
54
|
-
RESERVED_PARAMS = %W(@type @id)
|
55
|
-
|
56
53
|
def parse_element(root_element, elem_name, attrs = {}, elems = [])
|
57
54
|
while true
|
58
55
|
spacing
|
@@ -80,7 +77,7 @@ module Fluent
|
|
80
77
|
elsif skip(/\</)
|
81
78
|
e_name = scan(ELEMENT_NAME)
|
82
79
|
spacing
|
83
|
-
e_arg = scan_nonquoted_string(/(?:#{
|
80
|
+
e_arg = scan_nonquoted_string(/(?:#{SPACING}|\>)/)
|
84
81
|
spacing
|
85
82
|
unless skip(/\>/)
|
86
83
|
parse_error! "expected '>'"
|
@@ -103,13 +100,13 @@ module Fluent
|
|
103
100
|
|
104
101
|
else
|
105
102
|
k = scan_string(SPACING)
|
106
|
-
|
103
|
+
spacing
|
107
104
|
if prev_match.include?("\n") # support 'tag_mapped' like "without value" configuration
|
108
105
|
attrs[k] = ""
|
109
106
|
else
|
110
107
|
if k == '@include'
|
111
108
|
parse_include(attrs, elems)
|
112
|
-
elsif
|
109
|
+
elsif k == '@label'
|
113
110
|
v = parse_literal
|
114
111
|
unless line_end
|
115
112
|
parse_error! "expected end of line"
|
@@ -117,12 +114,7 @@ module Fluent
|
|
117
114
|
attrs[k] = v
|
118
115
|
else
|
119
116
|
if k.start_with?('@')
|
120
|
-
|
121
|
-
parse_error! "'@' is the system reserved prefix. Don't use '@' prefix parameter in the configuration: #{k}"
|
122
|
-
else
|
123
|
-
# TODO: This is for backward compatibility. It will throw an error in the future.
|
124
|
-
$log.warn "'@' is the system reserved prefix. It works in the nested configuration for now but it will be rejected: #{k}"
|
125
|
-
end
|
117
|
+
parse_error! "'@' is reserved prefix. Don't use '@' in parameter name"
|
126
118
|
end
|
127
119
|
|
128
120
|
v = parse_literal
|
data/lib/fluent/configurable.rb
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# Fluentd
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
1
17
|
module Fluent
|
2
18
|
require 'fluent/config/configure_proxy'
|
3
19
|
require 'fluent/config/section'
|
data/lib/fluent/engine.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
#
|
2
|
-
#
|
3
|
-
#
|
4
|
-
# Copyright (C) 2011 FURUHASHI Sadayuki
|
2
|
+
# Fluentd
|
5
3
|
#
|
6
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
5
|
# you may not use this file except in compliance with the License.
|
@@ -15,15 +13,15 @@
|
|
15
13
|
# See the License for the specific language governing permissions and
|
16
14
|
# limitations under the License.
|
17
15
|
#
|
16
|
+
|
18
17
|
module Fluent
|
18
|
+
require 'fluent/event_router'
|
19
|
+
require 'fluent/root_agent'
|
20
|
+
|
19
21
|
class EngineClass
|
20
22
|
def initialize
|
21
|
-
@
|
22
|
-
@
|
23
|
-
@match_cache = {}
|
24
|
-
@match_cache_keys = []
|
25
|
-
@started_sources = []
|
26
|
-
@started_matches = []
|
23
|
+
@root_agent = nil
|
24
|
+
@event_router = nil
|
27
25
|
@default_loop = nil
|
28
26
|
@engine_stopped = false
|
29
27
|
|
@@ -31,17 +29,13 @@ module Fluent
|
|
31
29
|
@log_event_loop_stop = false
|
32
30
|
@log_event_queue = []
|
33
31
|
|
34
|
-
@suppress_emit_error_log_interval = 0
|
35
|
-
@next_emit_error_log_time = nil
|
36
|
-
|
37
32
|
@suppress_config_dump = false
|
38
|
-
@without_source = false
|
39
33
|
end
|
40
34
|
|
41
35
|
MATCH_CACHE_SIZE = 1024
|
42
|
-
|
43
36
|
LOG_EMIT_INTERVAL = 0.1
|
44
37
|
|
38
|
+
attr_reader :root_agent
|
45
39
|
attr_reader :matches, :sources
|
46
40
|
|
47
41
|
def init(opts = {})
|
@@ -56,9 +50,15 @@ module Fluent
|
|
56
50
|
@suppress_config_dump = opts[:suppress_config_dump] if opts[:suppress_config_dump]
|
57
51
|
@without_source = opts[:without_source] if opts[:without_source]
|
58
52
|
|
53
|
+
@root_agent = RootAgent.new(opts)
|
54
|
+
|
59
55
|
self
|
60
56
|
end
|
61
57
|
|
58
|
+
def log
|
59
|
+
$log
|
60
|
+
end
|
61
|
+
|
62
62
|
def suppress_interval(interval_time)
|
63
63
|
@suppress_emit_error_log_interval = interval_time
|
64
64
|
@next_emit_error_log_time = Time.now.to_i
|
@@ -94,41 +94,8 @@ module Fluent
|
|
94
94
|
$log.info "using configuration file: #{conf.to_s.rstrip}"
|
95
95
|
end
|
96
96
|
|
97
|
-
|
98
|
-
|
99
|
-
else
|
100
|
-
conf.elements.select {|e|
|
101
|
-
e.name == 'source'
|
102
|
-
}.each {|e|
|
103
|
-
type = e['@type'] || e['type']
|
104
|
-
unless type
|
105
|
-
raise ConfigError, "Missing 'type' parameter on <source> directive"
|
106
|
-
end
|
107
|
-
$log.info "adding source type=#{type.dump}"
|
108
|
-
|
109
|
-
input = Plugin.new_input(type)
|
110
|
-
input.configure(e)
|
111
|
-
|
112
|
-
@sources << input
|
113
|
-
}
|
114
|
-
end
|
115
|
-
|
116
|
-
conf.elements.select {|e|
|
117
|
-
e.name == 'match'
|
118
|
-
}.each {|e|
|
119
|
-
type = e['@type'] || e['type']
|
120
|
-
pattern = e.arg
|
121
|
-
unless type
|
122
|
-
raise ConfigError, "Missing 'type' parameter on <match #{e.arg}> directive"
|
123
|
-
end
|
124
|
-
$log.info "adding match", :pattern=>pattern, :type=>type
|
125
|
-
|
126
|
-
output = Plugin.new_output(type)
|
127
|
-
output.configure(e)
|
128
|
-
|
129
|
-
match = Match.new(pattern, output)
|
130
|
-
@matches << match
|
131
|
-
}
|
97
|
+
@root_agent.configure(conf)
|
98
|
+
@event_router = @root_agent.event_router
|
132
99
|
end
|
133
100
|
|
134
101
|
def load_plugin_dir(dir)
|
@@ -146,40 +113,11 @@ module Fluent
|
|
146
113
|
end
|
147
114
|
|
148
115
|
def emit_stream(tag, es)
|
149
|
-
|
150
|
-
unless target
|
151
|
-
target = match(tag) || NoMatchMatch.new
|
152
|
-
# this is not thread-safe but inconsistency doesn't
|
153
|
-
# cause serious problems while locking causes.
|
154
|
-
if @match_cache_keys.size >= MATCH_CACHE_SIZE
|
155
|
-
@match_cache.delete @match_cache_keys.shift
|
156
|
-
end
|
157
|
-
@match_cache[tag] = target
|
158
|
-
@match_cache_keys << tag
|
159
|
-
end
|
160
|
-
target.emit(tag, es)
|
161
|
-
rescue => e
|
162
|
-
if @suppress_emit_error_log_interval == 0 || now > @next_emit_error_log_time
|
163
|
-
$log.warn "emit transaction failed ", :error_class=>e.class, :error=>e, :tag=>tag
|
164
|
-
$log.warn_backtrace
|
165
|
-
# $log.debug "current next_emit_error_log_time: #{Time.at(@next_emit_error_log_time)}"
|
166
|
-
@next_emit_error_log_time = Time.now.to_i + @suppress_emit_error_log_interval
|
167
|
-
# $log.debug "next emit failure log suppressed"
|
168
|
-
# $log.debug "next logged time is #{Time.at(@next_emit_error_log_time)}"
|
169
|
-
end
|
170
|
-
raise
|
171
|
-
end
|
172
|
-
|
173
|
-
def match(tag)
|
174
|
-
@matches.find {|m| m.match(tag) }
|
175
|
-
end
|
176
|
-
|
177
|
-
def match?(tag)
|
178
|
-
!!match(tag)
|
116
|
+
@event_router.emit_stream(tag, es)
|
179
117
|
end
|
180
118
|
|
181
119
|
def flush!
|
182
|
-
|
120
|
+
@root_agent.flush!
|
183
121
|
end
|
184
122
|
|
185
123
|
def now
|
@@ -200,7 +138,7 @@ module Fluent
|
|
200
138
|
|
201
139
|
events.each {|tag,time,record|
|
202
140
|
begin
|
203
|
-
|
141
|
+
@event_router.emit(tag, time, record)
|
204
142
|
rescue => e
|
205
143
|
$log.error "failed to emit fluentd's log event", :tag => tag, :event => record, :error_class => e.class, :error => e
|
206
144
|
end
|
@@ -212,7 +150,7 @@ module Fluent
|
|
212
150
|
begin
|
213
151
|
start
|
214
152
|
|
215
|
-
if match?($log.tag)
|
153
|
+
if @event_router.match?($log.tag)
|
216
154
|
$log.enable_event
|
217
155
|
@log_emit_thread = Thread.new(&method(:log_event_loop))
|
218
156
|
end
|
@@ -258,98 +196,40 @@ module Fluent
|
|
258
196
|
end
|
259
197
|
|
260
198
|
private
|
199
|
+
|
261
200
|
def start
|
262
|
-
@
|
263
|
-
m.start
|
264
|
-
@started_matches << m
|
265
|
-
}
|
266
|
-
@sources.each {|s|
|
267
|
-
s.start
|
268
|
-
@started_sources << s
|
269
|
-
}
|
201
|
+
@root_agent.start
|
270
202
|
end
|
271
203
|
|
272
204
|
def shutdown
|
273
|
-
|
274
|
-
@started_sources.map { |s|
|
275
|
-
Thread.new do
|
276
|
-
begin
|
277
|
-
s.shutdown
|
278
|
-
rescue => e
|
279
|
-
$log.warn "unexpected error while shutting down", :plugin => s.class, :plugin_id => s.plugin_id, :error_class => e.class, :error => e
|
280
|
-
$log.warn_backtrace
|
281
|
-
end
|
282
|
-
end
|
283
|
-
}.each { |t|
|
284
|
-
t.join
|
285
|
-
}
|
286
|
-
# Output plugin as filter emits records at shutdown so emit problem still exist.
|
287
|
-
# This problem will be resolved after actual filter mechanizm.
|
288
|
-
@started_matches.map { |m|
|
289
|
-
Thread.new do
|
290
|
-
begin
|
291
|
-
m.shutdown
|
292
|
-
rescue => e
|
293
|
-
$log.warn "unexpected error while shutting down", :plugin => m.output.class, :plugin_id => m.output.plugin_id, :error_class => e.class, :error => e
|
294
|
-
$log.warn_backtrace
|
295
|
-
end
|
296
|
-
end
|
297
|
-
}.each { |t|
|
298
|
-
t.join
|
299
|
-
}
|
205
|
+
@root_agent.shutdown
|
300
206
|
end
|
207
|
+
end
|
301
208
|
|
302
|
-
|
303
|
-
array.each {|m|
|
304
|
-
begin
|
305
|
-
if m.is_a?(Match)
|
306
|
-
m = m.output
|
307
|
-
end
|
308
|
-
if m.is_a?(BufferedOutput)
|
309
|
-
m.force_flush
|
310
|
-
elsif m.is_a?(MultiOutput)
|
311
|
-
flush_recursive(m.outputs)
|
312
|
-
end
|
313
|
-
rescue => e
|
314
|
-
$log.debug "error while force flushing", :error_class=>e.class, :error=>e
|
315
|
-
$log.debug_backtrace
|
316
|
-
end
|
317
|
-
}
|
318
|
-
end
|
209
|
+
Engine = EngineClass.new
|
319
210
|
|
320
|
-
|
321
|
-
|
322
|
-
@count = 0
|
323
|
-
end
|
211
|
+
module Test
|
212
|
+
@@test = false
|
324
213
|
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
if c < 512
|
329
|
-
if Math.log(c) / Math.log(2) % 1.0 == 0
|
330
|
-
$log.warn "no patterns matched", :tag=>tag
|
331
|
-
return
|
332
|
-
end
|
333
|
-
else
|
334
|
-
if c % 512 == 0
|
335
|
-
$log.warn "no patterns matched", :tag=>tag
|
336
|
-
return
|
337
|
-
end
|
338
|
-
end
|
339
|
-
$log.on_trace { $log.trace "no patterns matched", :tag=>tag }
|
340
|
-
end
|
214
|
+
def test?
|
215
|
+
@@test
|
216
|
+
end
|
341
217
|
|
342
|
-
|
343
|
-
|
218
|
+
def self.setup
|
219
|
+
@@test = true
|
344
220
|
|
345
|
-
|
346
|
-
|
221
|
+
Fluent.__send__(:remove_const, :Engine)
|
222
|
+
engine = Fluent.const_set(:Engine, EngineClass.new).init
|
347
223
|
|
348
|
-
|
349
|
-
|
350
|
-
|
224
|
+
engine.define_singleton_method(:now=) {|n|
|
225
|
+
@now = n.to_i
|
226
|
+
}
|
227
|
+
engine.define_singleton_method(:now) {
|
228
|
+
@now || super()
|
229
|
+
}
|
230
|
+
|
231
|
+
nil
|
351
232
|
end
|
352
233
|
end
|
353
|
-
|
354
|
-
Engine = EngineClass.new
|
355
234
|
end
|
235
|
+
|
data/lib/fluent/env.rb
CHANGED
@@ -1,8 +1,23 @@
|
|
1
|
+
#
|
2
|
+
# Fluentd
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
1
17
|
module Fluent
|
2
18
|
DEFAULT_CONFIG_PATH = ENV['FLUENT_CONF'] || '/etc/fluent/fluent.conf'
|
3
19
|
DEFAULT_PLUGIN_DIR = ENV['FLUENT_PLUGIN'] || '/etc/fluent/plugin'
|
4
20
|
DEFAULT_SOCKET_PATH = ENV['FLUENT_SOCKET'] || '/var/run/fluent/fluent.sock'
|
5
21
|
DEFAULT_LISTEN_PORT = 24224
|
6
22
|
DEFAULT_FILE_PERMISSION = 0644
|
7
|
-
DEFAULT_DIR_PERMISSION = 0755
|
8
23
|
end
|