Skip to content

Commit

Permalink
Coralogix endpoint added (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
EldarAliiev authored Feb 9, 2021
1 parent 4773751 commit bc6988c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
11 changes: 10 additions & 1 deletion lib/logstash/outputs/coralogix.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions logstash-output-coralogix.gemspec
Original file line number Diff line number Diff line change
@@ -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.'
Expand Down

0 comments on commit bc6988c

Please sign in to comment.