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/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/views/fluentd/settings/source_and_output.html.haml b/app/views/fluentd/settings/source_and_output.html.haml index 09fa2fb..abf67f0 100644 --- a/app/views/fluentd/settings/source_and_output.html.haml +++ b/app/views/fluentd/settings/source_and_output.html.haml @@ -18,6 +18,10 @@ = link_to(daemon_setting_in_monitor_agent_path(@fluentd)) do = icon('fa-file-text-o fa-lg') = t("fluentd.common.setup_in_monitor_agent") + %p + = link_to(daemon_setting_in_http_path(@fluentd)) do + = icon('fa-file-text-o fa-lg') + = t("fluentd.common.setup_in_http") .col-xs-1.arrow-right = icon "fa-arrow-circle-right" .col-xs-2 diff --git a/config/locales/translation_en.yml b/config/locales/translation_en.yml index 283ede8..b2e6c5b 100644 --- a/config/locales/translation_en.yml +++ b/config/locales/translation_en.yml @@ -98,6 +98,7 @@ en: setup_in_tail: File setup_in_syslog: Syslog Protocol setup_in_monitor_agent: Monitoring Agent + setup_in_http: http setup_out_td: Treasure Data setup_out_mongo: MongoDB setup_out_stdout: stdout (log) @@ -111,7 +112,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 @@ -179,6 +180,13 @@ en: Please see refer to the Monitoring Agent documentation page. show: page_title: Monitoring Agent (monitor_agent) + in_http: + option_guide: | + Retrieve records from http POST.
+ The URL path becomes the tag of the Fluentd event log and the POSTed body element becomes the record itself.
+ Please see refer to the http Input Plugin documentation page. + show: + page_title: Add http Input Plugin in_tail_option_guide: | For each config parameter, please refer to the Tail input plugin documentation page. in_tail: diff --git a/config/locales/translation_ja.yml b/config/locales/translation_ja.yml index 1a9fb1d..58c41b1 100644 --- a/config/locales/translation_ja.yml +++ b/config/locales/translation_ja.yml @@ -97,6 +97,7 @@ ja: setup_in_tail: ファイル setup_in_syslog: syslogプロトコル setup_in_monitor_agent: 監視エージェント + setup_in_http: http setup_out_td: Treasure Data setup_out_stdout: 標準出力(ログ) setup_out_mongo: MongoDB @@ -110,7 +111,7 @@ ja: destroy_fluentd_setting: "%{brand}の設定情報を削除" destroy_fluentd_setting_warning: | %{brand}の設定を削除します。 - +

起動中の%{brand}は停止し、ログや設定ファイルはそのまま残存します。

show: page_title: "ダッシュボード" @@ -181,6 +182,13 @@ ja: 監視エージェントのページもご参照ください。 show: page_title: 監視エージェント設定(monitor_agent) + in_http: + option_guide: | + http POSTからレコードを取得可能にします。
+ URLパスはFluentdイベントログのタグとなり、ポストされたbody要素はレコードそのものになります。
+ httpインプットプラグイン解説ページもご参照ください。 + show: + page_title: http入力設定 in_tail_option_guide: | in_tailプラグインの解説ページFluentularもご参照ください。 diff --git a/config/routes.rb b/config/routes.rb index 1afcd06..2eb6f93 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -32,6 +32,10 @@ Rails.application.routes.draw do post "finish" end + resource :in_http, only: [:show], module: :settings, controller: :in_http do + post "finish" + end + resource :out_stdout, only: [:show], module: :settings, controller: :out_stdout do post "finish" end