fluent-plugin-coralogix 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fluent/plugin/out_coralogix.rb +25 -20
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ce2acecdd79fb16064e42482203fecf190d0e85909b08059b6fd79c001e38fb
|
4
|
+
data.tar.gz: 8443396fbcb5ac930e899878410e447c782a12c556fc1df19b0864f2fd31ddb8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0423e9052c876066007afc1137ed0ce103ef86120ac4a7bbdb3b2cd5d91db59c70c3d9d4fffc818b5ca9b9a4711fed288fbe19c9604ee5416408abe8e5c5d54
|
7
|
+
data.tar.gz: 5acf5d83bb67a338fc4bc8845515344d5f923a8bbe5c980a6f2093388befecadcf37229be15639b449622bf0722d871c18bc4d158da809ee7e4be17887cc85ba
|
@@ -13,31 +13,36 @@ module Fluent
|
|
13
13
|
# First, register the plugin. NAME is the name of this plugin
|
14
14
|
# and identifies the plugin in the configuration file.
|
15
15
|
Fluent::Plugin.register_output('coralogix', self)
|
16
|
-
config_param :config, :hash, :default => {}
|
17
|
-
config_param :log_key_name, :string, :default => nil
|
16
|
+
config_param :config, :hash, :default => {}, deprecated: "This parameter is deprecated"
|
18
17
|
config_param :privatekey, :string, :default => nil
|
19
18
|
config_param :appname, :string, :default => ""
|
20
19
|
config_param :subsystemname, :string, :default => ""
|
21
|
-
config_param :
|
20
|
+
config_param :log_key_name, :string, :default => nil
|
22
21
|
config_param :timestamp_key_name, :default => nil
|
22
|
+
config_param :is_json, :bool, :default => false
|
23
23
|
config_param :force_compression, :bool, :default => false
|
24
24
|
config_param :debug, :bool, :default => false
|
25
|
+
config_section :proxy, :param_name => "proxy", required: false, multi: false do
|
26
|
+
config_param :host, :string
|
27
|
+
config_param :port, :integer
|
28
|
+
config_param :user, :string, :default => nil
|
29
|
+
config_param :password, :string, :default => nil, secret: true
|
30
|
+
end
|
25
31
|
@configured = false
|
26
32
|
|
27
|
-
|
28
33
|
# This method is called before starting.
|
29
34
|
def configure(conf)
|
30
35
|
super
|
31
36
|
begin
|
32
37
|
@loggers = {}
|
33
|
-
|
38
|
+
|
34
39
|
#If config parameters doesn't start with $ then we can configure Coralogix logger now.
|
35
40
|
if !appname.start_with?("$") && !subsystemname.start_with?("$")
|
41
|
+
private_key = get_private_key
|
36
42
|
app_name = config.fetch("APP_NAME", appname)
|
37
43
|
sub_name = config.fetch("SUB_SYSTEM", subsystemname)
|
38
|
-
|
39
|
-
|
40
|
-
@logger = CoralogixLogger.new private_key, app_name, sub_name, debug, "FluentD (#{version?})", force_compression
|
44
|
+
|
45
|
+
@logger = CoralogixLogger.new private_key, app_name, sub_name, debug, "FluentD (#{version?})", force_compression, proxy ? proxy.to_h.map { |k,v| [k.to_s,v] }.to_h : Hash.new
|
41
46
|
@configured = true
|
42
47
|
end
|
43
48
|
rescue Exception => e
|
@@ -51,9 +56,9 @@ module Fluent
|
|
51
56
|
|
52
57
|
def version?
|
53
58
|
begin
|
54
|
-
|
55
|
-
rescue Exception => e
|
56
|
-
|
59
|
+
Gem.loaded_specs['fluent-plugin-coralogix'].version.to_s
|
60
|
+
rescue Exception => e
|
61
|
+
return '0.0.0'
|
57
62
|
end
|
58
63
|
end
|
59
64
|
|
@@ -62,7 +67,7 @@ module Fluent
|
|
62
67
|
res = record
|
63
68
|
return key unless key.start_with?("$")
|
64
69
|
key[1..-1].split(".").each do |k|
|
65
|
-
res = res.fetch(k,nil)
|
70
|
+
res = res.fetch(k, nil)
|
66
71
|
return default if res == nil
|
67
72
|
end
|
68
73
|
return res
|
@@ -82,12 +87,12 @@ module Fluent
|
|
82
87
|
def get_logger(record)
|
83
88
|
|
84
89
|
return @logger if @configured
|
85
|
-
|
90
|
+
|
86
91
|
private_key = get_private_key
|
87
92
|
app_name, sub_name = get_app_sub_name(record)
|
88
|
-
|
93
|
+
|
89
94
|
if !@loggers.key?("#{app_name}.#{sub_name}")
|
90
|
-
@loggers["#{app_name}.#{sub_name}"] = CoralogixLogger.new private_key, app_name, sub_name
|
95
|
+
@loggers["#{app_name}.#{sub_name}"] = CoralogixLogger.new private_key, app_name, sub_name, debug, "FluentD (#{version?})", force_compression, proxy ? proxy.to_h.map { |k, v| [k.to_s, v] }.to_h : Hash.new
|
91
96
|
end
|
92
97
|
|
93
98
|
return @loggers["#{app_name}.#{sub_name}"]
|
@@ -113,7 +118,7 @@ module Fluent
|
|
113
118
|
# NOTE! This method is called by Fluentd's main thread so you should not write slow routine here. It causes Fluentd's performance degression.
|
114
119
|
def emit(tag, es, chain)
|
115
120
|
chain.next
|
116
|
-
es.each {|time,record|
|
121
|
+
es.each { |time, record|
|
117
122
|
logger = get_logger(record)
|
118
123
|
|
119
124
|
log_record = log_key_name != nil ? record.fetch(log_key_name, record) : record
|
@@ -121,15 +126,15 @@ module Fluent
|
|
121
126
|
log_record = log_record.to_s.empty? ? record : log_record
|
122
127
|
|
123
128
|
timestamp = record.fetch(timestamp_key_name, nil)
|
124
|
-
if(timestamp.nil?)
|
129
|
+
if (timestamp.nil?)
|
125
130
|
logger.debug log_record
|
126
131
|
else
|
127
132
|
begin
|
128
133
|
float_timestamp = DateTime.parse(timestamp.to_s).to_time.to_f * 1000
|
129
|
-
logger.debug log_record, nil, timestamp:float_timestamp
|
130
|
-
rescue Exception => e
|
134
|
+
logger.debug log_record, nil, timestamp: float_timestamp
|
135
|
+
rescue Exception => e
|
131
136
|
logger.debug log_record
|
132
|
-
end
|
137
|
+
end
|
133
138
|
end
|
134
139
|
}
|
135
140
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-coralogix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Royee Goldberg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: centralized_ruby_logger
|