Skip to content

Instantly share code, notes, and snippets.

@ph
Created May 2, 2017 18:22
Show Gist options
  • Save ph/ae9ec5ed882e20e6f9c40141bb9e4ecb to your computer and use it in GitHub Desktop.
Save ph/ae9ec5ed882e20e6f9c40141bb9e4ecb to your computer and use it in GitHub Desktop.
# encoding: utf-8
require "logstash/config/source/base"
require "logstash/config/pipeline_config"
require "logstash/util/loggable"
require "logstash/errors"
module LogStash module Config module Source
# Modules could be a weird names?
class Modules < Base
def pipeline_configs
configs = []
# Not working code but high level view
plugin_modules = LogStash::PLUGIN_REGISTRY.plugin_with_type("modules")
# a_new_modules = plugins_modules.first
# a_new_modules.new(module_settings)
# a_new_modules.valid?
# a_new_modules.pipeline_config
# LogStash::Modules::Arcsight
# Loop through the modules defined in the settings
# call a method on the plugin class to generate the template?
# add the pipeline config
configs_part = org.logstash.common.SourceWithMetadata.new("modules", "module-arcsight", "input { generator {} } output { null {}}")
pipeline_id = "arcsight-1234"
# You can return multiple pipelines here
[
PipelineConfig.new(self.class, pipeline_id, config_parts, @settings),
PipelineConfig.new(self.class, pipeline_id, config_parts, @settings),
PipelineConfig.new(self.class, pipeline_id, config_parts, @settings),
PipelineConfig.new(self.class, pipeline_id, config_parts, @settings)
]
end
end end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment