mirror of
https://github.com/fluent/fluentd-ui.git
synced 2026-05-05 02:46:11 +02:00
Merge pull request #109 from hassaku/default_plugin_settings
Add default input sources and output destinations options.
This commit is contained in:
commit
5b970eefed
@ -0,0 +1,9 @@
|
||||
class Fluentd::Settings::InForwardController < ApplicationController
|
||||
include SettingConcern
|
||||
|
||||
private
|
||||
|
||||
def target_class
|
||||
Fluentd::Setting::InForward
|
||||
end
|
||||
end
|
||||
9
app/controllers/fluentd/settings/in_http_controller.rb
Normal file
9
app/controllers/fluentd/settings/in_http_controller.rb
Normal file
@ -0,0 +1,9 @@
|
||||
class Fluentd::Settings::InHttpController < ApplicationController
|
||||
include SettingConcern
|
||||
|
||||
private
|
||||
|
||||
def target_class
|
||||
Fluentd::Setting::InHttp
|
||||
end
|
||||
end
|
||||
@ -0,0 +1,9 @@
|
||||
class Fluentd::Settings::InMonitorAgentController < ApplicationController
|
||||
include SettingConcern
|
||||
|
||||
private
|
||||
|
||||
def target_class
|
||||
Fluentd::Setting::InMonitorAgent
|
||||
end
|
||||
end
|
||||
@ -0,0 +1,9 @@
|
||||
class Fluentd::Settings::OutStdoutController < ApplicationController
|
||||
include SettingConcern
|
||||
|
||||
private
|
||||
|
||||
def target_class
|
||||
Fluentd::Setting::OutStdout
|
||||
end
|
||||
end
|
||||
44
app/models/fluentd/setting/in_forward.rb
Normal file
44
app/models/fluentd/setting/in_forward.rb
Normal file
@ -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
|
||||
45
app/models/fluentd/setting/in_http.rb
Normal file
45
app/models/fluentd/setting/in_http.rb
Normal file
@ -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
|
||||
38
app/models/fluentd/setting/in_monitor_agent.rb
Normal file
38
app/models/fluentd/setting/in_monitor_agent.rb
Normal file
@ -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
|
||||
37
app/models/fluentd/setting/out_stdout.rb
Normal file
37
app/models/fluentd/setting/out_stdout.rb
Normal file
@ -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
|
||||
@ -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')
|
||||
|
||||
@ -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.
|
||||
|
||||
|
||||
<p>Running %{brand} will be stopped, but log and config file are still exists.</p>
|
||||
show:
|
||||
page_title: Dashboard
|
||||
@ -161,11 +165,35 @@ en:
|
||||
For each config parameter, please refer to the <a href="http://docs.fluentd.org/articles/out_mongo" target="_blank">MongoDB output plugin</a> 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 <a href="http://docs.fluentd.org/articles/out_stdout" target="_blank">stdout output plugin</a> documentation page.
|
||||
show:
|
||||
page_title: stdout (log)
|
||||
in_syslog:
|
||||
option_guide: |
|
||||
For each config parameter, please refer to the <a href="http://docs.fluentd.org/articles/in_syslog" target="_blank">MongoDB output plugin</a> 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. <br />
|
||||
Please see refer to the <a target="_blank" href="http://docs.fluentd.org/articles/monitoring">Monitoring Agent</a> documentation page.
|
||||
show:
|
||||
page_title: Monitoring Agent (monitor_agent)
|
||||
in_http:
|
||||
option_guide: |
|
||||
Retrieve records from http POST.<br />
|
||||
The URL path becomes the tag of the Fluentd event log and the POSTed body element becomes the record itself.<br />
|
||||
Please see refer to the <a target="_blank" href="http://docs.fluentd.org/articles/in_http">http Input Plugin</a> documentation page.
|
||||
show:
|
||||
page_title: Add http Input Plugin
|
||||
in_forward:
|
||||
option_guide: |
|
||||
Listen to a TCP socket to receive the event stream and an UDP socket to receive heartbeat messages.
|
||||
Please see refer to the <a target="_blank" href="http://docs.fluentd.org/articles/in_forward">forward Input Plugin</a> documentation page.
|
||||
show:
|
||||
page_title: Add forward Input Plugin
|
||||
in_tail_option_guide: |
|
||||
For each config parameter, please refer to the <a href="http://docs.fluentd.org/articles/in_tail" target="_blank">Tail input plugin</a> documentation page.
|
||||
in_tail:
|
||||
|
||||
@ -96,7 +96,11 @@ ja:
|
||||
page_title: "%{label}"
|
||||
setup_in_tail: ファイル
|
||||
setup_in_syslog: syslogプロトコル
|
||||
setup_in_monitor_agent: 監視エージェント
|
||||
setup_in_http: http
|
||||
setup_in_forward: forward(他Fluentdからのイベント受信)
|
||||
setup_out_td: Treasure Data
|
||||
setup_out_stdout: 標準出力(ログ)
|
||||
setup_out_mongo: MongoDB
|
||||
setup_out_forward: 転送
|
||||
setup_out_s3: AWS S3
|
||||
@ -108,7 +112,7 @@ ja:
|
||||
destroy_fluentd_setting: "%{brand}の設定情報を削除"
|
||||
destroy_fluentd_setting_warning: |
|
||||
%{brand}の設定を削除します。
|
||||
|
||||
|
||||
<p>起動中の%{brand}は停止し、ログや設定ファイルはそのまま残存します。</p>
|
||||
show:
|
||||
page_title: "ダッシュボード"
|
||||
@ -162,11 +166,39 @@ ja:
|
||||
<a target="_blank" href="http://docs.fluentd.org/ja/articles/out_mongo">out_mongoプラグインの解説</a>もご参照ください。
|
||||
show:
|
||||
page_title: MongoDB書き出し設定
|
||||
out_stdout:
|
||||
option_guide: |
|
||||
標準出力(デーモンとして起動しているときはログファイル)へイベントを書き出します。<br />
|
||||
<a target="_blank" href="http://docs.fluentd.org/ja/articles/out_stdout">out_stdoutプラグインの解説</a>もご参照ください。
|
||||
show:
|
||||
page_title: 標準出力(ログ)
|
||||
in_syslog:
|
||||
option_guide: |
|
||||
<a target="_blank" href="http://docs.fluentd.org/ja/articles/in_syslog">in_syslogプラグイン解説ページ</a>もご参照ください。
|
||||
show:
|
||||
page_title: Syslog読み込み設定
|
||||
in_monitor_agent:
|
||||
option_guide: |
|
||||
HTTP経由で現在稼働中のfluentdが使用しているconfigやプラグインをJSONやLTSV形式で取得できます。<br />
|
||||
<a target="_blank" href="http://docs.fluentd.org/ja/articles/monitoring">監視エージェント</a>のページもご参照ください。
|
||||
show:
|
||||
page_title: 監視エージェント設定(monitor_agent)
|
||||
in_http:
|
||||
option_guide: |
|
||||
http POSTからレコードを取得可能にします。<br />
|
||||
URLパスはFluentdイベントログのタグとなり、ポストされたbody要素はレコードそのものになります。<br />
|
||||
<a target="_blank" href="http://docs.fluentd.org/ja/articles/in_http">httpインプットプラグイン解説ページ</a>もご参照ください。
|
||||
show:
|
||||
page_title: http入力設定
|
||||
in_forward:
|
||||
option_guide: |
|
||||
TCPソケットをリッスンし、イベントストリームを受信します。<br />
|
||||
UDPソケットもリッスンし、ハートビートメッセージを受信します。<br />
|
||||
他のFluentdインスタンス、fluent-catコマンドまたはクライアントライブラリーからイベントログを受信するために使用されます。<br />
|
||||
<a target="_blank" href="http://docs.fluentd.org/ja/articles/in_forward">forwardインプットプラグイン解説ページ</a>もご参照ください。
|
||||
show:
|
||||
page_title: forward入力設定
|
||||
|
||||
in_tail_option_guide: |
|
||||
<a target="_blank" href="http://docs.fluentd.org/ja/articles/in_tail">in_tailプラグインの解説ページ</a>や
|
||||
<a target="_blank" href="http://fluentular.herokuapp.com/">Fluentular</a>もご参照ください。
|
||||
|
||||
@ -28,6 +28,22 @@ Rails.application.routes.draw do
|
||||
post "finish"
|
||||
end
|
||||
|
||||
resource :in_monitor_agent, only: [:show], module: :settings, controller: :in_monitor_agent do
|
||||
post "finish"
|
||||
end
|
||||
|
||||
resource :in_http, only: [:show], module: :settings, controller: :in_http do
|
||||
post "finish"
|
||||
end
|
||||
|
||||
resource :in_forward, only: [:show], module: :settings, controller: :in_forward do
|
||||
post "finish"
|
||||
end
|
||||
|
||||
resource :out_stdout, only: [:show], module: :settings, controller: :out_stdout do
|
||||
post "finish"
|
||||
end
|
||||
|
||||
resource :out_mongo, only: [:show], module: :settings, controller: :out_mongo do
|
||||
post "finish"
|
||||
end
|
||||
|
||||
22
spec/features/fluentd/setting/in_forward_spec.rb
Normal file
22
spec/features/fluentd/setting/in_forward_spec.rb
Normal file
@ -0,0 +1,22 @@
|
||||
require "spec_helper"
|
||||
|
||||
describe "in_forward", stub: :daemon do
|
||||
let(:port) { "12345" }
|
||||
|
||||
before { login_with exists_user }
|
||||
|
||||
it "Shown form with filled in td.*.* on match" do
|
||||
visit daemon_setting_in_forward_path
|
||||
page.should have_css('input[name="fluentd_setting_in_forward[port]"]')
|
||||
end
|
||||
|
||||
it "Updated config after submit" do
|
||||
daemon.agent.config.should_not include(port)
|
||||
visit daemon_setting_in_forward_path
|
||||
within('#new_fluentd_setting_in_forward') do
|
||||
fill_in "Port", with: port
|
||||
end
|
||||
click_button I18n.t("fluentd.common.finish")
|
||||
daemon.agent.config.should include(port)
|
||||
end
|
||||
end
|
||||
22
spec/features/fluentd/setting/in_http_spec.rb
Normal file
22
spec/features/fluentd/setting/in_http_spec.rb
Normal file
@ -0,0 +1,22 @@
|
||||
require "spec_helper"
|
||||
|
||||
describe "in_http", stub: :daemon do
|
||||
let(:port) { "12345" }
|
||||
|
||||
before { login_with exists_user }
|
||||
|
||||
it "Shown form with filled in td.*.* on match" do
|
||||
visit daemon_setting_in_http_path
|
||||
page.should have_css('input[name="fluentd_setting_in_http[port]"]')
|
||||
end
|
||||
|
||||
it "Updated config after submit" do
|
||||
daemon.agent.config.should_not include(port)
|
||||
visit daemon_setting_in_http_path
|
||||
within('#new_fluentd_setting_in_http') do
|
||||
fill_in "Port", with: port
|
||||
end
|
||||
click_button I18n.t("fluentd.common.finish")
|
||||
daemon.agent.config.should include(port)
|
||||
end
|
||||
end
|
||||
22
spec/features/fluentd/setting/in_monitor_agent_spec.rb
Normal file
22
spec/features/fluentd/setting/in_monitor_agent_spec.rb
Normal file
@ -0,0 +1,22 @@
|
||||
require "spec_helper"
|
||||
|
||||
describe "in_monitor_agent", stub: :daemon do
|
||||
let(:port) { "12345" }
|
||||
|
||||
before { login_with exists_user }
|
||||
|
||||
it "Shown form with filled in td.*.* on match" do
|
||||
visit daemon_setting_in_monitor_agent_path
|
||||
page.should have_css('input[name="fluentd_setting_in_monitor_agent[port]"]')
|
||||
end
|
||||
|
||||
it "Updated config after submit" do
|
||||
daemon.agent.config.should_not include(port)
|
||||
visit daemon_setting_in_monitor_agent_path
|
||||
within('#new_fluentd_setting_in_monitor_agent') do
|
||||
fill_in "Port", with: port
|
||||
end
|
||||
click_button I18n.t("fluentd.common.finish")
|
||||
daemon.agent.config.should include(port)
|
||||
end
|
||||
end
|
||||
22
spec/features/fluentd/setting/out_stdout_spec.rb
Normal file
22
spec/features/fluentd/setting/out_stdout_spec.rb
Normal file
@ -0,0 +1,22 @@
|
||||
require "spec_helper"
|
||||
|
||||
describe "out_stdout", stub: :daemon do
|
||||
let(:match) { "stdout.**" }
|
||||
|
||||
before { login_with exists_user }
|
||||
|
||||
it "Shown form with filled in td.*.* on match" do
|
||||
visit daemon_setting_out_stdout_path
|
||||
page.should have_css('input[name="fluentd_setting_out_stdout[match]"]')
|
||||
end
|
||||
|
||||
it "Updated config after submit" do
|
||||
daemon.agent.config.should_not include(match)
|
||||
visit daemon_setting_out_stdout_path
|
||||
within('#new_fluentd_setting_out_stdout') do
|
||||
fill_in "Match", with: match
|
||||
end
|
||||
click_button I18n.t("fluentd.common.finish")
|
||||
daemon.agent.config.should include(match)
|
||||
end
|
||||
end
|
||||
Loading…
x
Reference in New Issue
Block a user