Incorporate review comments

Fixes #11777
This commit is contained in:
Rob Bavey 2020-04-13 09:07:23 -04:00 committed by Robert Bavey
parent d33195750e
commit c00c3da95a

View file

@ -211,18 +211,12 @@ module LogStash module Inputs
end end
def extract_cluster_uuids(stats) def extract_cluster_uuids(stats)
cluster_uuids = [] cluster_uuids = agent.running_pipelines.flat_map do |_, pipeline|
agent.running_pipelines.each do |pipeline_id, _| next if pipeline.system?
unless pipeline_id.to_sym == :".monitoring-logstash" pipeline.resolve_cluster_uuids
path = [:stats, :pipelines, pipeline_id.to_sym, :config] end.compact.uniq
found_cluster_uuids = stats.extract_metrics(path, :cluster_uuids)
if found_cluster_uuids && !found_cluster_uuids[:cluster_uuids].empty?
cluster_uuids |= found_cluster_uuids[:cluster_uuids]
end
end
end
unless cluster_uuids.empty? if cluster_uuids.any?
@logger.info("Found cluster_uuids from elasticsearch output plugins", :cluster_uuids => cluster_uuids) @logger.info("Found cluster_uuids from elasticsearch output plugins", :cluster_uuids => cluster_uuids)
if LogStash::SETTINGS.set?("monitoring.cluster_uuid") if LogStash::SETTINGS.set?("monitoring.cluster_uuid")
@logger.warn("Found monitoring.cluster_uuid setting configured in logstash.yml while using the ones discovered from elasticsearch output plugins, ignoring setting monitoring.cluster_uuid") @logger.warn("Found monitoring.cluster_uuid setting configured in logstash.yml while using the ones discovered from elasticsearch output plugins, ignoring setting monitoring.cluster_uuid")