-
-
Save jordansissel/987a02618f05d0885d8a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'logstash-output-elasticsearch-ec2_jars.rb' | |
module LogStash::Outputs::ElasticSearch::Ec2 | |
def self.included(base) | |
base.extend(self) | |
base.register | |
end | |
def register | |
config :aws_access_key, :validate => :string | |
config :aws_secret_key, :validate => :string | |
config :aws_protocol, :validate => :string | |
end | |
def setup | |
puts "IT WORKS" | |
end | |
def client_settings(plugin) | |
settings = {} | |
settings['cloud.aws.access_key'] = plugin.aws_access_key | |
settings['cloud.aws.secret_key'] = plugin.aws_secret_key | |
settings['cloud.aws.protocol'] = plugin.aws_protocol | |
puts settings | |
settings | |
end | |
end | |
LogStash::Outputs::ElasticSearch.instance_eval{ include LogStash::Outputs::ElasticSearch::Ec2 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LogStash::Outputs::ElasticSearch < LogStash::Outputs::Base | |
include Stud::Buffer | |
@@plugins = Dir.glob(File.join(LogStash::Environment.plugins_home,'gems','logstash-output-elasticsearch-*-*')) | |
@@plugins.each do |plugin| | |
name = plugin.split("/")[-1].split('-')[-2] | |
require "logstash/outputs/elasticsearch/#{name}" | |
LogStash::Outputs::ElasticSearch.const_get(name.capitalize).setup | |
end | |
def register | |
@logger.info("PLugins: ",:plugins => @@plugins) | |
client_settings = {} | |
client_settings["cluster.name"] = @cluster if @cluster | |
client_settings["network.host"] = @bind_host if @bind_host | |
client_settings["transport.tcp.port"] = @bind_port if @bind_port | |
if @node_name | |
client_settings["node.name"] = @node_name | |
else | |
client_settings["node.name"] = "logstash-#{Socket.gethostname}-#{$$}-#{object_id}" | |
end | |
@@plugins.each do |plugin| | |
name = plugin.split("/")[-1].split('-')[-2] | |
client_settings.merge!(LogStash::Outputs::ElasticSearch.const_get(name.capitalize).client_settings(self)) | |
end | |
----- And the rest ------ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment