diff --git a/app/controllers/fluentd/settings/in_forward_controller.rb b/app/controllers/fluentd/settings/in_forward_controller.rb new file mode 100644 index 0000000..742b86d --- /dev/null +++ b/app/controllers/fluentd/settings/in_forward_controller.rb @@ -0,0 +1,9 @@ +class Fluentd::Settings::InForwardController < ApplicationController + include SettingConcern + + private + + def target_class + Fluentd::Setting::InForward + end +end diff --git a/app/controllers/fluentd/settings/in_http_controller.rb b/app/controllers/fluentd/settings/in_http_controller.rb new file mode 100644 index 0000000..a80a564 --- /dev/null +++ b/app/controllers/fluentd/settings/in_http_controller.rb @@ -0,0 +1,9 @@ +class Fluentd::Settings::InHttpController < ApplicationController + include SettingConcern + + private + + def target_class + Fluentd::Setting::InHttp + end +end diff --git a/app/controllers/fluentd/settings/in_monitor_agent_controller.rb b/app/controllers/fluentd/settings/in_monitor_agent_controller.rb new file mode 100644 index 0000000..19f7e96 --- /dev/null +++ b/app/controllers/fluentd/settings/in_monitor_agent_controller.rb @@ -0,0 +1,9 @@ +class Fluentd::Settings::InMonitorAgentController < ApplicationController + include SettingConcern + + private + + def target_class + Fluentd::Setting::InMonitorAgent + end +end diff --git a/app/controllers/fluentd/settings/out_stdout_controller.rb b/app/controllers/fluentd/settings/out_stdout_controller.rb new file mode 100644 index 0000000..b43f71d --- /dev/null +++ b/app/controllers/fluentd/settings/out_stdout_controller.rb @@ -0,0 +1,9 @@ +class Fluentd::Settings::OutStdoutController < ApplicationController + include SettingConcern + + private + + def target_class + Fluentd::Setting::OutStdout + end +end diff --git a/app/models/fluentd/setting/in_forward.rb b/app/models/fluentd/setting/in_forward.rb new file mode 100644 index 0000000..70627ad --- /dev/null +++ b/app/models/fluentd/setting/in_forward.rb @@ -0,0 +1,44 @@ +class Fluentd + module Setting + class InForward + include ActiveModel::Model + include Common + + KEYS = [ + :bind, :port, :linger_timeout, :chunk_size_limit, :chunk_size_warn_limit, :log_level + ].freeze + + attr_accessor(*KEYS) + + validates :bind, presence: true + validates :port, presence: true + + def self.initial_params + { + bind: "0.0.0.0", + port: 24224, + linger_timeout: 0, + chunk_size_limit: nil, + chunk_size_warn_limit: nil, + log_level: "info", + } + end + + def common_options + [ + :bind, :port + ] + end + + def advanced_options + [ + :linger_timeout, :chunk_size_limit, :chunk_size_warn_limit, :log_level + ] + end + + def plugin_name + "forward" + end + end + end +end diff --git a/app/models/fluentd/setting/in_http.rb b/app/models/fluentd/setting/in_http.rb new file mode 100644 index 0000000..788a37d --- /dev/null +++ b/app/models/fluentd/setting/in_http.rb @@ -0,0 +1,45 @@ +class Fluentd + module Setting + class InHttp + include ActiveModel::Model + include Common + + KEYS = [ + :bind, :port, :body_size_limit, :keepalive_timeout, :add_http_headers, :format, :log_level + ].freeze + + attr_accessor(*KEYS) + + validates :bind, presence: true + validates :port, presence: true + + def self.initial_params + { + bind: "0.0.0.0", + port: 8888, + body_size_limit: "32m", + keepalive_timeout: "10s", + add_http_headers: false, + format: "default", + log_level: "info", + } + end + + def common_options + [ + :bind, :port + ] + end + + def advanced_options + [ + :body_size_limit, :keepalive_timeout, :add_http_headers, :format, :log_level + ] + end + + def plugin_name + "http" + end + end + end +end diff --git a/app/models/fluentd/setting/in_monitor_agent.rb b/app/models/fluentd/setting/in_monitor_agent.rb new file mode 100644 index 0000000..672b604 --- /dev/null +++ b/app/models/fluentd/setting/in_monitor_agent.rb @@ -0,0 +1,38 @@ +class Fluentd + module Setting + class InMonitorAgent + include ActiveModel::Model + include Common + + KEYS = [ + :bind, :port + ].freeze + + attr_accessor(*KEYS) + + validates :bind, presence: true + validates :port, presence: true + + def self.initial_params + { + bind: "0.0.0.0", + port: 24220, + } + end + + def common_options + [ + :bind, :port + ] + end + + def advanced_options + [] + end + + def plugin_name + "monitor_agent" + end + end + end +end diff --git a/app/models/fluentd/setting/out_stdout.rb b/app/models/fluentd/setting/out_stdout.rb new file mode 100644 index 0000000..51ba319 --- /dev/null +++ b/app/models/fluentd/setting/out_stdout.rb @@ -0,0 +1,37 @@ +class Fluentd + module Setting + class OutStdout + include Common + + KEYS = [:match, :output_type].freeze + + attr_accessor(*KEYS) + + choice :output_type, %w(json hash) + + validates :match, presence: true + validates :output_type, inclusion: { in: %w(json hash) } + + def self.initial_params + { + match: "debug.**", + output_type: "json", + } + end + + def common_options + [ + :match, :output_type + ] + end + + def advanced_options + [] + end + + def plugin_name + "stdout" + end + end + end +end diff --git a/app/views/fluentd/settings/source_and_output.html.haml b/app/views/fluentd/settings/source_and_output.html.haml index 28dba99..646a38f 100644 --- a/app/views/fluentd/settings/source_and_output.html.haml +++ b/app/views/fluentd/settings/source_and_output.html.haml @@ -6,14 +6,11 @@ .panel-heading %h4= t('.in') .panel-body - %p - = link_to(daemon_setting_in_tail_path(@fluentd)) do - = icon('fa-file-text-o fa-lg') - = t("fluentd.common.setup_in_tail") - %p - = link_to(daemon_setting_in_syslog_path(@fluentd)) do - = icon('fa-file-text-o fa-lg') - = t("fluentd.common.setup_in_syslog") + - %w|in_tail in_syslog in_monitor_agent in_http in_forward|.each do |type| + %p + = link_to(send("daemon_setting_#{type}_path", @fluentd)) do + = icon('fa-file-text-o fa-lg') + = t("fluentd.common.setup_#{type}") .col-xs-1.arrow-right = icon "fa-arrow-circle-right" .col-xs-2 @@ -25,6 +22,10 @@ .panel-heading %h4= t('.out') .panel-body + %p + = link_to(daemon_setting_out_stdout_path(@fluentd)) do + = icon('fa-file-text-o fa-lg') + = t("fluentd.common.setup_out_stdout") %p = link_to(daemon_setting_out_td_path(@fluentd)) do = icon('fa-file-text-o fa-lg') diff --git a/config/locales/translation_en.yml b/config/locales/translation_en.yml index 6ca673f..288ca63 100644 --- a/config/locales/translation_en.yml +++ b/config/locales/translation_en.yml @@ -97,8 +97,12 @@ en: page_title: "%{label}" setup_in_tail: File setup_in_syslog: Syslog Protocol + setup_in_monitor_agent: Monitoring Agent + setup_in_http: http + setup_in_forward: forward (receiving events from another fluentd) setup_out_td: Treasure Data setup_out_mongo: MongoDB + setup_out_stdout: stdout (log) setup_out_forward: Forwarding setup_out_s3: Amazon S3 setup_out_elasticsearch: Elasticsearch @@ -109,7 +113,7 @@ en: destroy_fluentd_setting: "Delete %{brand} setting" destroy_fluentd_setting_warning: | Delete %{brand} setting. - +
Running %{brand} will be stopped, but log and config file are still exists.
show: page_title: Dashboard @@ -161,11 +165,35 @@ en: For each config parameter, please refer to the MongoDB output plugin documentation page. show: page_title: Add Output to MongoDB + out_stdout: + option_guide: | + Print events to STDOUT (or fluentd log file if launched with daemon mode). Please refer to the stdout output plugin documentation page. + show: + page_title: stdout (log) in_syslog: option_guide: | For each config parameter, please refer to the MongoDB output plugin documentation page. show: page_title: Add Input from Syslog Protocol + in_monitor_agent: + option_guide: | + Monitoring agent returns current fluentd/td-agent setting as JSON via HTTP.起動中の%{brand}は停止し、ログや設定ファイルはそのまま残存します。
show: page_title: "ダッシュボード" @@ -162,11 +166,39 @@ ja: out_mongoプラグインの解説もご参照ください。 show: page_title: MongoDB書き出し設定 + out_stdout: + option_guide: | + 標準出力(デーモンとして起動しているときはログファイル)へイベントを書き出します。