Class: FluentdController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- FluentdController
- Defined in:
- app/controllers/fluentd_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #errors ⇒ Object
- #log ⇒ Object
- #new ⇒ Object
- #raw_log ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
13 14 15 16 17 18 19 |
# File 'app/controllers/fluentd_controller.rb', line 13 def create @fluentd = Fluentd.new(fluentd_params) unless @fluentd.save return render :new end redirect_to daemon_path end |
#destroy ⇒ Object
33 34 35 36 37 |
# File 'app/controllers/fluentd_controller.rb', line 33 def destroy @fluentd.agent.stop if @fluentd.agent.running? @fluentd.destroy redirect_to root_path, flash: {success: t('messages.destroy_succeed_fluentd_setting', brand: fluentd_ui_brand)} end |
#edit ⇒ Object
21 22 |
# File 'app/controllers/fluentd_controller.rb', line 21 def edit end |
#errors ⇒ Object
42 43 44 45 |
# File 'app/controllers/fluentd_controller.rb', line 42 def errors @error_duration_days = 5 @errors = @fluentd.agent.log.errors_since(@error_duration_days.days.ago) end |
#log ⇒ Object
39 40 |
# File 'app/controllers/fluentd_controller.rb', line 39 def log end |
#new ⇒ Object
8 9 10 11 |
# File 'app/controllers/fluentd_controller.rb', line 8 def new @fluentd = Fluentd.new(variant: params[:variant] || "fluentd") @fluentd.load_settings_from_agent_default end |
#raw_log ⇒ Object
47 48 49 |
# File 'app/controllers/fluentd_controller.rb', line 47 def raw_log send_data @fluentd.agent.log.read, type: "application/octet-stream", filename: File.basename(@fluentd.log_file) end |
#show ⇒ Object
5 6 |
# File 'app/controllers/fluentd_controller.rb', line 5 def show end |
#update ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'app/controllers/fluentd_controller.rb', line 24 def update # TODO: should restart if changed file path? or just do "dirty" flagged? @fluentd.update_attributes(fluentd_params) unless @fluentd.save return render :edit end redirect_to daemon_path end |