fluent-plugin-coralogix 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/fluent/plugin/out_coralogix.rb +35 -18
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5e77fbb9d9a357eb434d590d1167828178a969ba
|
4
|
+
data.tar.gz: 49e351ca9176671c19cd69e34bb1e3772fbd50ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c2e97519cdd278439fffc6a44e554e9499f2a7526033e75747b1e6a81a40c7489148f07d0417ae630cda9158e9db9b23bb4e7c711c00d2716b3e90347433455
|
7
|
+
data.tar.gz: 7bc70fe0c4d0aa9b9b2197ce3ddc8d4ed049e2761decbd7403b5519eca314b48ec4d962c743cd2ccd6ef5a3a55b80c064897c74f331d0fec3f445ffb44aff7b4
|
@@ -22,29 +22,38 @@ module Fluent
|
|
22
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_param :number_of_workers, :integer, :default => 1
|
25
26
|
config_section :proxy, :param_name => "proxy", required: false, multi: false do
|
26
27
|
config_param :host, :string
|
27
28
|
config_param :port, :integer
|
28
29
|
config_param :user, :string, :default => nil
|
29
30
|
config_param :password, :string, :default => nil, secret: true
|
30
31
|
end
|
31
|
-
@configured = false
|
32
32
|
|
33
33
|
# This method is called before starting.
|
34
34
|
def configure(conf)
|
35
35
|
super
|
36
36
|
begin
|
37
|
-
@
|
38
|
-
|
39
|
-
|
40
|
-
|
37
|
+
@currentWorker = 0;
|
38
|
+
@workers = {}
|
39
|
+
@app_name_from_config = DEFAULT_appname;
|
40
|
+
@sub_name_from_config = DEFAULT_subsystemname;
|
41
|
+
i = 0
|
42
|
+
$log.info "configure #{number_of_workers} workers"
|
43
|
+
until i == number_of_workers do
|
44
|
+
@workers[i.to_s] = {}
|
45
|
+
$log.info "init worker ##{i}"
|
41
46
|
private_key = get_private_key
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
+
if !appname.start_with?("$") && !subsystemname.start_with?("$")
|
48
|
+
@app_name_from_config = config.fetch("APP_NAME", appname)
|
49
|
+
@sub_name_from_config = config.fetch("SUB_SYSTEM", subsystemname)
|
50
|
+
@workers[i.to_s]["#{@app_name_from_config}.#{@sub_name_from_config}"] = CoralogixLogger.new private_key, @app_name_from_config, @sub_name_from_config, debug, "FluentD (#{version?})", force_compression, proxy ? proxy.to_h.map { |k,v| [k.to_s,v] }.to_h : Hash.new
|
51
|
+
else
|
52
|
+
@workers[i.to_s] = {}
|
53
|
+
end
|
54
|
+
i+=1
|
47
55
|
end
|
56
|
+
|
48
57
|
rescue Exception => e
|
49
58
|
$log.error "Failed to configure: #{e}"
|
50
59
|
end
|
@@ -85,17 +94,25 @@ module Fluent
|
|
85
94
|
end
|
86
95
|
|
87
96
|
def get_logger(record)
|
88
|
-
|
89
|
-
return @logger if @configured
|
90
|
-
|
91
97
|
private_key = get_private_key
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
98
|
+
if !appname.start_with?("$") && !subsystemname.start_with?("$")
|
99
|
+
app_name = @app_name_from_config
|
100
|
+
sub_name = @sub_name_from_config
|
101
|
+
else
|
102
|
+
app_name, sub_name = get_app_sub_name(record)
|
103
|
+
end
|
104
|
+
|
105
|
+
if @currentWorker == number_of_workers
|
106
|
+
@currentWorker = 0
|
107
|
+
end
|
108
|
+
worker = @workers[@currentWorker.to_s]
|
109
|
+
@currentWorker+=1;
|
110
|
+
if !worker.key?("#{app_name}.#{sub_name}")
|
111
|
+
worker["#{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
|
96
112
|
end
|
97
113
|
|
98
|
-
return
|
114
|
+
return worker["#{app_name}.#{sub_name}"]
|
115
|
+
|
99
116
|
end
|
100
117
|
|
101
118
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Royee Goldberg
|
@@ -51,7 +51,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
51
51
|
version: '0'
|
52
52
|
requirements: []
|
53
53
|
rubyforge_project:
|
54
|
-
rubygems_version: 2.
|
54
|
+
rubygems_version: 2.6.8
|
55
55
|
signing_key:
|
56
56
|
specification_version: 4
|
57
57
|
summary: Coralogix Fluentd out plugin
|