fluent-plugin-openstack 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 +4 -4
- data/VERSION +1 -1
- data/lib/fluent/plugin/out_swift.rb +6 -24
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6245929676b87a8e8e60c7e0ca5341d21e70e9410278637c5f53de54e2083eb1
|
4
|
+
data.tar.gz: fbc7a5969c3be782355e8b6bc648b6caebe676601c39d48a1350dd60481bc911
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b1880f4051f4f863a4da8c9b0cd0cd1c0d50e19dd3fad747930a011d7009205cc22cf5aea2e5c1ef55b0d406231a435dd42c6060d91d94e7383f9601477f423
|
7
|
+
data.tar.gz: 556fb85b3ec2d36060ff6678a5cb15110d8a6d99e4e4b81d7ff7629ddf3f742eb753400cc0f7ae1d591ace1583599a4fdc71de67c7e9c59f40561189fc937617
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.5
|
@@ -36,7 +36,7 @@ module Fluent::Plugin
|
|
36
36
|
desc 'If false, the certificate of endpoint will not be verified'
|
37
37
|
config_param :ssl_verify, :bool, default: true
|
38
38
|
desc 'The format of Swift object keys'
|
39
|
-
config_param :swift_object_key_format, :string, default: '%{path}/%
|
39
|
+
config_param :swift_object_key_format, :string, default: '%{path}/%Y%m%d_%H%M_%{index}.%{file_extension}'
|
40
40
|
desc 'Create Swift container if it does not exists'
|
41
41
|
config_param :auto_create_container, :bool, default: true
|
42
42
|
config_param :check_apikey_on_start, :bool, default: true
|
@@ -105,13 +105,7 @@ module Fluent::Plugin
|
|
105
105
|
|
106
106
|
self.formatter = formatter_create
|
107
107
|
self.swift_object_key_format = configure_swift_object_key_format
|
108
|
-
# For backward compatibility
|
109
|
-
# TODO: Remove time_slice_format when end of support compat_parameters
|
110
108
|
self.values_for_swift_object_chunk = {}
|
111
|
-
|
112
|
-
$log.warn("timekey_zone: #{timekey_zone}")
|
113
|
-
|
114
|
-
self.time_slice_with_tz = Fluent::Timezone.formatter(timekey_zone, config['time_slice_format'])
|
115
109
|
end
|
116
110
|
|
117
111
|
def multi_workers_ready?
|
@@ -130,7 +124,7 @@ module Fluent::Plugin
|
|
130
124
|
openstack_region: auth_region
|
131
125
|
)
|
132
126
|
rescue StandardError => e
|
133
|
-
raise "Can't call Swift API. Please check your ENV OS_*, your credentials or auth_url configuration. Error: #{e.inspect}"
|
127
|
+
raise "Can't call Swift API. Please check your ENV OS_*, your credentials or `auth_url` configuration. Error: #{e.inspect}"
|
134
128
|
end
|
135
129
|
storage.change_account(swift_account) if swift_account
|
136
130
|
check_container
|
@@ -138,26 +132,15 @@ module Fluent::Plugin
|
|
138
132
|
end
|
139
133
|
|
140
134
|
def format(tag, time, record)
|
141
|
-
|
142
|
-
formatter.format(tag, time,
|
135
|
+
new_record = inject_values_to_record(tag, time, record)
|
136
|
+
formatter.format(tag, time, new_record)
|
143
137
|
end
|
144
138
|
|
145
139
|
def write(chunk)
|
146
140
|
i = 0
|
147
141
|
metadata = chunk.metadata
|
148
142
|
previous_path = nil
|
149
|
-
time_slice = if metadata.timekey.nil?
|
150
|
-
''
|
151
|
-
else
|
152
|
-
$log.warn("timekey: #{metadata.timekey}")
|
153
|
-
$log.warn("metadata: #{metadata}")
|
154
|
-
time_slice_with_tz.call(metadata.timekey)
|
155
|
-
end
|
156
|
-
|
157
143
|
begin
|
158
|
-
$log.warn("time_slice: #{time_slice}")
|
159
|
-
$log.warn("index_format: #{index_format}")
|
160
|
-
|
161
144
|
values_for_swift_object_chunk[chunk.unique_id] ||= {
|
162
145
|
'%{hex_random}' => hex_random(chunk: chunk)
|
163
146
|
}
|
@@ -167,7 +150,6 @@ module Fluent::Plugin
|
|
167
150
|
}
|
168
151
|
# rubocop:disable Style/FormatString
|
169
152
|
values_for_swift_object_key_post = {
|
170
|
-
'%{time_slice}' => time_slice,
|
171
153
|
'%{index}' => sprintf(index_format, i)
|
172
154
|
}.merge!(values_for_swift_object_chunk[chunk.unique_id])
|
173
155
|
# rubocop:enable Style/FormatString
|
@@ -191,6 +173,7 @@ module Fluent::Plugin
|
|
191
173
|
swift_path = swift_path.gsub(/%{[^}]+}/, values_for_swift_object_key_post)
|
192
174
|
|
193
175
|
$log.warn("swift_path 3: #{swift_path}")
|
176
|
+
|
194
177
|
if i.positive? && (swift_path == previous_path)
|
195
178
|
if overwrite
|
196
179
|
log.warn("File: #{swift_path} already exists, but will overwrite!")
|
@@ -256,8 +239,7 @@ module Fluent::Plugin
|
|
256
239
|
:ext,
|
257
240
|
:mime_type,
|
258
241
|
:formatter,
|
259
|
-
:values_for_swift_object_chunk
|
260
|
-
:time_slice_with_tz
|
242
|
+
:values_for_swift_object_chunk
|
261
243
|
|
262
244
|
def hex_random(chunk:)
|
263
245
|
unique_hex = Fluent::UniqueId.hex(chunk.unique_id)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-openstack
|
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
|
- brissenden
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-09-
|
11
|
+
date: 2019-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|