fluent-plugin-coralogix 1.0.1 → 1.0.2
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 +15 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b3d6decaa08868b283f9b0ca1771bab137c45cc93a7863b5089a0a1d1e75662
|
4
|
+
data.tar.gz: d4be68d3c32a83bfd9b243bcdcf3185bfd2242adec11a3751f502dd6683834ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c86aa2d9a9e5620d4cfa35c9059900c7fc7fded593f42578efcb12ccd1c8c88cbf8d0f9284e525ccb7da38ad0c61262bdb3c680de0d67364f32dbcef3e83775
|
7
|
+
data.tar.gz: '0384590b37a4e54c3fba35cc9d95513e7a88d9da200cf5d2bbad8d699c5a71a7cc997a3a653ffb0e45f8af56350e5e133e65b81b9fe3e57da417310d843148e3'
|
@@ -13,10 +13,11 @@ 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 => {}
|
16
17
|
config_param :log_key_name, :string, :default => nil
|
17
18
|
config_param :privatekey, :string, :default => nil
|
18
|
-
config_param :appname, :string
|
19
|
-
config_param :subsystemname, :string
|
19
|
+
config_param :appname, :string, :default => ""
|
20
|
+
config_param :subsystemname, :string, :default => ""
|
20
21
|
config_param :is_json, :bool, :default => false
|
21
22
|
config_param :timestamp_key_name, :default => nil
|
22
23
|
config_param :force_compression, :bool, :default => false
|
@@ -29,9 +30,14 @@ module Fluent
|
|
29
30
|
super
|
30
31
|
begin
|
31
32
|
@loggers = {}
|
33
|
+
|
32
34
|
#If config parameters doesn't start with $ then we can configure Coralogix logger now.
|
33
35
|
if !appname.start_with?("$") && !subsystemname.start_with?("$")
|
34
|
-
|
36
|
+
app_name = config.fetch("APP_NAME", appname)
|
37
|
+
sub_name = config.fetch("SUB_SYSTEM", subsystemname)
|
38
|
+
private_key = get_private_key
|
39
|
+
|
40
|
+
@logger = CoralogixLogger.new private_key, app_name, sub_name, debug, "FluentD (#{version?})", force_compression
|
35
41
|
@configured = true
|
36
42
|
end
|
37
43
|
rescue Exception => e
|
@@ -39,6 +45,10 @@ module Fluent
|
|
39
45
|
end
|
40
46
|
end
|
41
47
|
|
48
|
+
def get_private_key
|
49
|
+
return config.fetch("PRIVATE_KEY", privatekey)
|
50
|
+
end
|
51
|
+
|
42
52
|
def version?
|
43
53
|
begin
|
44
54
|
Gem.loaded_specs['fluent-plugin-coralogix'].version.to_s
|
@@ -73,10 +83,11 @@ module Fluent
|
|
73
83
|
|
74
84
|
return @logger if @configured
|
75
85
|
|
86
|
+
private_key = get_private_key
|
76
87
|
app_name, sub_name = get_app_sub_name(record)
|
77
88
|
|
78
89
|
if !@loggers.key?("#{app_name}.#{sub_name}")
|
79
|
-
@loggers["#{app_name}.#{sub_name}"] = CoralogixLogger.new
|
90
|
+
@loggers["#{app_name}.#{sub_name}"] = CoralogixLogger.new private_key, app_name, sub_name
|
80
91
|
end
|
81
92
|
|
82
93
|
return @loggers["#{app_name}.#{sub_name}"]
|