This repository was archived by the owner on Feb 2, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +66
-3
lines changed Expand file tree Collapse file tree 3 files changed +66
-3
lines changed Original file line number Diff line number Diff line change
1
+ FROM ruby:latest
2
+
3
+ WORKDIR /plugin
4
+
5
+ ADD . /plugin
6
+
7
+ RUN gem install bundler && \
8
+ gem install fluentd --no-doc && \
9
+ fluent-gem build fluent-plugin-azure-storage-append-blob.gemspec && \
10
+ fluent-gem install fluent-plugin-azure-storage-append-blob-*.gem
11
+
12
+ RUN echo "<source>\n \
13
+ @type sample\n \
14
+ sample {\" hello\" :\" world\" }\n \
15
+ tag pattern\n \
16
+ </source>\n \
17
+ <match pattern>\n \
18
+ @type azure-storage-append-blob\n \
19
+ azure_storage_account \" #{ENV['STORAGE_ACCOUNT']}\"\n \
20
+ azure_storage_access_key \" #{ENV['STORAGE_ACCESS_KEY']}\"\n \
21
+ azure_storage_sas_token \" #{ENV['STORAGE_SAS_TOKEN']}\"\n \
22
+ azure_container fluentd\n \
23
+ auto_create_container true\n \
24
+ path logs/\n \
25
+ azure_object_key_format %{path}%{time_slice}_%{index}.log\n \
26
+ time_slice_format %Y%m%d-%H\n \
27
+ <buffer tag,time>\n \
28
+ @type file\n \
29
+ path /var/log/fluent/azurestorageappendblob\n \
30
+ timekey 120 # 2 minutes\n \
31
+ timekey_wait 60\n \
32
+ timekey_use_utc true # use utc\n \
33
+ </buffer>\n \
34
+ </match>" > /plugin/fluent.conf
35
+
36
+ ENTRYPOINT ["fluentd" , "-c" , "fluent.conf" ]
Original file line number Diff line number Diff line change @@ -128,6 +128,33 @@ Format of the time used in the file name. Default is '%Y%m%d'. Use '%Y%m%d%H' to
128
128
bundle install
129
129
bundle exec rake test
130
130
131
+
132
+ ### Test Fluentd
133
+
134
+ 1 . Create Storage Account and VM with enabled MSI
135
+ 2 . Setup Docker ang Git
136
+ 3 . SSH into VM
137
+ 4 . Download this repo
138
+ ```
139
+ git clone https://github.com/microsoft/fluent-plugin-azure-storage-append-blob.git
140
+ cd fluent-plugin-azure-storage-append-blob
141
+ ```
142
+ 5 . Build Docker image
143
+ ` docker build -t fluent . `
144
+ 6 . Run Docker image with different set of parameters:
145
+
146
+ 1 . ` STORAGE_ACCOUNT ` : required, name of your storage account
147
+ 2 . ` STORAGE_ACCESS_KEY ` : storage account access key
148
+ 3 . ` STORAGE_SAS_TOKEN ` : storage sas token with enough permissions for the plugin
149
+
150
+ You need to specify ` STORAGE_ACCOUNT ` and one of auth ways. If you run it from VM with MSI,
151
+ just ` STORAGE_ACCOUNT ` is required. Keep in mind, there is no way to refresh MSI Token, so
152
+ ensure you setup proper permissions first.
153
+
154
+ ``` bash
155
+ docker run -it -e STORAGE_ACCOUNT=< storage> -e STORAGE_ACCESS_KEY=< key> fluent
156
+ ```
157
+
131
158
# # Contributing
132
159
133
160
This project welcomes contributions and suggestions. Most contributions require you to agree to a
Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ def configure(conf)
63
63
64
64
raise ConfigError , 'azure_container needs to be specified' if @azure_container . nil?
65
65
66
- if @azure_storage_access_key . nil? && @azure_storage_sas_token . nil?
66
+ if ( @azure_storage_access_key . nil? || @azure_storage_access_key . empty? ) && ( @azure_storage_sas_token . nil? || @azure_storage_sas_token . empty? )
67
67
log . info 'Using MSI since neither azure_storage_access_key nor azure_storage_sas_token was provided.'
68
68
@use_msi = true
69
69
end
@@ -105,9 +105,9 @@ def start
105
105
else
106
106
@bs_params = { storage_account_name : @azure_storage_account }
107
107
108
- if !@azure_storage_access_key . nil?
108
+ if !@azure_storage_access_key . nil? && ! @azure_storage_access_key . empty?
109
109
@bs_params . merge! ( { storage_access_key : @azure_storage_access_key } )
110
- elsif !@azure_storage_sas_token . nil?
110
+ elsif !@azure_storage_sas_token . nil? && ! @azure_storage_sas_token . empty?
111
111
@bs_params . merge! ( { storage_sas_token : @azure_storage_sas_token } )
112
112
end
113
113
You can’t perform that action at this time.
0 commit comments