logstash-input-azure_blob_storage 0.11.1 → 0.11.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/logstash/inputs/azure_blob_storage.rb +24 -14
- data/logstash-input-azure_blob_storage.gemspec +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b721a6aa74f4e9df285f62f47efa42112e540d9836391b31e74daf6544e1087d
|
4
|
+
data.tar.gz: 5d22a077d53698807a51dde75ac6c7deb273f0fe68d7ea05a46651b5e0c9e577
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb35924d7f18579977fa8257a722aa136ca3d9d6a48cb1aecc3aa9f768a4d4b682d5a86c455b634b19d40c6dad9359a54d5b4906ef6952fff8ebc7166c90a808
|
7
|
+
data.tar.gz: abddf838e31d981dc2da2b84bf825cb7981c610da1331a7aba1cf13f2de6e9ce7c644649f586ad6ef9c2630888900f3f8620fec7b47cddbc6b91c927e44c9b72
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
## 0.11.1
|
2
|
+
- copied changes from irnc fork (danke!)
|
3
|
+
- Fixed trying to load the registry, three time is the charm
|
4
|
+
- logs are less chatty, changed info to debug
|
5
|
+
|
1
6
|
## 0.11.0
|
2
7
|
- Implemented start_fresh to skip all previous logs and start monitoring new entries
|
3
8
|
- Fixed the timer, now properly sleep the interval and check again
|
@@ -55,6 +55,9 @@ config :registry_create_policy, :validate => ['resume','start_over','start_fresh
|
|
55
55
|
# Z00000000000000000000000000000000 2 ]}
|
56
56
|
config :interval, :validate => :number, :default => 60
|
57
57
|
|
58
|
+
# debug_until will for a maximum amount of processed messages shows 3 types of log printouts including processed filenames. This is a lightweight alternative to switching the loglevel from info to debug or even trace
|
59
|
+
config :debug_until, :validate => :number, :default => 0, :required => false
|
60
|
+
|
58
61
|
# WAD IIS Grok Pattern
|
59
62
|
#config :grokpattern, :validate => :string, :required => false, :default => '%{TIMESTAMP_ISO8601:log_timestamp} %{NOTSPACE:instanceId} %{NOTSPACE:instanceId2} %{IPORHOST:ServerIP} %{WORD:httpMethod} %{URIPATH:requestUri} %{NOTSPACE:requestQuery} %{NUMBER:port} %{NOTSPACE:username} %{IPORHOST:clientIP} %{NOTSPACE:httpVersion} %{NOTSPACE:userAgent} %{NOTSPACE:cookie} %{NOTSPACE:referer} %{NOTSPACE:host} %{NUMBER:httpStatus} %{NUMBER:subresponse} %{NUMBER:win32response} %{NUMBER:sentBytes:int} %{NUMBER:receivedBytes:int} %{NUMBER:timeTaken:int}'
|
60
63
|
|
@@ -76,6 +79,12 @@ config :file_tail, :validate => :string, :required => false, :default => ']}'
|
|
76
79
|
# For NSGFLOWLOGS a path starts with "resourceId=/", but this would only be needed to exclude other files that may be written in the same container.
|
77
80
|
config :prefix, :validate => :string, :required => false
|
78
81
|
|
82
|
+
config :path_filters, :validate => :array, :default => ['**/*'], :required => false
|
83
|
+
|
84
|
+
# TODO: Other feature requests
|
85
|
+
# show file path in logger
|
86
|
+
# add filepath as part of log message
|
87
|
+
# option to keep registry on local disk
|
79
88
|
|
80
89
|
|
81
90
|
public
|
@@ -119,14 +128,14 @@ def register
|
|
119
128
|
@registry = Hash.new
|
120
129
|
if registry_create_policy == "resume"
|
121
130
|
@logger.info(@pipe_id+" resuming from registry")
|
122
|
-
for counter in
|
131
|
+
for counter in 1..3
|
123
132
|
begin
|
124
133
|
@registry = Marshal.load(@blob_client.get_blob(container, registry_path)[1])
|
125
134
|
#[0] headers [1] responsebody
|
126
135
|
rescue Exception => e
|
127
136
|
@logger.error(@pipe_id+" caught: #{e.message}")
|
128
137
|
@registry.clear
|
129
|
-
@logger.error(@pipe_id+" loading registry failed
|
138
|
+
@logger.error(@pipe_id+" loading registry failed for attempt #{counter} of 3")
|
130
139
|
end
|
131
140
|
end
|
132
141
|
end
|
@@ -182,6 +191,7 @@ def run(queue)
|
|
182
191
|
off = 0
|
183
192
|
end
|
184
193
|
newreg.store(name, { :offset => off, :length => file[:length] })
|
194
|
+
if (@debug_until > @processed) then @logger.info("2: adding offsets: #{name} #{off} #{file[:length]}") end
|
185
195
|
end
|
186
196
|
|
187
197
|
# Worklist is the subset of files where the already read offset is smaller than the file size
|
@@ -190,14 +200,14 @@ def run(queue)
|
|
190
200
|
# This would be ideal for threading since it's IO intensive, would be nice with a ruby native ThreadPool
|
191
201
|
worklist.each do |name, file|
|
192
202
|
#res = resource(name)
|
193
|
-
@logger.
|
203
|
+
if (@debug_until > @processed) then @logger.info("3: processing #{name} from #{file[:offset]} to #{file[:length]}") end
|
194
204
|
size = 0
|
195
205
|
if file[:offset] == 0
|
196
206
|
chunk = full_read(name)
|
197
207
|
size=chunk.size
|
198
208
|
else
|
199
209
|
chunk = partial_read_json(name, file[:offset], file[:length])
|
200
|
-
@logger.
|
210
|
+
@logger.info(@pipe_id+" partial file #{name} from #{file[:offset]} to #{file[:length]}")
|
201
211
|
end
|
202
212
|
if logtype == "nsgflowlog" && @is_json
|
203
213
|
res = resource(name)
|
@@ -325,28 +335,28 @@ end
|
|
325
335
|
def list_blobs(fill)
|
326
336
|
files = Hash.new
|
327
337
|
nextMarker = nil
|
328
|
-
counter
|
329
|
-
loop do
|
338
|
+
for counter in 1..3
|
330
339
|
begin
|
331
|
-
if (counter > 10)
|
332
|
-
@logger.error(@pipe_id+" lets try again for the 10th time, why don't faraday and azure storage accounts not play nice together? it has something to do with follow_redirect and a missing authorization header?")
|
333
|
-
end
|
334
340
|
blobs = @blob_client.list_blobs(container, { marker: nextMarker, prefix: @prefix})
|
335
341
|
blobs.each do |blob|
|
336
|
-
|
337
|
-
|
342
|
+
# FNM_PATHNAME is required so that "**/test" can match "test" at the root folder
|
343
|
+
# FNM_EXTGLOB allows you to use "test{a,b,c}" to match either "testa", "testb" or "testc" (closer to shell behavior)
|
344
|
+
unless blob.name == registry_path
|
345
|
+
if @path_filters.any? {|path| File.fnmatch?(path, blob.name, File::FNM_PATHNAME | File::FNM_EXTGLOB)}
|
338
346
|
length = blob.properties[:content_length].to_i
|
339
|
-
|
347
|
+
offset = 0
|
340
348
|
if fill
|
341
349
|
offset = length
|
342
|
-
|
350
|
+
end
|
343
351
|
files.store(blob.name, { :offset => offset, :length => length })
|
352
|
+
if (@debug_until > @processed) then @logger.info("1: list_blobs #{blob.name} #{offset} #{length}") end
|
344
353
|
end
|
354
|
+
end
|
345
355
|
end
|
346
356
|
nextMarker = blobs.continuation_token
|
347
357
|
break unless nextMarker && !nextMarker.empty?
|
348
358
|
rescue Exception => e
|
349
|
-
@logger.error(@pipe_id+" caught: #{e.message}")
|
359
|
+
@logger.error(@pipe_id+" caught: #{e.message} for attempt #{counter} of 3")
|
350
360
|
counter += 1
|
351
361
|
end
|
352
362
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-input-azure_blob_storage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Geertsma
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -112,7 +112,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
112
|
- !ruby/object:Gem::Version
|
113
113
|
version: '0'
|
114
114
|
requirements: []
|
115
|
-
|
115
|
+
rubyforge_project:
|
116
|
+
rubygems_version: 2.7.9
|
116
117
|
signing_key:
|
117
118
|
specification_version: 4
|
118
119
|
summary: This logstash plugin reads and parses data from Azure Storage Blobs.
|