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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9c2679f633f12acacc7a6df89e6ee390174f3c0218e8a0257a4f6ce04becc303
4
- data.tar.gz: a8eb5b2d6c736b3e262a5d2bbfb41b2625d29414b64d7e92f139a4a76af7b018
3
+ metadata.gz: 0b3d6decaa08868b283f9b0ca1771bab137c45cc93a7863b5089a0a1d1e75662
4
+ data.tar.gz: d4be68d3c32a83bfd9b243bcdcf3185bfd2242adec11a3751f502dd6683834ba
5
5
  SHA512:
6
- metadata.gz: 4f3d283bc07e3519fa00ca98b2172090ff9f5c9545a729d1cd116ec3917a1205ad23a5ec00de8e088fa1a486504ab7cdc5c46d04df099e610a556deb27f03187
7
- data.tar.gz: a4eb11b58b4f0022c46a7cf985437eb25b52a215f37f0be49cc350566101d51e1ff4d7dcde4b31f61a674e239facf3e6abecf04f9c34ecaacc7b20915e8b8cbd
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
- @logger = CoralogixLogger.new privatekey, appname, subsystemname, debug, "FluentD (#{version?})", force_compression
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 privatekey, app_name, sub_name
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}"]
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.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Royee Goldberg