fluent-plugin-oci-logging 1.0.2 → 1.0.12
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/logging_setup.rb +4 -0
- data/lib/fluent/plugin/logging_utils.rb +2 -2
- data/lib/fluent/plugin/os.rb +22 -0
- data/lib/fluent/plugin/out_oci_logging.rb +17 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8da08ff601b50140201c74c6b8fc5a15da8f25288315ceee1b42382e5a051d55
|
4
|
+
data.tar.gz: 37e3601768a8b5eee329b72775683a18afe50c90f9c2741d3a0aa2d6ae4d3f93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0293f60930bf42b4fed3411ba74dd9389e8d8138d9ee512ae09c8b00c55e57b96c8a3c0e9c2b1fc59ff83e8daff49239d5ba1f592a10721a2c350db624ced0a9'
|
7
|
+
data.tar.gz: 433fe08996fcbd80888fdb476acb5d904eda926f08d5cfd98e12bf454fd337ae87b1efa3b991ee9eec2f921e6e0f866322d8133d3eceec696c9e7f34315d8813
|
@@ -27,6 +27,7 @@ module Fluent
|
|
27
27
|
PUBLIC_DEFAULT_LINUX_CA_PATH = '/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem'
|
28
28
|
PUBLIC_DEFAULT_WINDOWS_CA_PATH = 'C:\\oracle_unified_agent\\unified-monitoring-agent\\embedded\\ssl\\certs\\cacert.pem'
|
29
29
|
PUBLIC_DEFAULT_UBUNTU_CA_PATH = '/etc/ssl/certs/ca-certificates.crt'
|
30
|
+
PUBLIC_DEFAULT_DEBIAN_CA_PATH = PUBLIC_DEFAULT_UBUNTU_CA_PATH
|
30
31
|
|
31
32
|
def logger
|
32
33
|
@log ||= OS.windows? ? Logger.new(WINDOWS_UPLOADER_OUTPUT_LOG) : Logger.new($stdout)
|
@@ -219,10 +220,13 @@ module Fluent
|
|
219
220
|
# Since r1 overlay has a different default make sure to update this
|
220
221
|
#
|
221
222
|
def set_default_ca_file
|
223
|
+
@ca_file = PUBLIC_DEFAULT_LINUX_CA_PATH if @ca_file.nil?
|
222
224
|
if OS.windows?
|
223
225
|
@ca_file = @ca_file == PUBLIC_DEFAULT_LINUX_CA_PATH ? PUBLIC_DEFAULT_WINDOWS_CA_PATH : @ca_file
|
224
226
|
elsif OS.ubuntu?
|
225
227
|
@ca_file = @ca_file == PUBLIC_DEFAULT_LINUX_CA_PATH ? PUBLIC_DEFAULT_UBUNTU_CA_PATH : @ca_file
|
228
|
+
elsif OS.debian?
|
229
|
+
@ca_file = @ca_file == PUBLIC_DEFAULT_LINUX_CA_PATH ? PUBLIC_DEFAULT_DEBIAN_CA_PATH : @ca_file
|
226
230
|
else
|
227
231
|
@ca_file = @region == 'r1' && @ca_file == PUBLIC_DEFAULT_LINUX_CA_PATH ? R1_CA_PATH : @ca_file
|
228
232
|
end
|
@@ -43,7 +43,7 @@ module Fluent
|
|
43
43
|
|
44
44
|
# create lumberjack request records
|
45
45
|
logentry = ::OCI::Loggingingestion::Models::LogEntry.new
|
46
|
-
logentry.time = Time.at(time).strftime('%FT%T.%LZ')
|
46
|
+
logentry.time = Time.at(time).utc.strftime('%FT%T.%LZ')
|
47
47
|
begin
|
48
48
|
logentry.data = content.to_json
|
49
49
|
rescue StandardError
|
@@ -67,7 +67,7 @@ module Fluent
|
|
67
67
|
log_entry_batch.source = @hostname
|
68
68
|
log_entry_batch.type = PUBLIC_LOGGING_PREFIX + tagpath
|
69
69
|
log_entry_batch.subject = sourceidentifier
|
70
|
-
log_entry_batch.defaultlogentrytime = Time.at(time).strftime('%FT%T.%LZ')
|
70
|
+
log_entry_batch.defaultlogentrytime = Time.at(time).utc.strftime('%FT%T.%LZ')
|
71
71
|
log_entry_batch.entries = []
|
72
72
|
|
73
73
|
log_batches_map[requestkey] = log_entry_batch
|
data/lib/fluent/plugin/os.rb
CHANGED
@@ -27,6 +27,10 @@ module OS
|
|
27
27
|
linux? and os_name_ubuntu?
|
28
28
|
end
|
29
29
|
|
30
|
+
def self.debian?
|
31
|
+
linux? and os_name_debian?
|
32
|
+
end
|
33
|
+
|
30
34
|
def self.os_name_ubuntu?
|
31
35
|
os_name = 'not_found'
|
32
36
|
file_name = '/etc/os-release'
|
@@ -45,4 +49,22 @@ module OS
|
|
45
49
|
false
|
46
50
|
end
|
47
51
|
|
52
|
+
def self.os_name_debian?
|
53
|
+
os_name = 'not_found'
|
54
|
+
file_name = '/etc/os-release'
|
55
|
+
if File.exists?(file_name)
|
56
|
+
File.foreach(file_name).each do |line|
|
57
|
+
if line.start_with?('ID=')
|
58
|
+
os_name = line.split('=')[1].strip
|
59
|
+
end
|
60
|
+
end
|
61
|
+
else
|
62
|
+
logger.info('Unknown linux distribution detected')
|
63
|
+
end
|
64
|
+
os_name == 'debian' ? true : false
|
65
|
+
rescue StandardError => e
|
66
|
+
log.error "Unable to detect ubuntu platform due to: #{e.message}"
|
67
|
+
false
|
68
|
+
end
|
69
|
+
|
48
70
|
end
|
@@ -42,6 +42,8 @@ module Fluent
|
|
42
42
|
|
43
43
|
helpers :event_emitter
|
44
44
|
|
45
|
+
PAYLOAD_SIZE = 9*1024*1024 #restricting payload size at 9MB
|
46
|
+
|
45
47
|
def configure(conf)
|
46
48
|
super
|
47
49
|
log.debug 'determining the signer type'
|
@@ -73,19 +75,30 @@ module Fluent
|
|
73
75
|
log.debug "writing chunk metadata #{chunk.metadata}", \
|
74
76
|
dump_unique_id_hex(chunk.unique_id)
|
75
77
|
log_batches_map = {}
|
76
|
-
|
77
|
-
|
78
|
+
# For standard chunk format (without #format() method)
|
79
|
+
size = 0
|
78
80
|
chunk.each do |time, record|
|
79
81
|
begin
|
80
82
|
tag = get_modified_tag(chunk.metadata.tag)
|
81
83
|
source_identifier = record.key?('tailed_path') ? record['tailed_path'] : ''
|
84
|
+
content = flatten_hash(record)
|
85
|
+
size += content.to_json.bytesize
|
82
86
|
build_request(time, record, tag, log_batches_map, source_identifier)
|
87
|
+
if size >= PAYLOAD_SIZE
|
88
|
+
log.info "Exceeding payload size. Size : #{size}"
|
89
|
+
send_requests(log_batches_map)
|
90
|
+
log_batches_map = {}
|
91
|
+
size = 0
|
92
|
+
end
|
83
93
|
rescue StandardError => e
|
84
94
|
log.error(e.full_message)
|
85
95
|
end
|
86
96
|
end
|
87
|
-
|
88
|
-
|
97
|
+
# flushing data to LJ
|
98
|
+
unless log_batches_map.empty?
|
99
|
+
log.info "Payload size : #{size}"
|
100
|
+
send_requests(log_batches_map)
|
101
|
+
end
|
89
102
|
end
|
90
103
|
end
|
91
104
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-oci-logging
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OCI Observability Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -186,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
186
186
|
- !ruby/object:Gem::Version
|
187
187
|
version: '0'
|
188
188
|
requirements: []
|
189
|
-
rubygems_version: 3.
|
189
|
+
rubygems_version: 3.0.3
|
190
190
|
signing_key:
|
191
191
|
specification_version: 4
|
192
192
|
summary: OCI Fluentd Logging output plugin following Unified Schema
|