mirror of
https://github.com/fluent/fluentd-ui.git
synced 2025-08-10 16:27:06 +02:00
Adding support for some plugins was hard. After this commit, easy to add a plugin that has commonly setting style. Before: - Add model, controller, and views for it. After: - Add model and controller. view is shared.
51 lines
1.2 KiB
Ruby
51 lines
1.2 KiB
Ruby
class Fluentd
|
|
module Setting
|
|
class OutElasticsearch
|
|
include Common
|
|
|
|
KEYS = [
|
|
:match,
|
|
:host, :port, :index_name, :type_name,
|
|
:logstash_format, :logstash_prefix, :logstash_dateformat, :utc_index,
|
|
:hosts, :request_timeout, :include_tag_key
|
|
].freeze
|
|
|
|
attr_accessor(*KEYS)
|
|
|
|
booleans :logstash_format, :utc_index, :include_tag_key
|
|
|
|
validates :match, presence: true
|
|
validates :host, presence: true
|
|
validates :port, presence: true
|
|
validates :index_name, presence: true
|
|
validates :type_name, presence: true
|
|
|
|
def self.initial_params
|
|
{
|
|
host: "127.0.0.1",
|
|
port: 9200,
|
|
index_name: "via_fluentd",
|
|
type_name: "via_fluentd",
|
|
logstash_format: true,
|
|
include_tag_key: false,
|
|
utc_index: true,
|
|
}
|
|
end
|
|
|
|
def common_options
|
|
[
|
|
:match, :host, :port, :logstash_format,
|
|
:index_name, :type_name,
|
|
]
|
|
end
|
|
|
|
def advanced_options
|
|
[
|
|
:hosts, :logstash_prefix, :logstash_dateformat,
|
|
:utc_index, :request_timeout, :include_tag_key,
|
|
]
|
|
end
|
|
end
|
|
end
|
|
end
|