logstash-input-azuretopicthreadable 0.9.7 → 0.9.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -2
- data/lib/logstash/inputs/azuretopicthreadable.rb +29 -17
- data/logstash-input-azuretopicthreadable.gemspec +1 -1
- metadata +17 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96ef88174ba7b964804e3b621e4e5b539d975c50
|
4
|
+
data.tar.gz: abf57a4361a44010378e1ce5c1394b55513ee334
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c891ca43799d62e4e6454942a010efccdd7d09150f1e06167b6638de2705f10d991e0034994ac039c19a947ea922c79530b5822edc3ddbe8246026412309de4
|
7
|
+
data.tar.gz: 587745c2398b4b782140c3446c2f0058cfaf200c377d12cb15ece9c9ba306f83f6ac824dcba39934cce433d89e1cce33235b071f71b23404ae089a00edd44d0f
|
data/README.md
CHANGED
@@ -16,6 +16,10 @@ __*namespace*__
|
|
16
16
|
|
17
17
|
The Service Bus namespace.
|
18
18
|
|
19
|
+
__*access_key_name*__
|
20
|
+
|
21
|
+
Optional: The SAS policy name to the Service Bus resource. If undefined, plugin will assume ACS is used.
|
22
|
+
|
19
23
|
__*access_key*__
|
20
24
|
|
21
25
|
The access key to the Service Bus resource.
|
@@ -39,15 +43,16 @@ Specifies the number of threads to use to read the messages. The default value i
|
|
39
43
|
|
40
44
|
__*thread_sleep_time*__
|
41
45
|
|
42
|
-
Specifies the number of seconds each thread should sleep before starting another loop of processing. The default value is 1/50.
|
46
|
+
Specifies the number of seconds each thread should sleep before starting another loop of processing when topic is empty. The default value is 1/50.
|
43
47
|
|
44
48
|
### Examples
|
45
49
|
```
|
46
50
|
input
|
47
51
|
{
|
48
|
-
|
52
|
+
azuretopicthreadable
|
49
53
|
{
|
50
54
|
namespace => "mysbns"
|
55
|
+
access_key_name => "mySASkeyname"
|
51
56
|
access_key => "VGhpcyBpcyBhIGZha2Uga2V5Lg=="
|
52
57
|
subscription => "mytopicsubscription"
|
53
58
|
topic => "mytopic"
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require "logstash/inputs/base"
|
3
3
|
require "logstash/namespace"
|
4
|
-
|
5
4
|
require "thread"
|
6
5
|
require "azure"
|
7
6
|
|
@@ -11,33 +10,44 @@ class LogStash::Inputs::Azuretopicthreadable < LogStash::Inputs::Base
|
|
11
10
|
|
12
11
|
config_name "azuretopicthreadable"
|
13
12
|
milestone 1
|
14
|
-
|
13
|
+
|
15
14
|
default :codec, "json" # default json codec
|
16
|
-
|
15
|
+
|
17
16
|
config :namespace, :validate => :string
|
17
|
+
config :access_key_name, :validate => :string, :required => false
|
18
18
|
config :access_key, :validate => :string
|
19
19
|
config :subscription, :validate => :string
|
20
20
|
config :topic, :validate => :string
|
21
21
|
config :deliverycount, :validate => :number, :default => 10
|
22
22
|
config :threads, :validate => :number, :default => 1
|
23
23
|
config :thread_sleep_time, :validate => :number, :default => 1.0/50.0
|
24
|
-
|
24
|
+
|
25
25
|
def initialize(*args)
|
26
26
|
super(*args)
|
27
27
|
end # def initialize
|
28
|
-
|
28
|
+
|
29
29
|
public
|
30
30
|
def register
|
31
31
|
# Configure credentials
|
32
32
|
Azure.configure do |config|
|
33
33
|
config.sb_namespace = @namespace
|
34
34
|
config.sb_access_key = @access_key
|
35
|
+
config.sb_sas_key_name = @access_key_name
|
36
|
+
config.sb_sas_key = @access_key
|
35
37
|
end
|
36
38
|
end # def register
|
37
|
-
|
39
|
+
|
38
40
|
def process(output_queue, pid)
|
39
41
|
# Get a new instance of a service
|
40
|
-
|
42
|
+
if @access_key_name
|
43
|
+
# SAS key used
|
44
|
+
signer = Azure::ServiceBus::Auth::SharedAccessSigner.new
|
45
|
+
sb_host = "https://#{Azure.sb_namespace}.servicebus.windows.net"
|
46
|
+
azure_service_bus = Azure::ServiceBus::ServiceBusService.new(sb_host, { signer: signer})
|
47
|
+
else
|
48
|
+
# ACS key
|
49
|
+
azure_service_bus = Azure::ServiceBus::ServiceBusService.new
|
50
|
+
end
|
41
51
|
while !stop?
|
42
52
|
begin
|
43
53
|
# check if we have a message in the subscription
|
@@ -45,12 +55,14 @@ class LogStash::Inputs::Azuretopicthreadable < LogStash::Inputs::Base
|
|
45
55
|
if message
|
46
56
|
# decoding returns a yield
|
47
57
|
codec.decode(message.body) do |event|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
58
|
+
decorate(event)
|
59
|
+
output_queue << event
|
60
|
+
end
|
61
|
+
# delete the message after reading it
|
62
|
+
azure_service_bus.delete_subscription_message(message)
|
63
|
+
else
|
64
|
+
Stud.stoppable_sleep(@thread_sleep_time) { stop? } #topic is probably empty. sleep.
|
65
|
+
end
|
54
66
|
rescue LogStash::ShutdownSignal => e
|
55
67
|
raise e
|
56
68
|
rescue => e
|
@@ -58,11 +70,11 @@ class LogStash::Inputs::Azuretopicthreadable < LogStash::Inputs::Base
|
|
58
70
|
if message and message.delivery_count > @deliverycount
|
59
71
|
azure_service_bus.delete_subscription_message(message)
|
60
72
|
end
|
73
|
+
Stud.stoppable_sleep(@thread_sleep_time) { stop? }
|
61
74
|
end
|
62
|
-
sleep(@thread_sleep_time)
|
63
75
|
end
|
64
76
|
end # def process
|
65
|
-
|
77
|
+
|
66
78
|
public
|
67
79
|
def run(output_queue)
|
68
80
|
threads = []
|
@@ -71,8 +83,8 @@ class LogStash::Inputs::Azuretopicthreadable < LogStash::Inputs::Base
|
|
71
83
|
end
|
72
84
|
threads.each { |thr| thr.join }
|
73
85
|
end # def run
|
74
|
-
|
86
|
+
|
75
87
|
public
|
76
88
|
def teardown
|
77
89
|
end # def teardown
|
78
|
-
end # class LogStash::Inputs::Azuretopic
|
90
|
+
end # class LogStash::Inputs::Azuretopic
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-input-azuretopicthreadable'
|
3
|
-
s.version = '0.9.
|
3
|
+
s.version = '0.9.8'
|
4
4
|
s.licenses = ['Apache License (2.0)']
|
5
5
|
s.summary = "This plugin reads messages from Azure Service Bus Topics."
|
6
6
|
s.description = "This gem is a Logstash plugin. It reads messages from Azure Service Bus Topics using multiple threads."
|
metadata
CHANGED
@@ -1,18 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-input-azuretopicthreadable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Microsoft Corporation
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
|
15
|
-
version_requirements: !ruby/object:Gem::Requirement
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
16
15
|
requirements:
|
17
16
|
- - ">="
|
18
17
|
- !ruby/object:Gem::Version
|
@@ -20,7 +19,10 @@ dependencies:
|
|
20
19
|
- - "<="
|
21
20
|
- !ruby/object:Gem::Version
|
22
21
|
version: '2.99'
|
23
|
-
|
22
|
+
name: logstash-core-plugin-api
|
23
|
+
prerelease: false
|
24
|
+
type: :runtime
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
26
|
requirements:
|
25
27
|
- - ">="
|
26
28
|
- !ruby/object:Gem::Version
|
@@ -28,36 +30,34 @@ dependencies:
|
|
28
30
|
- - "<="
|
29
31
|
- !ruby/object:Gem::Version
|
30
32
|
version: '2.99'
|
31
|
-
prerelease: false
|
32
|
-
type: :runtime
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
|
-
name: azure
|
35
|
-
version_requirements: !ruby/object:Gem::Requirement
|
36
|
-
requirements:
|
37
|
-
- - "~>"
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: 0.7.1
|
40
34
|
requirement: !ruby/object:Gem::Requirement
|
41
35
|
requirements:
|
42
36
|
- - "~>"
|
43
37
|
- !ruby/object:Gem::Version
|
44
38
|
version: 0.7.1
|
39
|
+
name: azure
|
45
40
|
prerelease: false
|
46
41
|
type: :runtime
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: logstash-devutils
|
49
42
|
version_requirements: !ruby/object:Gem::Requirement
|
50
43
|
requirements:
|
51
|
-
- - "
|
44
|
+
- - "~>"
|
52
45
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
46
|
+
version: 0.7.1
|
47
|
+
- !ruby/object:Gem::Dependency
|
54
48
|
requirement: !ruby/object:Gem::Requirement
|
55
49
|
requirements:
|
56
50
|
- - ">="
|
57
51
|
- !ruby/object:Gem::Version
|
58
52
|
version: '0'
|
53
|
+
name: logstash-devutils
|
59
54
|
prerelease: false
|
60
55
|
type: :development
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
61
|
description: This gem is a Logstash plugin. It reads messages from Azure Service Bus Topics using multiple threads.
|
62
62
|
email: azdiag@microsoft.com
|
63
63
|
executables: []
|