From bc6988c0820f978d88409c6b25207e3b81849bc3 Mon Sep 17 00:00:00 2001 From: Eldar Aliiev Date: Tue, 9 Feb 2021 15:25:20 +0200 Subject: [PATCH] Coralogix endpoint added (#8) --- lib/logstash/outputs/coralogix.rb | 11 ++++++++++- logstash-output-coralogix.gemspec | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/logstash/outputs/coralogix.rb b/lib/logstash/outputs/coralogix.rb index 084f288..e03a8f9 100644 --- a/lib/logstash/outputs/coralogix.rb +++ b/lib/logstash/outputs/coralogix.rb @@ -3,7 +3,6 @@ require "date" require "logstash/outputs/base" require "logstash/namespace" -require "centralized_ruby_logger" DEFAULT_APP_NAME = "FAILED_APP_NAME" DEFAULT_SUB_SYSTEM = "FAILED_SUB_SYSTEM_NAME" @@ -17,6 +16,7 @@ class LogStash::Outputs::Coralogix < LogStash::Outputs::Base config :is_json, :validate => :boolean, :required => false config :force_compression, :validate => :boolean, :required => false, :default => false config :debug, :validate => :boolean, :required => false, :default => false + config :endpoint, :validate => :string, :required => false, :default => nil config :proxy, :validate => :hash, :required => false, :default => {} @configured = false @@ -62,6 +62,15 @@ def version? def configure begin @loggers = {} + + # Overwrite Coralogix endpoint + unless endpoint.nil? + ENV["CORALOGIX_LOG_URL"] = "https://#{endpoint}/api/v1/logs" + ENV["CORALOGIX_TIME_DELTA_URL"] = "https://#{endpoint}/sdk/v1/time" + end + + require "centralized_ruby_logger" + #If config parameters doesn't start with $ then we can configure Coralogix logger now. if !config_params["APP_NAME"].start_with?("$") && !config_params["SUB_SYSTEM"].start_with?("$") @logger = Coralogix::CoralogixLogger.new config_params["PRIVATE_KEY"], config_params["APP_NAME"], config_params["SUB_SYSTEM"], debug, "Logstash (#{version?})", force_compression, proxy diff --git a/logstash-output-coralogix.gemspec b/logstash-output-coralogix.gemspec index 37e4179..1ba5afa 100644 --- a/logstash-output-coralogix.gemspec +++ b/logstash-output-coralogix.gemspec @@ -1,7 +1,7 @@ Gem::Specification.new do |s| s.name = 'logstash-output-coralogix' - s.version = '1.0.4' - s.date = '2020-10-12' + s.version = '1.0.5' + s.date = '2021-02-09' s.licenses = ['Apache-2.0'] s.summary = 'Deliver the logs to Coralogix service.' s.description = 'This gem is a Logstash output plugin to deliver the logs to Coralogix service.'