logstash-output-azure_service_bus 0.1.5 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -0
- data/lib/logstash/outputs/azure_service_bus.rb +8 -3
- data/logstash-output-azure_service_bus.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af1daf5ab0f287bfe29993a09437eb840063c5195d5dc9c247985fae757a09bd
|
4
|
+
data.tar.gz: afb35cc44123159129fc63fe5fcb374c7cb77ac98137b3b2ae0e513e96b12f09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3727d297acacbee56d2570ac67aca3e05bcc2f677b6ab5ab50c3acfa84aa721c683be70810fdcc26203124d615cbd99e6bb19fc5f1d68d3eccefd859e288d0e9
|
7
|
+
data.tar.gz: a72b4442be6118a0b933b2d3e9b6736a282e3024f32f00dd9bb4506b6096c02a824777ebe7535340d53eb9c152121b8e9bf2bf70c00d9d5b05b9ccb67307306e
|
data/README.md
CHANGED
@@ -22,6 +22,22 @@ output {
|
|
22
22
|
}
|
23
23
|
}
|
24
24
|
```
|
25
|
+
There is one optional setting (`messageid_field`) which sets the Service Bus `MessageId` value to an existing, unique field. If this setting is not used, Service Bus will generate an id when the message is created. The value of the provided field _must_ be unique or Service Bus will reject the message. A sample config might look like:
|
26
|
+
```
|
27
|
+
input { ... }
|
28
|
+
filter {
|
29
|
+
uuid {
|
30
|
+
target => "uuid"
|
31
|
+
}
|
32
|
+
}
|
33
|
+
output {
|
34
|
+
azure_service_bus {
|
35
|
+
service_bus_namespace => "service-bus-name"
|
36
|
+
service_bus_entity => "queue-or-topic-name"
|
37
|
+
messageid_field => "uuid"
|
38
|
+
}
|
39
|
+
}
|
40
|
+
```
|
25
41
|
|
26
42
|
## Service Bus Configuration
|
27
43
|
This plugin will retry sending messages if the Service Bus connection times out or returns a bad response. To avoid idempotence issues, you should enable duplicate detection on the destination queue or topic.
|
@@ -10,6 +10,7 @@ class LogStash::Outputs::AzureServiceBus < LogStash::Outputs::Base
|
|
10
10
|
|
11
11
|
config :service_bus_namespace, :validate => :string, :required => true
|
12
12
|
config :service_bus_entity, :validate => :string, :required => true
|
13
|
+
config :messageid_field, :validate => :string
|
13
14
|
|
14
15
|
def register
|
15
16
|
retry_options = {
|
@@ -20,13 +21,13 @@ class LogStash::Outputs::AzureServiceBus < LogStash::Outputs::Base
|
|
20
21
|
retry_statuses: [429, 500],
|
21
22
|
exceptions: [Faraday::ConnectionFailed, Faraday::TimeoutError, Faraday::RetriableResponse],
|
22
23
|
methods: %i[get post],
|
23
|
-
retry_block: ->(
|
24
|
+
retry_block: ->(env, _options, retries, exception) { @logger.warn("Error (#{exception}) for #{env.method.upcase} #{env.url} - #{retries + 1} retry(s) left") }
|
24
25
|
}
|
25
26
|
@token_conn = Faraday.new(
|
26
27
|
url: 'http://169.254.169.254/metadata/identity/oauth2/token',
|
27
28
|
params: { 'api-version' => '2018-02-01', 'resource' => 'https://servicebus.azure.net/' },
|
28
29
|
headers: { 'Metadata' => 'true' },
|
29
|
-
request: { timeout:
|
30
|
+
request: { timeout: 4 }
|
30
31
|
) do |f|
|
31
32
|
f.request :retry, retry_options
|
32
33
|
end
|
@@ -48,7 +49,11 @@ class LogStash::Outputs::AzureServiceBus < LogStash::Outputs::Base
|
|
48
49
|
def send_events(events)
|
49
50
|
messages = []
|
50
51
|
events.each do |event|
|
51
|
-
|
52
|
+
if @messageid_field.nil?
|
53
|
+
messages.append({ 'Body' => JSON.generate(event.to_hash), 'BrokerProperties' => { 'ContentType' => 'application/json' } })
|
54
|
+
else
|
55
|
+
messages.append({ 'Body' => JSON.generate(event.to_hash), 'BrokerProperties' => { 'ContentType' => 'application/json', 'MessageId' => event.get(@messageid_field) } })
|
56
|
+
end
|
52
57
|
end
|
53
58
|
post_messages(messages)
|
54
59
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-output-azure_service_bus'
|
3
|
-
s.version = '0.1
|
3
|
+
s.version = '0.2.1'
|
4
4
|
s.licenses = ['Apache-2.0']
|
5
5
|
s.summary = 'Send Logstash messages to Azure Service Bus.'
|
6
6
|
s.homepage = 'https://github.com/gharryg/logstash-output-azure_service_bus'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-output-azure_service_bus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Harrison Golden
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-04-
|
11
|
+
date: 2022-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|