logstash-output-coralogix 1.0.0 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +20 -1
- data/lib/logstash/outputs/coralogix.rb +16 -6
- data/logstash-output-coralogix.gemspec +4 -3
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68a61cebb9cdbf29259aa7d105e9bda6194ddeefdfccc917dd7b4496f8950dd2
|
4
|
+
data.tar.gz: 8987b411f5a3348f4f80cbb289b9fba8bc796324c20bdc93e3f4cffaa9ff169c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd2d53e2812dbd3f0dd21340605983cad5c17f336bde064687035a56e1a08f9b5b481af96862482f568b308ce8cfca4a9eb216c83c95ebb1cd109500091c336e
|
7
|
+
data.tar.gz: b2f7d9c14080134ea52446232124f1e01f4f55ebbde4df22ebfa1b50dace5410beaabb1697a9b69a38fa68c466d76357b17908b0e8848c76c5a0e7294c6e662f
|
data/README.md
CHANGED
@@ -94,4 +94,23 @@ Coralogix automatically generates the timestamp based on the log arrival time. I
|
|
94
94
|
|
95
95
|
### JSON support
|
96
96
|
|
97
|
-
In case your raw log message is a JSON object you should set `is_json` key to a **true** value, otherwise you can ignore it.
|
97
|
+
In case your raw log message is a JSON object you should set `is_json` key to a **true** value, otherwise you can ignore it.
|
98
|
+
|
99
|
+
### Proxy support
|
100
|
+
|
101
|
+
This plugin supports sending data via proxy. Here is the example of the configuration:
|
102
|
+
|
103
|
+
```ruby
|
104
|
+
output {
|
105
|
+
coralogix {
|
106
|
+
...
|
107
|
+
# Proxy settings
|
108
|
+
proxy => {
|
109
|
+
host => "PROXY_ADDRESS"
|
110
|
+
port => PROXY_PORT
|
111
|
+
user => "PROXY_USER" # Optional
|
112
|
+
password => "PROXY_PASSWORD" # Optional
|
113
|
+
}
|
114
|
+
}
|
115
|
+
}
|
116
|
+
```
|
@@ -3,7 +3,6 @@ require "json"
|
|
3
3
|
require "date"
|
4
4
|
require "logstash/outputs/base"
|
5
5
|
require "logstash/namespace"
|
6
|
-
require "centralized_ruby_logger"
|
7
6
|
|
8
7
|
DEFAULT_APP_NAME = "FAILED_APP_NAME"
|
9
8
|
DEFAULT_SUB_SYSTEM = "FAILED_SUB_SYSTEM_NAME"
|
@@ -17,6 +16,8 @@ class LogStash::Outputs::Coralogix < LogStash::Outputs::Base
|
|
17
16
|
config :is_json, :validate => :boolean, :required => false
|
18
17
|
config :force_compression, :validate => :boolean, :required => false, :default => false
|
19
18
|
config :debug, :validate => :boolean, :required => false, :default => false
|
19
|
+
config :endpoint, :validate => :string, :required => false, :default => nil
|
20
|
+
config :proxy, :validate => :hash, :required => false, :default => {}
|
20
21
|
@configured = false
|
21
22
|
|
22
23
|
public def register
|
@@ -30,7 +31,7 @@ class LogStash::Outputs::Coralogix < LogStash::Outputs::Base
|
|
30
31
|
logger = get_logger(record)
|
31
32
|
|
32
33
|
log_record = log_key_name != nil ? record.fetch(log_key_name, record) : record
|
33
|
-
log_record = is_json ? log_record.to_json : log_record
|
34
|
+
log_record = (is_json ? log_record.to_json : log_record) rescue log_record
|
34
35
|
log_record = log_record.to_s.empty? ? record : log_record
|
35
36
|
|
36
37
|
timestamp = record.fetch(timestamp_key_name, nil)
|
@@ -61,9 +62,18 @@ class LogStash::Outputs::Coralogix < LogStash::Outputs::Base
|
|
61
62
|
def configure
|
62
63
|
begin
|
63
64
|
@loggers = {}
|
65
|
+
|
66
|
+
# Overwrite Coralogix endpoint
|
67
|
+
unless endpoint.nil?
|
68
|
+
ENV["CORALOGIX_LOG_URL"] = "https://#{endpoint}/api/v1/logs"
|
69
|
+
ENV["CORALOGIX_TIME_DELTA_URL"] = "https://#{endpoint}/sdk/v1/time"
|
70
|
+
end
|
71
|
+
|
72
|
+
require "centralized_ruby_logger"
|
73
|
+
|
64
74
|
#If config parameters doesn't start with $ then we can configure Coralogix logger now.
|
65
75
|
if !config_params["APP_NAME"].start_with?("$") && !config_params["SUB_SYSTEM"].start_with?("$")
|
66
|
-
@logger = Coralogix::CoralogixLogger.new config_params["PRIVATE_KEY"], config_params["APP_NAME"], config_params["SUB_SYSTEM"], debug, "Logstash (#{version?})", force_compression
|
76
|
+
@logger = Coralogix::CoralogixLogger.new config_params["PRIVATE_KEY"], config_params["APP_NAME"], config_params["SUB_SYSTEM"], debug, "Logstash (#{version?})", force_compression, proxy
|
67
77
|
@configured = true
|
68
78
|
end
|
69
79
|
rescue Exception => e
|
@@ -94,12 +104,12 @@ class LogStash::Outputs::Coralogix < LogStash::Outputs::Base
|
|
94
104
|
|
95
105
|
def get_logger(record)
|
96
106
|
|
97
|
-
return @logger if @configured
|
107
|
+
return @logger if @configured && !@logger.nil?
|
98
108
|
|
99
109
|
app_name, sub_name = get_app_sub_name(record)
|
100
110
|
|
101
|
-
if !@loggers.key?("#{app_name}.#{sub_name}")
|
102
|
-
@loggers["#{app_name}.#{sub_name}"] = Coralogix::CoralogixLogger.new config_params["PRIVATE_KEY"], app_name, sub_name, debug, "Logstash (#{version?})", force_compression
|
111
|
+
if !@loggers.key?("#{app_name}.#{sub_name}") || @loggers.fetch("#{app_name}.#{sub_name}", nil).nil?
|
112
|
+
@loggers["#{app_name}.#{sub_name}"] = Coralogix::CoralogixLogger.new config_params["PRIVATE_KEY"], app_name, sub_name, debug, "Logstash (#{version?})", force_compression, proxy
|
103
113
|
end
|
104
114
|
|
105
115
|
return @loggers["#{app_name}.#{sub_name}"]
|
@@ -1,8 +1,9 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-output-coralogix'
|
3
|
-
s.version = '1.0.
|
3
|
+
s.version = '1.0.5'
|
4
|
+
s.date = '2021-02-09'
|
4
5
|
s.licenses = ['Apache-2.0']
|
5
|
-
s.summary = '
|
6
|
+
s.summary = 'Deliver the logs to Coralogix service.'
|
6
7
|
s.description = 'This gem is a Logstash output plugin to deliver the logs to Coralogix service.'
|
7
8
|
s.homepage = 'https://coralogix.com/'
|
8
9
|
s.authors = ['Coralogix']
|
@@ -21,7 +22,7 @@ Gem::Specification.new do |s|
|
|
21
22
|
# Gem dependencies
|
22
23
|
s.add_runtime_dependency 'logstash-core-plugin-api', '~> 2.0'
|
23
24
|
s.add_runtime_dependency 'logstash-codec-plain'
|
24
|
-
s.add_runtime_dependency 'centralized_ruby_logger', '>= 0.0.
|
25
|
+
s.add_runtime_dependency 'centralized_ruby_logger', '>= 0.0.15'
|
25
26
|
|
26
27
|
s.add_development_dependency 'logstash-devutils'
|
27
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-output-coralogix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Coralogix
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logstash-core-plugin-api
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.0.
|
47
|
+
version: 0.0.15
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.0.
|
54
|
+
version: 0.0.15
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: logstash-devutils
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -87,7 +87,7 @@ licenses:
|
|
87
87
|
metadata:
|
88
88
|
logstash_plugin: 'true'
|
89
89
|
logstash_group: output
|
90
|
-
post_install_message:
|
90
|
+
post_install_message:
|
91
91
|
rdoc_options: []
|
92
92
|
require_paths:
|
93
93
|
- lib
|
@@ -102,10 +102,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
requirements: []
|
105
|
-
rubyforge_project:
|
105
|
+
rubyforge_project:
|
106
106
|
rubygems_version: 2.7.3
|
107
|
-
signing_key:
|
107
|
+
signing_key:
|
108
108
|
specification_version: 4
|
109
|
-
summary:
|
109
|
+
summary: Deliver the logs to Coralogix service.
|
110
110
|
test_files:
|
111
111
|
- spec/outputs/coralogix_spec.rb
|