fluent-plugin-azurestorage-gen2 0.1.0 → 0.1.1

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
  SHA1:
3
- metadata.gz: 857dcdb31e03f6564e547e0183a3bf24f06c8a0e
4
- data.tar.gz: f1f1d048e69afba0f469a1999b6786473e282092
3
+ metadata.gz: 6f15931cc13f12c4aeb6723ba2a44c604998e819
4
+ data.tar.gz: 557964c5e84e0274a840af3e18500d9197ea8cd4
5
5
  SHA512:
6
- metadata.gz: 6c87884fa508bc01f7470653b0a3b67d4a4cb02bddab03eb9071c1360f25abcf13558d1023a11be7d1277dcebf0794d4fb01ff19982a2000c2879ff335421773
7
- data.tar.gz: 1491be525cbf66dbd7240ddea5a2ba33ded91e4c4c5816d238fc4ac49a76057e05b7bc7dea881220dc32fff836239d2d485175699285041bb1330c955b103e0b
6
+ metadata.gz: 7d0e97ee7d6b1429e98f91aa72135c4f84bf4cfd8b573cc8ec747cb36fe0e65fb98bce5d02d5416db83a4946c406c93f27ede48a1ba989d25bf675771311e6cd
7
+ data.tar.gz: 6ed3f231452a94eb0e66244648be66500af2fd82577b3796df11d0cda363238b95b50cc478ae01b54d1e8deb4cdb12101151ccfecb8177f53923db97b395248b
data/README.md CHANGED
@@ -1,13 +1,15 @@
1
1
  # Azure Datalake Storage Gen2 Fluentd Output Plugin (IN PROGRESS)
2
2
 
3
3
  [![Build Status](https://travis-ci.org/oleewere/fluent-plugin-azurestorage-gen2.svg?branch=master)](https://travis-ci.org/oleewere/fluent-plugin-azurestorage-gen2)
4
- [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ [![Gem Version](https://badge.fury.io/rb/fluent-plugin-azurestorage-gen2.svg)](http://badge.fury.io/rb/fluent-plugin-azurestorage-gen2)
6
+ ![](https://ruby-gem-downloads-badge.herokuapp.com/fluent-plugin-azurestorage-gen2?extension=png)
5
7
 
6
8
  ## Requirements
7
9
 
8
10
  | fluent-plugin-azurestorage-gen2 | fluentd | ruby |
9
11
  |------------------------|---------|------|
10
- | >= 0.1.0 | >= v0.14.0 | >= 2.4 |
12
+ | >= 0.1.1 | >= v0.14.0 | >= 2.4 |
11
13
 
12
14
  ## Overview
13
15
 
@@ -22,11 +24,188 @@ $ gem install fluent-plugin-azurestorage-gen2
22
24
 
23
25
  ## Configuration
24
26
 
25
- TODO
27
+ ```
28
+ <match **>
29
+ @type azurestorage_gen2
30
+ azure_storage_account mystorageabfs
31
+ azure_container mycontainer
32
+ azure_instance_msi /subscriptions/mysubscriptionid
33
+ azure_object_key_format %{path}-%{index}.%{file_extension}
34
+ azure_oauth_refresh_interval 3600
35
+ time_slice_format %Y%m%d-%H
36
+ file_extension log
37
+ path "/cluster-logs/myfolder/${tag[1]}-#{Socket.gethostname}-%M"
38
+ auto_create_container true
39
+ <buffer tag,time>
40
+ @type file
41
+ path /var/log/fluent/azurestorage-buffer
42
+ timekey 5m
43
+ timekey_wait 0s
44
+ timekey_use_utc true
45
+ chunk_limit_size 64m
46
+ </buffer>
47
+ </match>
48
+ ```
26
49
 
27
50
  ### Configuration options
28
51
 
29
- TODO
52
+ ### azure_storage_account
53
+
54
+ Your Azure Storage Account Name. This can be got from Azure Management potal.
55
+ This parameter is required when environment variable 'AZURE_STORAGE_ACCOUNT' is not set.
56
+
57
+ ### azure_storage_access_key (not implemented yet - use msi)
58
+
59
+ Your Azure Storage Access Key(Primary or Secondary). This also can be got from Azure Management potal. Storage access key authentication is used when this parameter is provided or environment variable 'AZURE_STORAGE_ACCESS_KEY' is set.
60
+
61
+ ### azure_instance_msi
62
+
63
+ Your Azure Managed Service Identity ID. When storage key authentication is not used, the plugin uses OAuth2 to authenticate as given MSI. This authentication method only works on Azure VM. If the VM has only one MSI assigned, this parameter becomes optional and the only MSI will be used. Otherwise this parameter is required.
64
+
65
+ ### azure_oauth_refresh_interval
66
+
67
+ OAuth2 access token refreshment interval in second. Only applies when MSI authentication is used.
68
+
69
+ ### azure_container (Required)
70
+
71
+ Azure Storage Container name
72
+
73
+ ### auto_create_container
74
+
75
+ This plugin create container if not exist when you set 'auto_create_container' to true.
76
+
77
+ ### azure_object_key_format
78
+
79
+ The format of Azure Storage object keys. You can use several built-in variables:
80
+
81
+ - %{path}
82
+ - %{time_slice}
83
+ - %{index}
84
+ - %{file_extension}
85
+
86
+ to decide keys dynamically.
87
+
88
+ %{path} is exactly the value of *path* configured in the configuration file. E.g., "logs/" in the example configuration above.
89
+ %{time_slice} is the time-slice in text that are formatted with *time_slice_format*.
90
+ %{index} is the sequential number starts from 0, increments when multiple files are uploaded to Azure Storage in the same time slice.
91
+ %{file_extention} is always "gz" for now.
92
+
93
+ The default format is "%{path}%{time_slice}_%{index}.%{file_extension}".
94
+
95
+ For instance, using the example configuration above, actual object keys on Azure Storage will be something like:
96
+
97
+ ```
98
+ "logs/20130111-22_0.gz"
99
+ "logs/20130111-23_0.gz"
100
+ "logs/20130111-23_1.gz"
101
+ "logs/20130112-00_0.gz"
102
+ ```
103
+
104
+ With the configuration:
105
+
106
+ ```
107
+ azure_object_key_format %{path}/events/ts=%{time_slice}/events_%{index}.%{file_extension}
108
+ path log
109
+ time_slice_format %Y%m%d-%H
110
+ ```
111
+
112
+ You get:
113
+
114
+ ```
115
+ "log/events/ts=20130111-22/events_0.gz"
116
+ "log/events/ts=20130111-23/events_0.gz"
117
+ "log/events/ts=20130111-23/events_1.gz"
118
+ "log/events/ts=20130112-00/events_0.gz"
119
+ ```
120
+
121
+ The [fluent-mixin-config-placeholders](https://github.com/tagomoris/fluent-mixin-config-placeholders) mixin is also incorporated, so additional variables such as %{hostname}, %{uuid}, etc. can be used in the azure_object_key_format. This could prove useful in preventing filename conflicts when writing from multiple servers.
122
+
123
+ ```
124
+ azure_object_key_format %{path}/events/ts=%{time_slice}/events_%{index}-%{hostname}.%{file_extension}
125
+ ```
126
+
127
+ ### format
128
+
129
+ Change one line format in the Azure Storage object. Supported formats are 'out_file', 'json', 'ltsv' and 'single_value'.
130
+
131
+ - out_file (default)
132
+
133
+ ```
134
+ time\ttag\t{..json1..}
135
+ time\ttag\t{..json2..}
136
+ ...
137
+ ```
138
+
139
+ - json
140
+
141
+ ```
142
+ {..json1..}
143
+ {..json2..}
144
+ ...
145
+ ```
146
+
147
+ At this format, "time" and "tag" are omitted.
148
+ But you can set these information to the record by setting "include_tag_key" / "tag_key" and "include_time_key" / "time_key" option.
149
+ If you set following configuration in AzureStorage output:
150
+
151
+ ```
152
+ format json
153
+ include_time_key true
154
+ time_key log_time # default is time
155
+ ```
156
+
157
+ then the record has log_time field.
158
+
159
+ ```
160
+ {"log_time":"time string",...}
161
+ ```
162
+
163
+ - ltsv
164
+
165
+ ```
166
+ key1:value1\tkey2:value2
167
+ key1:value1\tkey2:value2
168
+ ...
169
+ ```
170
+
171
+ "ltsv" format also accepts "include_xxx" related options. See "json" section.
172
+
173
+ - single_value
174
+
175
+ Use specified value instead of entire recode. If you get '{"message":"my log"}', then contents are
176
+
177
+ ```
178
+ my log1
179
+ my log2
180
+ ...
181
+ ```
182
+
183
+ You can change key name by "message_key" option.
184
+
185
+ ### path
186
+
187
+ path prefix of the files on Azure Storage. Default is "" (no prefix).
188
+
189
+ ### buffer_path (required)
190
+
191
+ path prefix of the files to buffer logs.
192
+
193
+ ### time_slice_format
194
+
195
+ Format of the time used as the file name. Default is '%Y%m%d'. Use '%Y%m%d%H' to split files hourly.
196
+
197
+ ### time_slice_wait
198
+
199
+ The time to wait old logs. Default is 10 minutes.
200
+
201
+ ### utc
202
+
203
+ Use UTC instead of local time.
204
+
205
+ ## TODOs
206
+
207
+ - add storage key support
208
+ - add compression (if append is not used)
30
209
 
31
210
  ## Contributing
32
211
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -17,8 +17,6 @@ Gem::Specification.new do |gem|
17
17
  gem.require_paths = ['lib']
18
18
 
19
19
  gem.add_runtime_dependency 'fluentd', ['>= 1.0', '< 2']
20
- gem.add_runtime_dependency 'azure-storage-common', '~> 1.1', '>= 1.1.0'
21
- gem.add_runtime_dependency 'azure-storage-blob', '~> 1.1', '>= 1.1.0'
22
20
  gem.add_runtime_dependency 'uuidtools', '~> 2.1', '>= 2.1.5'
23
21
  gem.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
24
22
  gem.add_runtime_dependency 'json', '~> 2.1', '>= 2.1.0'
@@ -235,12 +235,12 @@ module Fluent::Plugin
235
235
  def create_blob(blob_path)
236
236
  headers = {:"x-ms-version" => ABFS_API_VERSION, :"Authorization" => "Bearer #{@azure_access_token}",:"Content-Length" => "0", :"Content-Type" => "application/json"}
237
237
  params = {:resource => "file", :recursive => "false"}
238
- request = Typhoeus::Request.new("https://#{azure_storage_account}#{URL_DOMAIN_SUFFIX}/#{@azure_container}/testprefix#{blob_path}", :method => :put, :params => params, :headers=> headers)
238
+ request = Typhoeus::Request.new("https://#{azure_storage_account}#{URL_DOMAIN_SUFFIX}/#{@azure_container}#{blob_path}", :method => :put, :params => params, :headers=> headers)
239
239
  request.on_complete do |response|
240
240
  if response.success?
241
241
  log.debug "azurestorage_gen2: Blob '#{blob_path}' has been created, response code: #{response.code}"
242
242
  elsif response.timed_out?
243
- raise Fluent::UnrecoverableError, "Creating blob '#{@blob_path}' request timed out."
243
+ raise Fluent::UnrecoverableError, "Creating blob '#{blob_path}' request timed out."
244
244
  elsif response.code == 409
245
245
  log.debug "azurestorage_gen2: Blob already exists: #{blob_path}"
246
246
  else
@@ -260,7 +260,7 @@ module Fluent::Plugin
260
260
  if response.success?
261
261
  log.debug "azurestorage_gen2: Blob '#{blob_path}' has been appended, response code: #{response.code}"
262
262
  elsif response.timed_out?
263
- raise Fluent::UnrecoverableError, "Appending blob #{@blob_path}' request timed out."
263
+ raise Fluent::UnrecoverableError, "Appending blob #{blob_path}' request timed out."
264
264
  elsif response.code == 404
265
265
  raise AppendBlobResponseError.new("Blob '#{blob_path}' has not found. Error code: #{response.code}", 404)
266
266
  elsif response.code == 409
@@ -282,7 +282,7 @@ module Fluent::Plugin
282
282
  if response.success?
283
283
  log.debug "azurestorage_gen2: Blob '#{blob_path}' flush was successful, response code: #{response.code}"
284
284
  elsif response.timed_out?
285
- raise Fluent::UnrecoverableError, "Bloub '#{@blob_path}' flush request timed out."
285
+ raise Fluent::UnrecoverableError, "Bloub '#{blob_path}' flush request timed out."
286
286
  else
287
287
  raise Fluent::UnrecoverableError, "Blob flush request failed - code: #{response.code}, body: #{response.body}"
288
288
  end
@@ -301,12 +301,12 @@ module Fluent::Plugin
301
301
  log.debug "azurestorage_gen2: Get blob properties for '#{blob_path}', response headers: #{response.headers}"
302
302
  content_length = response.headers['Content-Length'].to_i
303
303
  elsif response.timed_out?
304
- raise Fluent::UnrecoverableError, "Get blob properties '#{@blob_path}' request timed out."
304
+ raise Fluent::UnrecoverableError, "Get blob properties '#{blob_path}' request timed out."
305
305
  elsif response.code == 404
306
- log.debug "azurestorage_gen2: Blob '#{@blob_path}' does not exist. Creating it if needed..."
306
+ log.debug "azurestorage_gen2: Blob '#{blob_path}' does not exist. Creating it if needed..."
307
307
  content_length = 0
308
308
  else
309
- raise Fluent::UnrecoverableError, "Get blob properties '#{@blob_path}' request failed - code: #{response.code}, body: #{response.body}"
309
+ raise Fluent::UnrecoverableError, "Get blob properties '#{blob_path}' request failed - code: #{response.code}, body: #{response.body}"
310
310
  end
311
311
  end
312
312
  request.run
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-azurestorage-gen2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oliver Szabo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-15 00:00:00.000000000 Z
11
+ date: 2019-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -30,46 +30,6 @@ dependencies:
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '2'
33
- - !ruby/object:Gem::Dependency
34
- name: azure-storage-common
35
- requirement: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: '1.1'
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- version: 1.1.0
43
- type: :runtime
44
- prerelease: false
45
- version_requirements: !ruby/object:Gem::Requirement
46
- requirements:
47
- - - "~>"
48
- - !ruby/object:Gem::Version
49
- version: '1.1'
50
- - - ">="
51
- - !ruby/object:Gem::Version
52
- version: 1.1.0
53
- - !ruby/object:Gem::Dependency
54
- name: azure-storage-blob
55
- requirement: !ruby/object:Gem::Requirement
56
- requirements:
57
- - - "~>"
58
- - !ruby/object:Gem::Version
59
- version: '1.1'
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- version: 1.1.0
63
- type: :runtime
64
- prerelease: false
65
- version_requirements: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - "~>"
68
- - !ruby/object:Gem::Version
69
- version: '1.1'
70
- - - ">="
71
- - !ruby/object:Gem::Version
72
- version: 1.1.0
73
33
  - !ruby/object:Gem::Dependency
74
34
  name: uuidtools
75
35
  requirement: !ruby/object:Gem::Requirement