Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

give multiple pipelines all the settings #11076

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions logstash-core/lib/logstash/config/source/multi_local.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# encoding: utf-8
require "logstash/config/source/local"
require "logstash/pipeline_settings"
require "logstash/settings"

module LogStash module Config module Source
class MultiLocal < Local
Expand All @@ -15,7 +15,8 @@ def initialize(settings)
def pipeline_configs
pipelines = retrieve_yaml_pipelines()
pipelines_settings = pipelines.map do |pipeline_settings|
::LogStash::PipelineSettings.from_settings(@original_settings.clone).merge(pipeline_settings)
clone = @original_settings.clone
clone.merge_pipeline_settings(pipeline_settings)
end
detect_duplicate_pipelines(pipelines_settings)
pipeline_configs = pipelines_settings.map do |pipeline_settings|
Expand Down
55 changes: 0 additions & 55 deletions logstash-core/lib/logstash/pipeline_settings.rb

This file was deleted.

42 changes: 42 additions & 0 deletions logstash-core/lib/logstash/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,39 @@ class Settings
include LogStash::Util::SubstitutionVariables
include LogStash::Util::Loggable

# there are settings that the pipeline uses and can be changed per pipeline instance
PIPELINE_SETTINGS_WHITE_LIST = [
"config.debug",
"config.support_escapes",
"config.reload.automatic",
"config.reload.interval",
"config.string",
"dead_letter_queue.enable",
"dead_letter_queue.max_bytes",
"metric.collect",
"pipeline.java_execution",
"pipeline.plugin_classloaders",
"path.config",
"path.dead_letter_queue",
"path.queue",
"pipeline.batch.delay",
"pipeline.batch.size",
"pipeline.id",
"pipeline.reloadable",
"pipeline.system",
"pipeline.workers",
"queue.checkpoint.acks",
"queue.checkpoint.interval",
"queue.checkpoint.writes",
"queue.checkpoint.retry",
"queue.drain",
"queue.max_bytes",
"queue.max_events",
"queue.page_capacity",
"queue.type",
]


def initialize
@settings = {}
# Theses settings were loaded from the yaml file
Expand Down Expand Up @@ -89,6 +122,15 @@ def merge(hash, graceful = false)
self
end

def merge_pipeline_settings(hash, graceful = false)
hash.each do |key, _|
unless PIPELINE_SETTINGS_WHITE_LIST.include?(key)
raise ArgumentError.new("Only pipeline related settings are expected. Received \"#{key}\". Allowed settings: #{PIPELINE_SETTINGS_WHITE_LIST}")
end
end
merge(hash, graceful)
end

def format_settings
output = []
output << "-------- Logstash Settings (* means modified) ---------"
Expand Down