logstash-input-azureblob 0.9.3 → 0.9.4

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: ab0afd493191bb6baf1f5b4903793eb8ca8a386b
4
- data.tar.gz: f2d7e7d404d7cdefe853f6ebf97ee60206365d56
3
+ metadata.gz: 889e8f25463f49bee1d0f76ced9e4d24a56cb861
4
+ data.tar.gz: ec1b10b9f23756e0005d9b61613e301febe2c7b2
5
5
  SHA512:
6
- metadata.gz: c09ab8759bd8bf2cc96dc92c731504fe1ef310077f632ac7a902f6a95495940cb5b37044d91ccf610a28eb42f33db461ff424e1069404a114921791bc8baad47
7
- data.tar.gz: f6feebac1be608c5c61dbb3b4040c25a165bc9796bf570c921b6ad676163260d6e085c18aa45d906d543123d9e7896f6469369ad68e1741fb44419ddb58bd859
6
+ metadata.gz: e157a7fed829c6bb4e2ca5924e6771e4014cb80a3042137bedabfe747b0a4ec82e1796658417a2ca968b2531835636ca1253e50cadfb5b6b5989c44eeb4cfcc0
7
+ data.tar.gz: 7d9ec3ab108bb822b028d91eeef68676f3c9b56479e9afcf402c4c5da31134d98015fe4ef7d34dfc37794fbdbc39330d22f5978b72cfaa8326e25ea70e6c024f
File without changes
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
3
+ gem 'azure', '~> 0.7.1'
data/LICENSE ADDED
@@ -0,0 +1,17 @@
1
+
2
+ Copyright (c) Microsoft. All rights reserved.
3
+ Microsoft would like to thank its contributors, a list
4
+ of whom are at http://aka.ms/entlib-contributors
5
+
6
+ Licensed under the Apache License, Version 2.0 (the "License"); you
7
+ may not use this file except in compliance with the License. You may
8
+ obtain a copy of the License at
9
+
10
+ http://www.apache.org/licenses/LICENSE-2.0
11
+
12
+ Unless required by applicable law or agreed to in writing, software
13
+ distributed under the License is distributed on an "AS IS" BASIS,
14
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15
+ implied. See the License for the specific language governing permissions
16
+ and limitations under the License.
17
+
@@ -0,0 +1,91 @@
1
+ # Notice
2
+ This plugin is a part of [Microsoft Azure Diagnostics with ELK](https://github.com/mspnp/semantic-logging/tree/v3/ELK).
3
+
4
+ [See more documentation.](https://github.com/mspnp/semantic-logging/blob/v3/ELK/md/LogstashExtensions.md#azure-wad-table)
5
+
6
+ # Logstash Plugin
7
+
8
+ This is a plugin for [Logstash](https://github.com/elasticsearch/logstash).
9
+
10
+ It is fully free and fully open source. The license is Apache 2.0, meaning you are pretty much free to use it however you want in whatever way.
11
+
12
+ ## Documentation
13
+
14
+ Logstash provides infrastructure to automatically generate documentation for this plugin. We use the asciidoc format to write documentation so any comments in the source code will be first converted into asciidoc and then into html. All plugin documentation are placed under one [central location](http://www.elasticsearch.org/guide/en/logstash/current/).
15
+
16
+ - For formatting code or config example, you can use the asciidoc `[source,ruby]` directive
17
+ - For more asciidoc formatting tips, see the excellent reference here https://github.com/elasticsearch/docs#asciidoc-guide
18
+
19
+ ## Need Help?
20
+
21
+ Need help? Try #logstash on freenode IRC or the https://discuss.elastic.co/c/logstash discussion forum.
22
+
23
+ ## Developing
24
+
25
+ ### 1. Plugin Developement and Testing
26
+
27
+ #### Code
28
+ - To get started, you'll need JRuby with the Bundler gem installed.
29
+
30
+ - Create a new plugin or clone and existing from the GitHub [logstash-plugins](https://github.com/logstash-plugins) organization. We also provide [example plugins](https://github.com/logstash-plugins?query=example).
31
+
32
+ - Install dependencies
33
+ ```sh
34
+ bundle install
35
+ ```
36
+
37
+ #### Test
38
+
39
+ - Update your dependencies
40
+
41
+ ```sh
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.
@@ -0,0 +1 @@
1
+ require "logstash/devutils/rake"
@@ -0,0 +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 0
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 true
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
@@ -0,0 +1,24 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'logstash-input-azureblob'
3
+ s.version = '0.9.4'
4
+ s.licenses = ['Apache License (2.0)']
5
+ s.summary = "This plugin will collect Microsoft Azure Diagnostics data from Azure Storage."
6
+ s.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."
7
+ s.authors = ["Microsoft Corporation"]
8
+ s.email = 'azdiag@microsoft.com'
9
+ s.homepage = "https://github.com/Azure/azure-diagnostics-tools"
10
+ s.require_paths = ["lib"]
11
+
12
+ # Files
13
+ s.files = `git ls-files`.split($\)
14
+ # Tests
15
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
16
+
17
+ # Special flag to let us know this is actually a logstash plugin
18
+ s.metadata = { "logstash_plugin" => "true", "logstash_group" => "input" }
19
+
20
+ # Gem dependencies
21
+ s.add_runtime_dependency 'logstash-core', '>= 1.4.0', '< 2.0.0'
22
+ s.add_runtime_dependency 'azure', '~> 0.7.1'
23
+ s.add_development_dependency 'logstash-devutils'
24
+ end
@@ -0,0 +1 @@
1
+ require "logstash/devutils/rspec/spec_helper"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-azureblob
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.9.4
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-02-12 00:00:00.000000000 Z
11
+ date: 2016-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -63,8 +63,16 @@ email: azdiag@microsoft.com
63
63
  executables: []
64
64
  extensions: []
65
65
  extra_rdoc_files: []
66
- files: []
67
- homepage: https://github.com/juliusl/logstash-input-azurewadtable
66
+ files:
67
+ - CHANGELOG.md
68
+ - Gemfile
69
+ - LICENSE
70
+ - README.md
71
+ - Rakefile
72
+ - lib/logstash/inputs/azureblob.rb
73
+ - logstash-input-azureblob.gemspec
74
+ - spec/inputs/azureblob_spec.rb
75
+ homepage: https://github.com/Azure/azure-diagnostics-tools
68
76
  licenses:
69
77
  - Apache License (2.0)
70
78
  metadata:
@@ -90,4 +98,5 @@ rubygems_version: 2.4.8
90
98
  signing_key:
91
99
  specification_version: 4
92
100
  summary: This plugin will collect Microsoft Azure Diagnostics data from Azure Storage.
93
- test_files: []
101
+ test_files:
102
+ - spec/inputs/azureblob_spec.rb