Sha256: 0f9abc7c71668c8fd08ced0f3eccfd932c6f4d96e130cc384730cd0f1ffe70b9
Contents?: true
Size: 1004 Bytes
Versions: 3
Compression:
Stored size: 1004 Bytes
Contents
class Fluentd::AgentsController < ApplicationController before_action :find_fluentd def start run_action(__method__) { @fluentd.agent.log_tail(1).first } redirect_to daemon_path(@fluentd), status: 303 # 303 is change HTTP Verb GET end def stop run_action(__method__) redirect_to daemon_path(@fluentd), status: 303 # 303 is change HTTP Verb GET end def restart run_action(__method__) { @fluentd.agent.log_tail(1).first } redirect_to daemon_path(@fluentd), status: 303 # 303 is change HTTP Verb GET end def log_tail @logs = @fluentd.agent.log_tail(params[:limit]).reverse if @fluentd render json: @logs end private def run_action(action) if @fluentd.agent.public_send(action) flash[:success] = t("messages.fluentd_start_stop_delay_notice", action: t("fluentd.common.#{action}")) else flash[:error] = t("messages.fluentd_#{action}_failed", brand: fluentd_ui_title) flash[:error] += yield if block_given? end end end
Version data entries
3 entries across 3 versions & 1 rubygems