logstash-output-azure_service_bus 0.1.0 → 0.1.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
  SHA256:
3
- metadata.gz: 2a012e033e589d0cbb282efdfd74f9e080c633f94fd6258d996045773692c62b
4
- data.tar.gz: 7fc41f8046108330b67aeaa3362e887cc687613f7af3a94fcd9ba88a232dd1b7
3
+ metadata.gz: a67fa04bdae51dece5761e74a988a0ebe3650bb9ef0bdf3e2865d13a7d978e9a
4
+ data.tar.gz: 5e81d65989042929f02f2500af06d50a816f7507b2acd83fa89ffddff553af8c
5
5
  SHA512:
6
- metadata.gz: 28f07e9366427d46ae888feb53197e498f238866b689512b28f96b219cd3a270ac49ecbb4c74a19b7133164f567e930b5637318f30c53f4a269f4c4c0f000dd8
7
- data.tar.gz: 4ed63e5f4b973a16bd04ca1da41ff6a3a30dacb70648dda8158582968632770c12a1afc068015bc1a65cd9fb3d975407c3500a9e74081b50c4122471d08a6524
6
+ metadata.gz: edec37ad077bc312121e37d2fca8820c910af1c2a73c0dc44dc943be699e08267b155fc5cf5351aa7732e49a72604cee66ec6b6a4b25904c71b17aa7c19db490
7
+ data.tar.gz: 46662ca942a33c7f19d80cf05a895ad3f729dd41970868703f5ee701b8c8bc9940642c486be64f5296771247ddd2e527c257227af9aeee6dc52b8ea17f626cf9
data/README.md CHANGED
@@ -1,86 +1,27 @@
1
1
  # logstash-output-azure_service_bus
2
2
 
3
- This is a plugin for [Logstash](https://github.com/elastic/logstash).
3
+ This plugin allows you to stream events from [Logstash](https://github.com/elastic/logstash) to a topic or queue in [Azure Service Bus](https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-messaging-overview). Currently, the only supported authentication mechanism is using [managed identities](https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/overview) which means this plugin must be run in an Azure compute environment. The entire Logstash event (not just the message) is passed to Service Bus with a content type of `application/json`.
4
4
 
5
- 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.
5
+ This plugin is hosted on RubyGems.org: [https://rubygems.org/gems/logstash-output-azure_service_bus](https://rubygems.org/gems/logstash-output-azure_service_bus)
6
6
 
7
- ## Documentation
8
-
9
- 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.elastic.co/guide/en/logstash/current/).
10
-
11
- - For formatting code or config example, you can use the asciidoc `[source,ruby]` directive
12
- - For more asciidoc formatting tips, see the excellent reference here https://github.com/elastic/docs#asciidoc-guide
13
-
14
- ## Need Help?
15
-
16
- Need help? Try #logstash on freenode IRC or the https://discuss.elastic.co/c/logstash discussion forum.
17
-
18
- ## Developing
19
-
20
- ### 1. Plugin Developement and Testing
21
-
22
- #### Code
23
- - To get started, you'll need JRuby with the Bundler gem installed.
24
-
25
- - 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).
26
-
27
- - Install dependencies
28
- ```sh
29
- bundle install
30
- ```
31
-
32
- #### Test
33
-
34
- - Update your dependencies
35
-
36
- ```sh
37
- bundle install
7
+ ## Install
8
+ To install, use the plugin tool that is part of your Logstash installation:
38
9
  ```
39
-
40
- - Run tests
41
-
42
- ```sh
43
- bundle exec rspec
10
+ $LOGSTASH_INSTALL/bin/logstash-plugin install logstash-output-azure_service_bus
44
11
  ```
45
12
 
46
- ### 2. Running your unpublished Plugin in Logstash
13
+ ## Pipeline Configuration
14
+ As mentioned above, the compute environment that Logstash is running in must have managed identity enabled. In addition, the managed identity should have permissions to send to the desired queue or topic - typically the `Azure Service Bus Data Sender` role.
47
15
 
48
- #### 2.1 Run in a local Logstash clone
49
-
50
- - Edit Logstash `Gemfile` and add the local plugin path, for example:
51
- ```ruby
52
- gem "logstash-filter-awesome", :path => "/your/local/logstash-filter-awesome"
53
- ```
54
- - Install plugin
55
- ```sh
56
- bin/logstash-plugin install --no-verify
16
+ Two settings in your Logstash pipeline are required:
57
17
  ```
58
- - Run Logstash with your plugin
59
- ```sh
60
- bin/logstash -e 'filter {awesome {}}'
18
+ output {
19
+ azure_service_bus {
20
+ service_bus_namespace => "service-bus-name"
21
+ service_bus_entity => "queue-or-topic-name"
22
+ }
23
+ }
61
24
  ```
62
- At this point any modifications to the plugin code will be applied to this local Logstash setup. After modifying the plugin, simply rerun Logstash.
63
-
64
- #### 2.2 Run in an installed Logstash
65
-
66
- 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:
67
-
68
- - Build your plugin gem
69
- ```sh
70
- gem build logstash-filter-awesome.gemspec
71
- ```
72
- - Install the plugin from the Logstash home
73
- ```sh
74
- bin/logstash-plugin install /your/local/plugin/logstash-filter-awesome.gem
75
- ```
76
- - Start Logstash and proceed to test the plugin
77
-
78
- ## Contributing
79
-
80
- All contributions are welcome: ideas, patches, documentation, bug reports, complaints, and even something you drew up on a napkin.
81
-
82
- 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.
83
-
84
- It is more important to the community that you are able to contribute.
85
25
 
86
- For more information about contributing, see the [CONTRIBUTING](https://github.com/elastic/logstash/blob/master/CONTRIBUTING.md) file.
26
+ ## Service Bus Configuration
27
+ 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.
@@ -3,7 +3,6 @@ require 'faraday/retry'
3
3
  require 'json'
4
4
  require 'logstash/outputs/base'
5
5
 
6
- # An azure_service_bus output that does nothing.
7
6
  class LogStash::Outputs::AzureServiceBus < LogStash::Outputs::Base
8
7
  concurrency :single
9
8
 
@@ -14,12 +13,14 @@ class LogStash::Outputs::AzureServiceBus < LogStash::Outputs::Base
14
13
 
15
14
  def register
16
15
  retry_options = {
17
- max: 3,
16
+ max: 5,
18
17
  interval: 1,
19
18
  interval_randomness: 0.5,
20
- backoff_factor: 2,
19
+ backoff_factor: 3,
21
20
  retry_statuses: [429, 500],
22
- exceptions: [Faraday::ConnectionFailed, Faraday::TimeoutError, Faraday::RetriableResponse, Net::ReadTimeout]
21
+ exceptions: [Faraday::ConnectionFailed, Faraday::TimeoutError, Faraday::RetriableResponse],
22
+ methods: %i[get post],
23
+ retry_block: ->(_env, _options, retries, exception) { @logger.error("Error (#{exception}) for #{env.method.upcase} #{env.url} - #{retries + 1} retry(s) left") }
23
24
  }
24
25
  @token_conn = Faraday.new(
25
26
  url: 'http://169.254.169.254/metadata/identity/oauth2/token',
@@ -31,7 +32,7 @@ class LogStash::Outputs::AzureServiceBus < LogStash::Outputs::Base
31
32
  end
32
33
  @service_bus_conn = Faraday.new(
33
34
  url: "https://#{@service_bus_namespace}.servicebus.windows.net/#{@service_bus_entity}/",
34
- request: { timeout: 1 }
35
+ request: { timeout: 3 }
35
36
  ) do |f|
36
37
  f.request :retry, retry_options
37
38
  end
@@ -58,9 +59,9 @@ class LogStash::Outputs::AzureServiceBus < LogStash::Outputs::Base
58
59
  req.body = JSON.generate(messages)
59
60
  req.headers = { 'Authorization' => "Bearer #{@access_token}", 'Content-Type' => 'application/vnd.microsoft.servicebus.json' }
60
61
  end
61
- raise "Error while sending message to Service Bus: #{response.body}" if response.status != 201
62
+ raise "Error while sending message to Service Bus: HTTP #{response.status}" if response.status != 201
62
63
 
63
- @logger.info("Sent #{messages.length} message(s) to Service Bus")
64
+ @logger.debug("Sent #{messages.length} message(s) to Service Bus")
64
65
  end
65
66
 
66
67
  def access_token_needs_refresh?
@@ -1,12 +1,13 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-output-azure_service_bus'
3
- s.version = '0.1.0'
3
+ s.version = '0.1.4'
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'
7
7
  s.authors = ['Harrison Golden']
8
8
  s.email = 'gharryg@mac.com'
9
9
  s.require_paths = ['lib']
10
+ s.required_ruby_version = '>=2.5.0'
10
11
 
11
12
  # Files
12
13
  s.files = Dir['lib/**/*', '*.gemspec', '*.md', 'Gemfile', 'LICENSE']
@@ -15,9 +16,8 @@ Gem::Specification.new do |s|
15
16
  s.metadata = { 'logstash_plugin' => 'true', 'logstash_group' => 'output' }
16
17
 
17
18
  # Gem dependencies
18
- s.add_runtime_dependency 'faraday'
19
- s.add_runtime_dependency 'faraday-retry'
19
+ s.add_runtime_dependency 'faraday', '~> 1.9'
20
+ s.add_runtime_dependency 'faraday-retry', '~> 1.0'
20
21
  s.add_runtime_dependency 'logstash-codec-plain'
21
22
  s.add_runtime_dependency 'logstash-core-plugin-api'
22
- s.add_development_dependency 'logstash-devutils'
23
23
  end
metadata CHANGED
@@ -1,43 +1,43 @@
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.0
4
+ version: 0.1.4
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-01 00:00:00.000000000 Z
11
+ date: 2022-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
- - - ">="
16
+ - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: '0'
18
+ version: '1.9'
19
19
  name: faraday
20
20
  prerelease: false
21
21
  type: :runtime
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '1.9'
27
27
  - !ruby/object:Gem::Dependency
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
30
- - - ">="
30
+ - - "~>"
31
31
  - !ruby/object:Gem::Version
32
- version: '0'
32
+ version: '1.0'
33
33
  name: faraday-retry
34
34
  prerelease: false
35
35
  type: :runtime
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: '1.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  requirement: !ruby/object:Gem::Requirement
43
43
  requirements:
@@ -66,20 +66,6 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- - !ruby/object:Gem::Dependency
70
- requirement: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- version: '0'
75
- name: logstash-devutils
76
- prerelease: false
77
- type: :development
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
69
  description:
84
70
  email: gharryg@mac.com
85
71
  executables: []
@@ -105,7 +91,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
105
91
  requirements:
106
92
  - - ">="
107
93
  - !ruby/object:Gem::Version
108
- version: '0'
94
+ version: 2.5.0
109
95
  required_rubygems_version: !ruby/object:Gem::Requirement
110
96
  requirements:
111
97
  - - ">="