logstash-input-azureblob 0.9.4 → 0.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile +0 -1
- data/README.md +41 -91
- data/lib/logstash/inputs/azureblob.rb +96 -96
- data/logstash-input-azureblob.gemspec +6 -6
- metadata +25 -32
- data/Rakefile +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fd5968bbd7056e36b008e65b85225fda1b2caf8
|
4
|
+
data.tar.gz: a67d26ffa67746d41857bf23bbecea73625a1677
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a5266260e3188d95c2b9cc1ac7f2dba3cfc4627d69d3469d10c2db263b8e4795837fc52208f11b4422eb4e86ebdb4f2a2e170ba0a89ebd583551aed63cd39a6
|
7
|
+
data.tar.gz: b050d8e392fa27827335c59a0a12de830bfe624b6d147ed1cfb67cb85279176674c345cfa9eac4dd795bdd9aadb0e17f05f090eb61600779aa75b1a17952848f
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,91 +1,41 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
bundle install
|
43
|
-
```
|
44
|
-
|
45
|
-
- Run tests
|
46
|
-
|
47
|
-
```sh
|
48
|
-
bundle exec rspec
|
49
|
-
```
|
50
|
-
|
51
|
-
### 2. Running your unpublished Plugin in Logstash
|
52
|
-
|
53
|
-
#### 2.1 Run in a local Logstash clone
|
54
|
-
|
55
|
-
- Edit Logstash `Gemfile` and add the local plugin path, for example:
|
56
|
-
```ruby
|
57
|
-
gem "logstash-filter-awesome", :path => "/your/local/logstash-filter-awesome"
|
58
|
-
```
|
59
|
-
- Install plugin
|
60
|
-
```sh
|
61
|
-
bin/plugin install --no-verify
|
62
|
-
```
|
63
|
-
- Run Logstash with your plugin
|
64
|
-
```sh
|
65
|
-
bin/logstash -e 'filter {awesome {}}'
|
66
|
-
```
|
67
|
-
At this point any modifications to the plugin code will be applied to this local Logstash setup. After modifying the plugin, simply rerun Logstash.
|
68
|
-
|
69
|
-
#### 2.2 Run in an installed Logstash
|
70
|
-
|
71
|
-
You can use the same **2.1** method to run your plugin in an installed Logstash by editing its `Gemfile` and pointing the `:path` to your local plugin development directory or you can build the gem and install it using:
|
72
|
-
|
73
|
-
- Build your plugin gem
|
74
|
-
```sh
|
75
|
-
gem build logstash-filter-awesome.gemspec
|
76
|
-
```
|
77
|
-
- Install the plugin from the Logstash home
|
78
|
-
```sh
|
79
|
-
bin/plugin install /your/local/plugin/logstash-filter-awesome.gem
|
80
|
-
```
|
81
|
-
- Start Logstash and proceed to test the plugin
|
82
|
-
|
83
|
-
## Contributing
|
84
|
-
|
85
|
-
All contributions are welcome: ideas, patches, documentation, bug reports, complaints, and even something you drew up on a napkin.
|
86
|
-
|
87
|
-
Programming is not a required skill. Whatever you've seen about open source and maintainers or community members saying "send patches or die" - you will not see that here.
|
88
|
-
|
89
|
-
It is more important to the community that you are able to contribute.
|
90
|
-
|
91
|
-
For more information about contributing, see the [CONTRIBUTING](https://github.com/elasticsearch/logstash/blob/master/CONTRIBUTING.md) file.
|
1
|
+
# Logstash input plugin for Azure Service Bus Topics
|
2
|
+
|
3
|
+
## Summary
|
4
|
+
This plugin reads and parses data from Azure Storage Blobs.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
You can install this plugin using the Logstash "plugin" or "logstash-plugin" (for newer versions of Logstash) command:
|
8
|
+
```sh
|
9
|
+
logstash-plugin install logstash-input-azureblob
|
10
|
+
```
|
11
|
+
For more information, see Logstash reference [Working with plugins](https://www.elastic.co/guide/en/logstash/current/working-with-plugins.html).
|
12
|
+
|
13
|
+
## Configuration
|
14
|
+
### Required Parameters
|
15
|
+
__*storage_account_name*__
|
16
|
+
|
17
|
+
The storage account name.
|
18
|
+
|
19
|
+
__*storage_access_key*__
|
20
|
+
|
21
|
+
The access key to the storage account.
|
22
|
+
|
23
|
+
__*container*__
|
24
|
+
|
25
|
+
The blob container name.
|
26
|
+
|
27
|
+
### Examples
|
28
|
+
```
|
29
|
+
input
|
30
|
+
{
|
31
|
+
azureblob
|
32
|
+
{
|
33
|
+
storage_account_name => "mystorageaccount"
|
34
|
+
storage_access_key => "VGhpcyBpcyBhIGZha2Uga2V5Lg=="
|
35
|
+
container => "mycontainer"
|
36
|
+
}
|
37
|
+
}
|
38
|
+
```
|
39
|
+
|
40
|
+
## More information
|
41
|
+
The source code of this plugin is hosted in GitHub repo [Microsoft Azure Diagnostics with ELK](https://github.com/Azure/azure-diagnostics-tools). We welcome you to provide feedback and/or contribute to the project.
|
@@ -1,96 +1,96 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require "logstash/inputs/base"
|
3
|
-
require "logstash/namespace"
|
4
|
-
|
5
|
-
require "azure"
|
6
|
-
require "securerandom"
|
7
|
-
|
8
|
-
# Reads events from Azure Blobs
|
9
|
-
class LogStash::Inputs::Azureblob < LogStash::Inputs::Base
|
10
|
-
|
11
|
-
config_name "azureblob"
|
12
|
-
milestone
|
13
|
-
|
14
|
-
default :codec, "json_lines"
|
15
|
-
|
16
|
-
config :storage_account_name, :validate => :string
|
17
|
-
config :storage_access_key, :validate => :string
|
18
|
-
|
19
|
-
config :container, :validate => :string
|
20
|
-
config :sleep_time, :validate => :number, :default => 10
|
21
|
-
|
22
|
-
def initialize(*args)
|
23
|
-
super(*args)
|
24
|
-
end # def initialize
|
25
|
-
|
26
|
-
public
|
27
|
-
def register
|
28
|
-
Azure.configure do |config|
|
29
|
-
config.storage_account_name = @storage_account_name
|
30
|
-
config.storage_access_key = @storage_access_key
|
31
|
-
end
|
32
|
-
@azure_blob = Azure::Blob::BlobService.new
|
33
|
-
end # def register
|
34
|
-
|
35
|
-
def list_blob_names
|
36
|
-
blob_names = Set.new []
|
37
|
-
loop do
|
38
|
-
continuation_token = NIL
|
39
|
-
entries = @azure_blob.list_blobs(@container, { :timeout => 10, :marker => continuation_token})
|
40
|
-
entries.each do |entry|
|
41
|
-
blob_names << entry.name
|
42
|
-
end
|
43
|
-
continuation_token = entries.continuation_token
|
44
|
-
break if continuation_token.empty?
|
45
|
-
end
|
46
|
-
return blob_names
|
47
|
-
end # def list_blobs
|
48
|
-
|
49
|
-
def acquire_lock(blob_name)
|
50
|
-
@azure_blob.create_page_blob(@container, blob_name, 512)
|
51
|
-
@azure_blob.acquire_lease(@container, blob_name,{:duration=>60, :timeout=>10, :proposed_lease_id=>SecureRandom.uuid})
|
52
|
-
return true
|
53
|
-
rescue LogStash::ShutdownSignal => e
|
54
|
-
raise e
|
55
|
-
rescue => e
|
56
|
-
@logger.error("Caught exception while locking", :exception => e)
|
57
|
-
return false
|
58
|
-
end # def acquire_lock
|
59
|
-
|
60
|
-
def lock_blob(blob_names)
|
61
|
-
real_blob_names = blob_names.select { |name| !name.end_with?(".lock") }
|
62
|
-
real_blob_names.each do |blob_name|
|
63
|
-
if !blob_names.include?(blob_name + ".lock")
|
64
|
-
if acquire_lock(blob_name + ".lock")
|
65
|
-
return blob_name
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
return NIL
|
70
|
-
end # def lock_blob
|
71
|
-
|
72
|
-
def process(output_queue)
|
73
|
-
blob_names = list_blob_names
|
74
|
-
blob_name = lock_blob(blob_names)
|
75
|
-
return if !blob_name
|
76
|
-
blob, content = @azure_blob.get_blob(@container, blob_name)
|
77
|
-
@codec.decode(content) do |event|
|
78
|
-
output_queue << event
|
79
|
-
end
|
80
|
-
rescue LogStash::ShutdownSignal => e
|
81
|
-
raise e
|
82
|
-
rescue => e
|
83
|
-
@logger.error("Oh My, An error occurred.", :exception => e)
|
84
|
-
end # def process
|
85
|
-
|
86
|
-
public
|
87
|
-
def run(output_queue)
|
88
|
-
while
|
89
|
-
process(output_queue)
|
90
|
-
end # loop
|
91
|
-
end # def run
|
92
|
-
|
93
|
-
public
|
94
|
-
def teardown
|
95
|
-
end # def teardown
|
96
|
-
end # class LogStash::Inputs::Azuretopic
|
1
|
+
# encoding: utf-8
|
2
|
+
require "logstash/inputs/base"
|
3
|
+
require "logstash/namespace"
|
4
|
+
|
5
|
+
require "azure"
|
6
|
+
require "securerandom"
|
7
|
+
|
8
|
+
# Reads events from Azure Blobs
|
9
|
+
class LogStash::Inputs::Azureblob < LogStash::Inputs::Base
|
10
|
+
|
11
|
+
config_name "azureblob"
|
12
|
+
milestone 1
|
13
|
+
|
14
|
+
default :codec, "json_lines"
|
15
|
+
|
16
|
+
config :storage_account_name, :validate => :string
|
17
|
+
config :storage_access_key, :validate => :string
|
18
|
+
|
19
|
+
config :container, :validate => :string
|
20
|
+
config :sleep_time, :validate => :number, :default => 10
|
21
|
+
|
22
|
+
def initialize(*args)
|
23
|
+
super(*args)
|
24
|
+
end # def initialize
|
25
|
+
|
26
|
+
public
|
27
|
+
def register
|
28
|
+
Azure.configure do |config|
|
29
|
+
config.storage_account_name = @storage_account_name
|
30
|
+
config.storage_access_key = @storage_access_key
|
31
|
+
end
|
32
|
+
@azure_blob = Azure::Blob::BlobService.new
|
33
|
+
end # def register
|
34
|
+
|
35
|
+
def list_blob_names
|
36
|
+
blob_names = Set.new []
|
37
|
+
loop do
|
38
|
+
continuation_token = NIL
|
39
|
+
entries = @azure_blob.list_blobs(@container, { :timeout => 10, :marker => continuation_token})
|
40
|
+
entries.each do |entry|
|
41
|
+
blob_names << entry.name
|
42
|
+
end
|
43
|
+
continuation_token = entries.continuation_token
|
44
|
+
break if continuation_token.empty?
|
45
|
+
end
|
46
|
+
return blob_names
|
47
|
+
end # def list_blobs
|
48
|
+
|
49
|
+
def acquire_lock(blob_name)
|
50
|
+
@azure_blob.create_page_blob(@container, blob_name, 512)
|
51
|
+
@azure_blob.acquire_lease(@container, blob_name,{:duration=>60, :timeout=>10, :proposed_lease_id=>SecureRandom.uuid})
|
52
|
+
return true
|
53
|
+
rescue LogStash::ShutdownSignal => e
|
54
|
+
raise e
|
55
|
+
rescue => e
|
56
|
+
@logger.error("Caught exception while locking", :exception => e)
|
57
|
+
return false
|
58
|
+
end # def acquire_lock
|
59
|
+
|
60
|
+
def lock_blob(blob_names)
|
61
|
+
real_blob_names = blob_names.select { |name| !name.end_with?(".lock") }
|
62
|
+
real_blob_names.each do |blob_name|
|
63
|
+
if !blob_names.include?(blob_name + ".lock")
|
64
|
+
if acquire_lock(blob_name + ".lock")
|
65
|
+
return blob_name
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
return NIL
|
70
|
+
end # def lock_blob
|
71
|
+
|
72
|
+
def process(output_queue)
|
73
|
+
blob_names = list_blob_names
|
74
|
+
blob_name = lock_blob(blob_names)
|
75
|
+
return if !blob_name
|
76
|
+
blob, content = @azure_blob.get_blob(@container, blob_name)
|
77
|
+
@codec.decode(content) do |event|
|
78
|
+
output_queue << event
|
79
|
+
end
|
80
|
+
rescue LogStash::ShutdownSignal => e
|
81
|
+
raise e
|
82
|
+
rescue => e
|
83
|
+
@logger.error("Oh My, An error occurred.", :exception => e)
|
84
|
+
end # def process
|
85
|
+
|
86
|
+
public
|
87
|
+
def run(output_queue)
|
88
|
+
while !stop?
|
89
|
+
process(output_queue)
|
90
|
+
end # loop
|
91
|
+
end # def run
|
92
|
+
|
93
|
+
public
|
94
|
+
def teardown
|
95
|
+
end # def teardown
|
96
|
+
end # class LogStash::Inputs::Azuretopic
|
@@ -1,16 +1,16 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-input-azureblob'
|
3
|
-
s.version = '0.9.
|
3
|
+
s.version = '0.9.5'
|
4
4
|
s.licenses = ['Apache License (2.0)']
|
5
|
-
s.summary = "This plugin
|
6
|
-
s.description = "This gem is a
|
5
|
+
s.summary = "This plugin collects Microsoft Azure Diagnostics data from Azure Storage Blobs."
|
6
|
+
s.description = "This gem is a Logstash plugin. It reads and parses data from Azure Storage Blobs."
|
7
7
|
s.authors = ["Microsoft Corporation"]
|
8
8
|
s.email = 'azdiag@microsoft.com'
|
9
9
|
s.homepage = "https://github.com/Azure/azure-diagnostics-tools"
|
10
10
|
s.require_paths = ["lib"]
|
11
11
|
|
12
12
|
# Files
|
13
|
-
s.files =
|
13
|
+
s.files = Dir['lib/**/*','spec/**/*','vendor/**/*','*.gemspec','*.md','Gemfile','LICENSE']
|
14
14
|
# Tests
|
15
15
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
16
16
|
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.metadata = { "logstash_plugin" => "true", "logstash_group" => "input" }
|
19
19
|
|
20
20
|
# Gem dependencies
|
21
|
-
s.add_runtime_dependency 'logstash-core', '
|
21
|
+
s.add_runtime_dependency 'logstash-core', '~> 2.0'
|
22
22
|
s.add_runtime_dependency 'azure', '~> 0.7.1'
|
23
|
-
s.add_development_dependency 'logstash-devutils'
|
23
|
+
s.add_development_dependency 'logstash-devutils', '>= 0.0.16'
|
24
24
|
end
|
metadata
CHANGED
@@ -1,64 +1,58 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-input-azureblob
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Microsoft Corporation
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
|
14
|
+
name: logstash-core
|
15
|
+
version_requirements: !ruby/object:Gem::Requirement
|
15
16
|
requirements:
|
16
|
-
- -
|
17
|
+
- - "~>"
|
17
18
|
- !ruby/object:Gem::Version
|
18
|
-
version:
|
19
|
-
|
19
|
+
version: '2.0'
|
20
|
+
requirement: !ruby/object:Gem::Requirement
|
21
|
+
requirements:
|
22
|
+
- - "~>"
|
20
23
|
- !ruby/object:Gem::Version
|
21
|
-
version: 2.0
|
22
|
-
name: logstash-core
|
24
|
+
version: '2.0'
|
23
25
|
prerelease: false
|
24
26
|
type: :runtime
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: azure
|
25
29
|
version_requirements: !ruby/object:Gem::Requirement
|
26
30
|
requirements:
|
27
|
-
- -
|
31
|
+
- - "~>"
|
28
32
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
30
|
-
- - <
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: 2.0.0
|
33
|
-
- !ruby/object:Gem::Dependency
|
33
|
+
version: 0.7.1
|
34
34
|
requirement: !ruby/object:Gem::Requirement
|
35
35
|
requirements:
|
36
|
-
- - ~>
|
36
|
+
- - "~>"
|
37
37
|
- !ruby/object:Gem::Version
|
38
38
|
version: 0.7.1
|
39
|
-
name: azure
|
40
39
|
prerelease: false
|
41
40
|
type: :runtime
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: logstash-devutils
|
42
43
|
version_requirements: !ruby/object:Gem::Requirement
|
43
44
|
requirements:
|
44
|
-
- -
|
45
|
+
- - ">="
|
45
46
|
- !ruby/object:Gem::Version
|
46
|
-
version: 0.
|
47
|
-
- !ruby/object:Gem::Dependency
|
47
|
+
version: 0.0.16
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
49
49
|
requirements:
|
50
|
-
- -
|
50
|
+
- - ">="
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version:
|
53
|
-
name: logstash-devutils
|
52
|
+
version: 0.0.16
|
54
53
|
prerelease: false
|
55
54
|
type: :development
|
56
|
-
|
57
|
-
requirements:
|
58
|
-
- - '>='
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: '0'
|
61
|
-
description: This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program.
|
55
|
+
description: This gem is a Logstash plugin. It reads and parses data from Azure Storage Blobs.
|
62
56
|
email: azdiag@microsoft.com
|
63
57
|
executables: []
|
64
58
|
extensions: []
|
@@ -68,7 +62,6 @@ files:
|
|
68
62
|
- Gemfile
|
69
63
|
- LICENSE
|
70
64
|
- README.md
|
71
|
-
- Rakefile
|
72
65
|
- lib/logstash/inputs/azureblob.rb
|
73
66
|
- logstash-input-azureblob.gemspec
|
74
67
|
- spec/inputs/azureblob_spec.rb
|
@@ -84,12 +77,12 @@ require_paths:
|
|
84
77
|
- lib
|
85
78
|
required_ruby_version: !ruby/object:Gem::Requirement
|
86
79
|
requirements:
|
87
|
-
- -
|
80
|
+
- - ">="
|
88
81
|
- !ruby/object:Gem::Version
|
89
82
|
version: '0'
|
90
83
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
84
|
requirements:
|
92
|
-
- -
|
85
|
+
- - ">="
|
93
86
|
- !ruby/object:Gem::Version
|
94
87
|
version: '0'
|
95
88
|
requirements: []
|
@@ -97,6 +90,6 @@ rubyforge_project:
|
|
97
90
|
rubygems_version: 2.4.8
|
98
91
|
signing_key:
|
99
92
|
specification_version: 4
|
100
|
-
summary: This plugin
|
93
|
+
summary: This plugin collects Microsoft Azure Diagnostics data from Azure Storage Blobs.
|
101
94
|
test_files:
|
102
95
|
- spec/inputs/azureblob_spec.rb
|
data/Rakefile
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require "logstash/devutils/rake"
|