Class: Fluent::SystemConfig
- Inherits:
-
Object
- Object
- Fluent::SystemConfig
show all
- Includes:
- Configurable
- Defined in:
- lib/fluent/system_config.rb
Defined Under Namespace
Modules: Mixin
Constant Summary
collapse
- SYSTEM_CONFIG_PARAMETERS =
[
:workers, :restart_worker_interval, :root_dir, :log_level,
:suppress_repeated_stacktrace, :emit_error_log_interval, :suppress_config_dump,
:log_event_verbose, :ignore_repeated_log_interval, :ignore_same_log_interval,
:without_source, :rpc_endpoint, :enable_get_dump, :process_name,
:file_permission, :dir_permission, :counter_server, :counter_client,
:strict_config_value, :enable_msgpack_time_support, :disable_shared_socket,
:metrics, :enable_input_metrics, :enable_size_metrics, :enable_jit
]
Configurable::CONFIG_TYPE_REGISTRY
Class Method Summary
collapse
Instance Method Summary
collapse
#config, #configure_proxy_generate, #configured_section_create, included, lookup_type, register_type
Constructor Details
#initialize(conf = nil, strict_config_value = false) ⇒ SystemConfig
Returns a new instance of SystemConfig.
129
130
131
132
133
|
# File 'lib/fluent/system_config.rb', line 129
def initialize(conf=nil, strict_config_value=false)
super()
conf ||= SystemConfig.blank_system_config
configure(conf, strict_config_value)
end
|
Class Method Details
.blank_system_config ⇒ Object
115
116
117
|
# File 'lib/fluent/system_config.rb', line 115
def self.blank_system_config
Fluent::Config::Element.new('<SYSTEM>', '', {}, [])
end
|
.create(conf, strict_config_value = false) ⇒ Object
107
108
109
110
111
112
113
|
# File 'lib/fluent/system_config.rb', line 107
def self.create(conf, strict_config_value=false)
systems = conf.elements(name: 'system')
return SystemConfig.new if systems.empty?
raise Fluent::ConfigError, "<system> is duplicated. <system> should be only one" if systems.size > 1
SystemConfig.new(systems.first, strict_config_value)
end
|
.overwrite_system_config(hash) ⇒ Object
119
120
121
122
123
124
125
126
127
|
# File 'lib/fluent/system_config.rb', line 119
def self.overwrite_system_config(hash)
older = defined?($_system_config) ? $_system_config : nil
begin
$_system_config = SystemConfig.new(Fluent::Config::Element.new('system', '', hash, []))
yield
ensure
$_system_config = older
end
end
|
Instance Method Details
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
# File 'lib/fluent/system_config.rb', line 135
def configure(conf, strict_config_value=false)
strict = strict_config_value
if !strict && conf && conf.has_key?("strict_config_value")
strict = Fluent::Config.bool_value(conf["strict_config_value"])
end
begin
super(conf, strict)
rescue ConfigError => e
$log.error "config error in:\n#{conf}"
$log.error 'config error', error: e
$log.debug_backtrace
exit!(1)
end
@log_level = Log.str_to_level(@log_level.to_s) if @log_level
end
|
#dup ⇒ Object
153
154
155
156
157
158
159
|
# File 'lib/fluent/system_config.rb', line 153
def dup
s = SystemConfig.new
SYSTEM_CONFIG_PARAMETERS.each do |param|
s.__send__("#{param}=", instance_variable_get("@#{param}"))
end
s
end
|
#overwrite_variables(**opt) ⇒ Object
161
162
163
164
165
166
167
|
# File 'lib/fluent/system_config.rb', line 161
def overwrite_variables(**opt)
SYSTEM_CONFIG_PARAMETERS.each do |param|
if opt.key?(param) && !opt[param].nil? && instance_variable_defined?("@#{param}")
instance_variable_set("@#{param}", opt[param])
end
end
end
|