Sha256: 21b402212b98300e8c66a6600f998b4742c40cb32df3ae935d13374ad3d39150

Contents?: true

Size: 878 Bytes

Versions: 3

Compression:

Stored size: 878 Bytes

Contents

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fluentd-ui-0.1.2 app/controllers/fluentd/settings/out_td_controller.rb
fluentd-ui-0.1.1 app/controllers/fluentd/settings/out_td_controller.rb
fluentd-ui-0.1.0 app/controllers/fluentd/settings/out_td_controller.rb