mirror of
https://github.com/fluent/fluentd-ui.git
synced 2026-05-05 10:56:11 +02:00
Add out_stdout setting
This commit is contained in:
parent
f44e6791e7
commit
9ac66f05d3
@ -0,0 +1,9 @@
|
||||
class Fluentd::Settings::OutStdoutController < ApplicationController
|
||||
include SettingConcern
|
||||
|
||||
private
|
||||
|
||||
def target_class
|
||||
Fluentd::Setting::OutStdout
|
||||
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
|
||||
@ -29,6 +29,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')
|
||||
|
||||
@ -100,6 +100,7 @@ en:
|
||||
setup_in_monitor_agent: Monitoring Agent
|
||||
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
|
||||
@ -162,6 +163,11 @@ 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.
|
||||
|
||||
@ -98,6 +98,7 @@ ja:
|
||||
setup_in_syslog: syslogプロトコル
|
||||
setup_in_monitor_agent: 監視エージェント
|
||||
setup_out_td: Treasure Data
|
||||
setup_out_stdout: 標準出力(ログ)
|
||||
setup_out_mongo: MongoDB
|
||||
setup_out_forward: 転送
|
||||
setup_out_s3: AWS S3
|
||||
@ -163,6 +164,12 @@ 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>もご参照ください。
|
||||
|
||||
@ -32,6 +32,10 @@ Rails.application.routes.draw 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
|
||||
|
||||
35
spec/features/fluentd/setting/out_stdout_spec.rb
Normal file
35
spec/features/fluentd/setting/out_stdout_spec.rb
Normal file
@ -0,0 +1,35 @@
|
||||
require "spec_helper"
|
||||
|
||||
describe "out_stdout" do
|
||||
let(:exists_user) { build(:user) }
|
||||
let(:daemon) { build(:fluentd, variant: "td-agent") }
|
||||
let(:match) { "stdout.**" }
|
||||
|
||||
before do
|
||||
Fluentd.stub(:instance).and_return(daemon)
|
||||
Fluentd::Agent::TdAgent.any_instance.stub(:detached_command).and_return(true)
|
||||
daemon.agent.config_write ""
|
||||
|
||||
visit '/sessions/new'
|
||||
within("form") do
|
||||
fill_in 'session_name', :with => exists_user.name
|
||||
fill_in 'session_password', :with => exists_user.password
|
||||
end
|
||||
click_button I18n.t("terms.sign_in")
|
||||
end
|
||||
|
||||
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