fluent-plugin-coralogix 0.0.6 → 1.0.0
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 → new_coralogix_out}/out_coralogix.rb +36 -12
- metadata +7 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 647b70e8c8a88404ea8397624d65caabbc9fe4737db71ab1bff761a3e52ecea8
|
4
|
+
data.tar.gz: ef6ff3e2f0926e6b395acdf64c926fae1188ca69fbffca320faf1e5ed8f70274
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba5d6d7121036689dc27056521d6dd8a543d2bd9bbdaf31b2d92ffae2dab7ceb84db2c215b25992e9b47683bc2ad572956a538e8627df49401f762c73c851706
|
7
|
+
data.tar.gz: df4a9e15115b61accdadc3b5ec67052181fb07868ffab4c25c24e53320d0af753b5d49643570bcaa9ff1b3eba48d054d6a27d4ce65f0adcef558e3ed4f56e218
|
@@ -1,20 +1,26 @@
|
|
1
1
|
require 'fluent/output'
|
2
|
-
require '
|
2
|
+
require 'centralized_ruby_logger'
|
3
|
+
require 'date'
|
3
4
|
|
4
5
|
include Coralogix
|
5
6
|
|
6
7
|
module Fluent
|
7
8
|
|
8
|
-
|
9
|
-
|
9
|
+
DEFAULT_appname = "FAILED_APP_NAME"
|
10
|
+
DEFAULT_subsystemname = "FAILED_SUBSYSTEM_NAME"
|
10
11
|
|
11
12
|
class SomeOutput < Output
|
12
13
|
# First, register the plugin. NAME is the name of this plugin
|
13
14
|
# and identifies the plugin in the configuration file.
|
14
15
|
Fluent::Plugin.register_output('coralogix', self)
|
15
|
-
config_param :config, :hash
|
16
16
|
config_param :log_key_name, :string, :default => nil
|
17
|
+
config_param :privatekey, :string, :default => nil
|
18
|
+
config_param :appname, :string
|
19
|
+
config_param :subsystemname, :string
|
17
20
|
config_param :is_json, :bool, :default => false
|
21
|
+
config_param :timestamp_key_name, :default => nil
|
22
|
+
config_param :force_compression, :bool, :default => false
|
23
|
+
config_param :debug, :bool, :default => false
|
18
24
|
@configured = false
|
19
25
|
|
20
26
|
|
@@ -24,8 +30,8 @@ module Fluent
|
|
24
30
|
begin
|
25
31
|
@loggers = {}
|
26
32
|
#If config parameters doesn't start with $ then we can configure Coralogix logger now.
|
27
|
-
if !
|
28
|
-
@logger = CoralogixLogger.new
|
33
|
+
if !appname.start_with?("$") && !subsystemname.start_with?("$")
|
34
|
+
@logger = CoralogixLogger.new privatekey, appname, subsystemname, debug, "FluentD (#{version?})", force_compression
|
29
35
|
@configured = true
|
30
36
|
end
|
31
37
|
rescue Exception => e
|
@@ -33,6 +39,14 @@ module Fluent
|
|
33
39
|
end
|
34
40
|
end
|
35
41
|
|
42
|
+
def version?
|
43
|
+
begin
|
44
|
+
Gem.loaded_specs['fluent-plugin-coralogix'].version.to_s
|
45
|
+
rescue Exception => e
|
46
|
+
return '0.0.0'
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
36
50
|
def extract record, key, default
|
37
51
|
begin
|
38
52
|
res = record
|
@@ -50,8 +64,8 @@ module Fluent
|
|
50
64
|
|
51
65
|
|
52
66
|
def get_app_sub_name(record)
|
53
|
-
app_name = extract(record,
|
54
|
-
sub_name = extract(record,
|
67
|
+
app_name = extract(record, appname, DEFAULT_appname)
|
68
|
+
sub_name = extract(record, subsystemname, DEFAULT_subsystemname)
|
55
69
|
return app_name, sub_name
|
56
70
|
end
|
57
71
|
|
@@ -62,7 +76,7 @@ module Fluent
|
|
62
76
|
app_name, sub_name = get_app_sub_name(record)
|
63
77
|
|
64
78
|
if !@loggers.key?("#{app_name}.#{sub_name}")
|
65
|
-
@loggers["#{app_name}.#{sub_name}"] = CoralogixLogger.new
|
79
|
+
@loggers["#{app_name}.#{sub_name}"] = CoralogixLogger.new privatekey, app_name, sub_name
|
66
80
|
end
|
67
81
|
|
68
82
|
return @loggers["#{app_name}.#{sub_name}"]
|
@@ -93,9 +107,19 @@ module Fluent
|
|
93
107
|
|
94
108
|
log_record = log_key_name != nil ? record.fetch(log_key_name, record) : record
|
95
109
|
log_record = is_json ? log_record.to_json : log_record
|
96
|
-
log_record = log_record.to_s.empty? ? record
|
97
|
-
|
98
|
-
|
110
|
+
log_record = log_record.to_s.empty? ? record : log_record
|
111
|
+
|
112
|
+
timestamp = record.fetch(timestamp_key_name, nil)
|
113
|
+
if(timestamp.nil?)
|
114
|
+
logger.debug log_record
|
115
|
+
else
|
116
|
+
begin
|
117
|
+
float_timestamp = DateTime.parse(timestamp.to_s).to_time.to_f * 1000
|
118
|
+
logger.debug log_record, nil, timestamp:float_timestamp
|
119
|
+
rescue Exception => e
|
120
|
+
logger.debug log_record
|
121
|
+
end
|
122
|
+
end
|
99
123
|
}
|
100
124
|
end
|
101
125
|
end
|
metadata
CHANGED
@@ -1,42 +1,36 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-coralogix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Royee Goldberg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: centralized_ruby_logger
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0.0'
|
20
17
|
- - ">="
|
21
18
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.0.
|
19
|
+
version: 0.0.12
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
|
-
- - "~>"
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '0.0'
|
30
24
|
- - ">="
|
31
25
|
- !ruby/object:Gem::Version
|
32
|
-
version: 0.0.
|
26
|
+
version: 0.0.12
|
33
27
|
description: Coralogix Fluentd plugin to send logs to Coralogix server.
|
34
28
|
email: royee@coralogix.com
|
35
29
|
executables: []
|
36
30
|
extensions: []
|
37
31
|
extra_rdoc_files: []
|
38
32
|
files:
|
39
|
-
-
|
33
|
+
- new_coralogix_out/out_coralogix.rb
|
40
34
|
homepage: http://www.coralogix.com
|
41
35
|
licenses:
|
42
36
|
- MIT
|
@@ -57,7 +51,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
57
51
|
version: '0'
|
58
52
|
requirements: []
|
59
53
|
rubyforge_project:
|
60
|
-
rubygems_version: 2.
|
54
|
+
rubygems_version: 2.7.6
|
61
55
|
signing_key:
|
62
56
|
specification_version: 4
|
63
57
|
summary: Coralogix Fluentd out plugin
|