mirror of
https://github.com/fluent/fluentd-ui.git
synced 2025-08-11 00:37:06 +02:00
$ git grep --name-only -E "[a-z0-9A-Z_]*fluentd_[a-zA-Z0-9_]*path" app/ | xargs gsed -i -E 's#([a-z0-9A-Z_]*)fluentd([a-zA-Z0-9_]*path)#\1daemon\2#g'
30 lines
862 B
Ruby
30 lines
862 B
Ruby
class Fluentd::AgentsController < ApplicationController
|
|
before_action :find_fluentd
|
|
|
|
def start
|
|
unless @fluentd.agent.start
|
|
flash[:error] = t("error.fluentd_start_failed") + @fluentd.agent.log_tail(1).first
|
|
end
|
|
redirect_to daemon_path(@fluentd), status: 303 # 303 is change HTTP Verb GET
|
|
end
|
|
|
|
def stop
|
|
unless @fluentd.agent.stop
|
|
flash[:error] = t("error.fluentd_stop_failed")
|
|
end
|
|
redirect_to daemon_path(@fluentd), status: 303 # 303 is change HTTP Verb GET
|
|
end
|
|
|
|
def restart
|
|
unless @fluentd.agent.restart
|
|
flash[:error] = t("error.fluentd_restart_failed") + @fluentd.agent.log_tail(1).first
|
|
end
|
|
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
|
|
end
|