mirror of
https://github.com/fluent/fluentd-ui.git
synced 2025-08-12 01:07:09 +02:00
37 lines
878 B
Ruby
37 lines
878 B
Ruby
class Fluentd::Settings::OutTdController < ApplicationController
|
|
before_action :login_required
|
|
before_action :find_fluentd
|
|
|
|
def show
|
|
@setting = Fluentd::Setting::OutTd.new({
|
|
buffer_type: "file",
|
|
buffer_path: "/var/log/td-agent/buffer/td",
|
|
auto_create_table: true,
|
|
match: "td.*.*",
|
|
})
|
|
end
|
|
|
|
def finish
|
|
@setting = Fluentd::Setting::OutTd.new(setting_params)
|
|
unless @setting.valid?
|
|
return render "show"
|
|
end
|
|
|
|
@fluentd.agent.config_append @setting.to_config
|
|
if @fluentd.agent.running?
|
|
unless @fluentd.agent.restart
|
|
@setting.errors.add(:base, @fluentd.agent.log_tail(1).first)
|
|
return render "show"
|
|
end
|
|
end
|
|
redirect_to daemon_setting_path(@fluentd)
|
|
end
|
|
|
|
private
|
|
|
|
def setting_params
|
|
params.require(:fluentd_setting_out_td).permit(*Fluentd::Setting::OutTd::KEYS)
|
|
end
|
|
|
|
end
|