fluent-plugin-azureeventhubs-radiant 0.1.0
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 +7 -0
- data/Gemfile +15 -0
- data/LICENSE +21 -0
- data/NOTICE +8 -0
- data/README.md +56 -0
- data/Rakefile +10 -0
- data/fluent-plugin-azureeventhubs-radiant.gemspec +47 -0
- data/lib/fluent/plugin/azureeventhubs_radiant/http.rb +192 -0
- data/lib/fluent/plugin/azureeventhubs_radiant/version.rb +9 -0
- data/lib/fluent/plugin/out_azureeventhubs_radiant.rb +128 -0
- metadata +178 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 30604e09ebea16046766a065eec05680a3474e65d9631a889c7a26dce9a739e9
|
|
4
|
+
data.tar.gz: 0cc0d6312822aa966d389ac4a010747d8a42ebc4c2ab99ea11a6befba9c012ce
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 764d30e33dad733867a3c7b7f059b34ea93938378b05f4ec4033d7d9d822c04d86b6b3b06c3e930d09e837222cff4c10e2d24954eb404c4a304bc954d06a4f58
|
|
7
|
+
data.tar.gz: db54a4f8dc1325505e13308c66ff09dd433cc78eeff7eccfb4332904660e3d9186aea6253fc42d14fabd2c5861bfcb8e1f4f6c7ddae647420695f36d0b5821cf
|
data/Gemfile
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
source "https://rubygems.org"
|
|
2
|
+
|
|
3
|
+
gem "fluentd", ">= 1.16", "< 2.0"
|
|
4
|
+
gem "oj", "~> 3.16"
|
|
5
|
+
|
|
6
|
+
group :development, :test do
|
|
7
|
+
gem "bundler", ">= 2.0"
|
|
8
|
+
gem "rake", "~> 13.0"
|
|
9
|
+
gem "rspec", "~> 3.13"
|
|
10
|
+
gem "rubocop", "~> 1.60"
|
|
11
|
+
gem "rubocop-rspec", "~> 3.0"
|
|
12
|
+
gem "simplecov", "~> 0.22"
|
|
13
|
+
gem "test-unit", "~> 3.6"
|
|
14
|
+
gem "webmock", "~> 3.23"
|
|
15
|
+
end
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 G. Rahul Nutakki
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/NOTICE
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
This project incorporates code and design ideas from the original
|
|
2
|
+
"fluent-plugin-azureeventhubs" project (MIT-licensed) available at:
|
|
3
|
+
|
|
4
|
+
https://github.com/htgc/fluent-plugin-azureeventhubs
|
|
5
|
+
|
|
6
|
+
All modifications in this repository are Copyright (c) 2025
|
|
7
|
+
G. Rahul Nutakki and contributors, and are provided under the MIT
|
|
8
|
+
license unless otherwise noted.
|
data/README.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# fluent-plugin-azureeventhubs-radiant
|
|
2
|
+
|
|
3
|
+
Modernized Fluentd output plugin for sending logs to Azure Event Hubs.
|
|
4
|
+
|
|
5
|
+
This project is a security and compatibility focused fork of the original
|
|
6
|
+
[`fluent-plugin-azureeventhubs`](https://github.com/htgc/fluent-plugin-azureeventhubs)
|
|
7
|
+
plugin, updated for:
|
|
8
|
+
|
|
9
|
+
- Ruby 3.x
|
|
10
|
+
- Fluentd 1.x
|
|
11
|
+
- Safer TLS handling and better error reporting when talking to Azure Event Hubs.
|
|
12
|
+
|
|
13
|
+
## Status
|
|
14
|
+
|
|
15
|
+
This is an early radiant version intended for experimentation. The API is kept
|
|
16
|
+
as close as reasonable to the original `azureeventhubs_buffered` output.
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
gem install fluent-plugin-azureeventhubs-radiant
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Basic configuration
|
|
25
|
+
|
|
26
|
+
```xml
|
|
27
|
+
<match **>
|
|
28
|
+
@type azureeventhubs
|
|
29
|
+
connection_string "Endpoint=sb://...;SharedAccessKeyName=...;SharedAccessKey=..."
|
|
30
|
+
hub_name "my-event-hub"
|
|
31
|
+
|
|
32
|
+
# Optional
|
|
33
|
+
include_tag true
|
|
34
|
+
include_time true
|
|
35
|
+
tag_time_name time
|
|
36
|
+
batch true
|
|
37
|
+
max_batch_size 20
|
|
38
|
+
ssl_verify true
|
|
39
|
+
</match>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Example Configurations
|
|
43
|
+
|
|
44
|
+
See the [`examples/`](examples/) directory for complete configuration examples:
|
|
45
|
+
|
|
46
|
+
- [`basic.conf`](examples/basic.conf) - Minimal configuration to get started
|
|
47
|
+
- [`with-metadata.conf`](examples/with-metadata.conf) - Include Fluentd tag and timestamp
|
|
48
|
+
- [`batch-mode.conf`](examples/batch-mode.conf) - Batch multiple records for better throughput
|
|
49
|
+
- [`kubernetes.conf`](examples/kubernetes.conf) - Optimized for Kubernetes cluster logs
|
|
50
|
+
- [`ssl-configuration.conf`](examples/ssl-configuration.conf) - Custom SSL/TLS settings
|
|
51
|
+
- [`proxy-configuration.conf`](examples/proxy-configuration.conf) - HTTP proxy support
|
|
52
|
+
- [`advanced.conf`](examples/advanced.conf) - Production-ready configuration with all features
|
|
53
|
+
|
|
54
|
+
## License
|
|
55
|
+
|
|
56
|
+
MIT, same as the original plugin.
|
data/Rakefile
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "lib/fluent/plugin/azureeventhubs_radiant/version"
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = "fluent-plugin-azureeventhubs-radiant"
|
|
7
|
+
spec.version = Fluent::Plugin::AzureEventHubsRadiant::VERSION
|
|
8
|
+
spec.authors = ["G. Rahul Nutakki"]
|
|
9
|
+
spec.email = ["gnanirn@gmail.com"]
|
|
10
|
+
|
|
11
|
+
spec.summary = "Modernized Fluentd output plugin for Azure Event Hubs"
|
|
12
|
+
spec.description = "A modernized and actively maintained Fluentd output plugin for Azure Event Hubs " \
|
|
13
|
+
"with Ruby 3.x and Fluentd 1.x support. Forked from the original " \
|
|
14
|
+
"fluent-plugin-azureeventhubs with improved security and error handling."
|
|
15
|
+
spec.homepage = "https://github.com/gnanirahulnutakki/fluent-plugin-azureeventhubs-radiant"
|
|
16
|
+
spec.license = "MIT"
|
|
17
|
+
spec.required_ruby_version = ">= 3.0.0"
|
|
18
|
+
|
|
19
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
20
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
|
21
|
+
spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/main/CHANGELOG.md"
|
|
22
|
+
spec.metadata["bug_tracker_uri"] = "#{spec.homepage}/issues"
|
|
23
|
+
spec.metadata["documentation_uri"] = "#{spec.homepage}/blob/main/README.md"
|
|
24
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
|
25
|
+
|
|
26
|
+
spec.files = Dir.glob("lib/**/*") + %w[
|
|
27
|
+
README.md
|
|
28
|
+
LICENSE
|
|
29
|
+
NOTICE
|
|
30
|
+
fluent-plugin-azureeventhubs-radiant.gemspec
|
|
31
|
+
Gemfile
|
|
32
|
+
Rakefile
|
|
33
|
+
]
|
|
34
|
+
spec.require_paths = ["lib"]
|
|
35
|
+
|
|
36
|
+
# Runtime dependencies
|
|
37
|
+
spec.add_dependency "fluentd", ">= 1.16", "< 2.0"
|
|
38
|
+
spec.add_dependency "oj", "~> 3.16"
|
|
39
|
+
|
|
40
|
+
# Development dependencies
|
|
41
|
+
spec.add_development_dependency "bundler", ">= 2.0"
|
|
42
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
|
43
|
+
spec.add_development_dependency "rspec", "~> 3.13"
|
|
44
|
+
spec.add_development_dependency "rubocop", "~> 1.60"
|
|
45
|
+
spec.add_development_dependency "rubocop-rspec", "~> 3.0"
|
|
46
|
+
spec.add_development_dependency "simplecov", "~> 0.22"
|
|
47
|
+
end
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "net/http"
|
|
4
|
+
require "uri"
|
|
5
|
+
require "openssl"
|
|
6
|
+
require "oj"
|
|
7
|
+
require "base64"
|
|
8
|
+
require "cgi"
|
|
9
|
+
require "time"
|
|
10
|
+
|
|
11
|
+
module Fluent
|
|
12
|
+
module Plugin
|
|
13
|
+
module AzureEventHubsRadiant
|
|
14
|
+
class HttpError < StandardError
|
|
15
|
+
attr_reader :response
|
|
16
|
+
|
|
17
|
+
def initialize(message, response = nil)
|
|
18
|
+
super(message)
|
|
19
|
+
@response = response
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# HTTPS Event Hubs sender used by the output plugin.
|
|
24
|
+
class HttpSender
|
|
25
|
+
DEFAULT_EXPIRY = 3600
|
|
26
|
+
DEFAULT_PROXY_PORT = 3128
|
|
27
|
+
DEFAULT_OPEN_TIMEOUT = 60
|
|
28
|
+
DEFAULT_READ_TIMEOUT = 60
|
|
29
|
+
|
|
30
|
+
def initialize(connection_string:, hub_name:, expiry: DEFAULT_EXPIRY,
|
|
31
|
+
proxy_addr: nil, proxy_port: DEFAULT_PROXY_PORT,
|
|
32
|
+
open_timeout: DEFAULT_OPEN_TIMEOUT,
|
|
33
|
+
read_timeout: DEFAULT_READ_TIMEOUT,
|
|
34
|
+
ssl_verify: true,
|
|
35
|
+
coerce_to_utf8: true,
|
|
36
|
+
non_utf8_replacement_string: " ")
|
|
37
|
+
@hub_name = hub_name
|
|
38
|
+
@expiry_interval = expiry.to_i
|
|
39
|
+
@proxy_addr = proxy_addr
|
|
40
|
+
@proxy_port = proxy_port
|
|
41
|
+
@open_timeout = open_timeout
|
|
42
|
+
@read_timeout = read_timeout
|
|
43
|
+
@ssl_verify = ssl_verify
|
|
44
|
+
@coerce_to_utf8 = coerce_to_utf8
|
|
45
|
+
@utf8_replacement = non_utf8_replacement_string
|
|
46
|
+
|
|
47
|
+
parse_connection_string(connection_string)
|
|
48
|
+
build_uri
|
|
49
|
+
|
|
50
|
+
@sas_token = nil
|
|
51
|
+
@sas_token_expiry = nil
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Convenience method (kept, but not named `send` to avoid clobbering Object#send)
|
|
55
|
+
def send_payload(payload)
|
|
56
|
+
send_with_properties(payload, nil)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# Public API used by the Fluentd output plugin.
|
|
60
|
+
def send_with_properties(payload, message_properties)
|
|
61
|
+
body = encode_payload(payload)
|
|
62
|
+
headers = default_headers
|
|
63
|
+
|
|
64
|
+
if message_properties && !message_properties.empty?
|
|
65
|
+
broker_props = {}
|
|
66
|
+
custom_props = {}
|
|
67
|
+
|
|
68
|
+
message_properties.each do |key, value|
|
|
69
|
+
case key.to_s
|
|
70
|
+
when "PartitionKey", "partition_key", "partitionKey"
|
|
71
|
+
broker_props["PartitionKey"] = value
|
|
72
|
+
else
|
|
73
|
+
custom_props[key.to_s] = value
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
headers["BrokerProperties"] = Oj.dump(broker_props, mode: :compat) unless broker_props.empty?
|
|
78
|
+
headers["Properties"] = Oj.dump(custom_props, mode: :compat) unless custom_props.empty?
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
perform_request(body, headers)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
private
|
|
85
|
+
|
|
86
|
+
def parse_connection_string(connection_string)
|
|
87
|
+
parts = connection_string.split(";").map { |item| item.split("=", 2) }.to_h
|
|
88
|
+
|
|
89
|
+
endpoint = parts["Endpoint"] or raise ArgumentError, "Endpoint is missing from connection string"
|
|
90
|
+
@sas_key_name = parts["SharedAccessKeyName"] or raise ArgumentError, "SharedAccessKeyName is missing"
|
|
91
|
+
@sas_key_value = parts["SharedAccessKey"] or raise ArgumentError, "SharedAccessKey is missing"
|
|
92
|
+
|
|
93
|
+
@endpoint_host = endpoint.sub(%r{^sb://}, "").sub(%r{/$}, "")
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def build_uri
|
|
97
|
+
@uri = URI.parse("https://#{@endpoint_host}/#{@hub_name}/messages")
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def default_headers
|
|
101
|
+
{
|
|
102
|
+
"Content-Type" => "application/json; charset=utf-8",
|
|
103
|
+
"Authorization" => current_sas_token
|
|
104
|
+
}
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def current_sas_token
|
|
108
|
+
now = Time.now.to_i
|
|
109
|
+
if @sas_token.nil? || @sas_token_expiry.nil? || now >= @sas_token_expiry - 60
|
|
110
|
+
@sas_token_expiry = now + @expiry_interval
|
|
111
|
+
@sas_token = build_sas_token(@sas_token_expiry)
|
|
112
|
+
end
|
|
113
|
+
@sas_token
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def build_sas_token(expiry)
|
|
117
|
+
resource = @uri.to_s.downcase
|
|
118
|
+
encoded_resource = CGI.escape(resource)
|
|
119
|
+
string_to_sign = "#{encoded_resource}\n#{expiry}"
|
|
120
|
+
|
|
121
|
+
signature = OpenSSL::HMAC.digest("sha256", @sas_key_value, string_to_sign)
|
|
122
|
+
encoded_signature = CGI.escape(Base64.strict_encode64(signature))
|
|
123
|
+
|
|
124
|
+
"SharedAccessSignature sr=#{encoded_resource}&sig=#{encoded_signature}&se=#{expiry}&skn=#{@sas_key_name}"
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
# Encode payload to JSON.
|
|
128
|
+
#
|
|
129
|
+
# Uses Oj in compat mode for better performance and more lenient handling
|
|
130
|
+
# of various Ruby objects compared to the standard JSON library.
|
|
131
|
+
# This helps avoid JSON encoding errors with complex log structures.
|
|
132
|
+
def encode_payload(payload)
|
|
133
|
+
obj = @coerce_to_utf8 ? deep_coerce_to_utf8(payload) : payload
|
|
134
|
+
Oj.dump(obj, mode: :compat)
|
|
135
|
+
rescue Oj::Error => e
|
|
136
|
+
# Fallback: attempt to stringify if JSON encoding fails
|
|
137
|
+
# This handles edge cases where the payload contains non-JSON-serializable objects
|
|
138
|
+
Oj.dump({ "message" => obj.to_s, "error" => "JSON encoding failed: #{e.message}" }, mode: :compat)
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
def deep_coerce_to_utf8(obj)
|
|
142
|
+
case obj
|
|
143
|
+
when String
|
|
144
|
+
return obj if obj.encoding == Encoding::UTF_8 && obj.valid_encoding?
|
|
145
|
+
|
|
146
|
+
obj.encode(
|
|
147
|
+
Encoding::UTF_8,
|
|
148
|
+
invalid: :replace,
|
|
149
|
+
undef: :replace,
|
|
150
|
+
replace: @utf8_replacement
|
|
151
|
+
)
|
|
152
|
+
when Array
|
|
153
|
+
obj.map { |v| deep_coerce_to_utf8(v) }
|
|
154
|
+
when Hash
|
|
155
|
+
obj.each_with_object({}) do |(k, v), acc|
|
|
156
|
+
acc[deep_coerce_to_utf8(k)] = deep_coerce_to_utf8(v)
|
|
157
|
+
end
|
|
158
|
+
else
|
|
159
|
+
obj
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
def perform_request(body, headers)
|
|
164
|
+
http = if @proxy_addr && !@proxy_addr.empty?
|
|
165
|
+
Net::HTTP.new(@uri.host, @uri.port, @proxy_addr, @proxy_port)
|
|
166
|
+
else
|
|
167
|
+
Net::HTTP.new(@uri.host, @uri.port)
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
http.use_ssl = true
|
|
171
|
+
http.open_timeout = @open_timeout
|
|
172
|
+
http.read_timeout = @read_timeout
|
|
173
|
+
http.verify_mode = @ssl_verify ? OpenSSL::SSL::VERIFY_PEER : OpenSSL::SSL::VERIFY_NONE
|
|
174
|
+
|
|
175
|
+
request = Net::HTTP::Post.new(@uri.request_uri)
|
|
176
|
+
headers.each { |k, v| request[k] = v }
|
|
177
|
+
request.body = body
|
|
178
|
+
|
|
179
|
+
response = http.request(request)
|
|
180
|
+
|
|
181
|
+
unless response.is_a?(Net::HTTPSuccess) || response.is_a?(Net::HTTPRedirection)
|
|
182
|
+
raise HttpError.new("Azure Event Hubs HTTP request failed with status #{response.code}", response)
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
true
|
|
186
|
+
rescue StandardError => e
|
|
187
|
+
raise HttpError.new("Azure Event Hubs HTTP request failed: #{e.message}")
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
end
|
|
191
|
+
end
|
|
192
|
+
end
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "fluent/plugin/output"
|
|
4
|
+
require "fluent/plugin/azureeventhubs_radiant/http"
|
|
5
|
+
|
|
6
|
+
module Fluent
|
|
7
|
+
module Plugin
|
|
8
|
+
# Modernized Azure Event Hubs output plugin.
|
|
9
|
+
#
|
|
10
|
+
# This plugin is API-compatible with the original
|
|
11
|
+
# `fluent-plugin-azureeventhubs` `azureeventhubs_buffered` output,
|
|
12
|
+
# but updated for Ruby 3.x / Fluentd 1.x and safer HTTP handling.
|
|
13
|
+
class AzureEventHubsRadiantOutput < Output
|
|
14
|
+
Fluent::Plugin.register_output("azureeventhubs", self)
|
|
15
|
+
# Backward-compatible type name used by the original plugin
|
|
16
|
+
Fluent::Plugin.register_output("azureeventhubs_buffered", self)
|
|
17
|
+
|
|
18
|
+
helpers :compat_parameters, :inject
|
|
19
|
+
|
|
20
|
+
DEFAULT_BUFFER_TYPE = "memory".freeze
|
|
21
|
+
|
|
22
|
+
config_param :connection_string, :string, secret: true
|
|
23
|
+
config_param :hub_name, :string
|
|
24
|
+
config_param :include_tag, :bool, default: false
|
|
25
|
+
config_param :include_time, :bool, default: false
|
|
26
|
+
config_param :tag_time_name, :string, default: "time"
|
|
27
|
+
config_param :expiry_interval, :integer, default: 3600
|
|
28
|
+
config_param :type, :string, default: "https" # https / amqps (not implemented)
|
|
29
|
+
config_param :proxy_addr, :string, default: ""
|
|
30
|
+
config_param :proxy_port, :integer, default: 3128
|
|
31
|
+
config_param :open_timeout, :integer, default: 60
|
|
32
|
+
config_param :read_timeout, :integer, default: 60
|
|
33
|
+
config_param :message_properties,:hash, default: nil
|
|
34
|
+
config_param :batch, :bool, default: false
|
|
35
|
+
config_param :max_batch_size, :integer, default: 20
|
|
36
|
+
config_param :print_records, :bool, default: false
|
|
37
|
+
config_param :ssl_verify, :bool, default: true
|
|
38
|
+
config_param :coerce_to_utf8, :bool, default: true
|
|
39
|
+
config_param :non_utf8_replacement_string, :string, default: " "
|
|
40
|
+
|
|
41
|
+
config_section :buffer do
|
|
42
|
+
config_set_default :@type, DEFAULT_BUFFER_TYPE
|
|
43
|
+
config_set_default :chunk_keys, ["tag"]
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def configure(conf)
|
|
47
|
+
compat_parameters_convert(conf, :buffer, :inject)
|
|
48
|
+
super
|
|
49
|
+
|
|
50
|
+
if @type != "https"
|
|
51
|
+
raise Fluent::ConfigError, "Only type 'https' is supported in azureeventhubs_radiant output"
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
@sender = Fluent::Plugin::AzureEventHubsRadiant::HttpSender.new(
|
|
55
|
+
connection_string: @connection_string,
|
|
56
|
+
hub_name: @hub_name,
|
|
57
|
+
expiry: @expiry_interval,
|
|
58
|
+
proxy_addr: blank_to_nil(@proxy_addr),
|
|
59
|
+
proxy_port: @proxy_port,
|
|
60
|
+
open_timeout: @open_timeout,
|
|
61
|
+
read_timeout: @read_timeout,
|
|
62
|
+
ssl_verify: @ssl_verify,
|
|
63
|
+
coerce_to_utf8: @coerce_to_utf8,
|
|
64
|
+
non_utf8_replacement_string: @non_utf8_replacement_string
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
raise Fluent::ConfigError, "'tag' in chunk_keys is required." unless @chunk_key_tag
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def format(tag, time, record)
|
|
71
|
+
record = inject_values_to_record(tag, time, record)
|
|
72
|
+
[tag, time, record].to_msgpack
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def formatted_to_msgpack_binary?
|
|
76
|
+
true
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def write(chunk)
|
|
80
|
+
if @batch
|
|
81
|
+
write_batched(chunk)
|
|
82
|
+
else
|
|
83
|
+
write_singularly(chunk)
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
private
|
|
88
|
+
|
|
89
|
+
def write_singularly(chunk)
|
|
90
|
+
chunk.msgpack_each do |tag, time, record|
|
|
91
|
+
log.debug { "azureeventhubs: sending single record" }
|
|
92
|
+
log_record(tag, record) if @print_records
|
|
93
|
+
enrich_record(tag, time, record)
|
|
94
|
+
@sender.send_with_properties(record, @message_properties)
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def write_batched(chunk)
|
|
99
|
+
records = []
|
|
100
|
+
|
|
101
|
+
chunk.msgpack_each do |tag, time, record|
|
|
102
|
+
log.debug { "azureeventhubs: queueing record for batch" }
|
|
103
|
+
log_record(tag, record) if @print_records
|
|
104
|
+
enrich_record(tag, time, record)
|
|
105
|
+
records << record
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
records.each_slice(@max_batch_size) do |group|
|
|
109
|
+
payload = { "records" => group }
|
|
110
|
+
@sender.send_with_properties(payload, @message_properties)
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def enrich_record(tag, time, record)
|
|
115
|
+
record["tag"] = tag if @include_tag
|
|
116
|
+
record[@tag_time_name] = time if @include_time
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def log_record(tag, record)
|
|
120
|
+
log.info "azureeventhubs(tag=#{tag}): #{record}"
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def blank_to_nil(value)
|
|
124
|
+
value.nil? || value.empty? ? nil : value
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: fluent-plugin-azureeventhubs-radiant
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- G. Rahul Nutakki
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2025-11-19 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: fluentd
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.16'
|
|
20
|
+
- - "<"
|
|
21
|
+
- !ruby/object:Gem::Version
|
|
22
|
+
version: '2.0'
|
|
23
|
+
type: :runtime
|
|
24
|
+
prerelease: false
|
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
26
|
+
requirements:
|
|
27
|
+
- - ">="
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
version: '1.16'
|
|
30
|
+
- - "<"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '2.0'
|
|
33
|
+
- !ruby/object:Gem::Dependency
|
|
34
|
+
name: oj
|
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - "~>"
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '3.16'
|
|
40
|
+
type: :runtime
|
|
41
|
+
prerelease: false
|
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - "~>"
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '3.16'
|
|
47
|
+
- !ruby/object:Gem::Dependency
|
|
48
|
+
name: bundler
|
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - ">="
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '2.0'
|
|
54
|
+
type: :development
|
|
55
|
+
prerelease: false
|
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - ">="
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '2.0'
|
|
61
|
+
- !ruby/object:Gem::Dependency
|
|
62
|
+
name: rake
|
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - "~>"
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '13.0'
|
|
68
|
+
type: :development
|
|
69
|
+
prerelease: false
|
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - "~>"
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '13.0'
|
|
75
|
+
- !ruby/object:Gem::Dependency
|
|
76
|
+
name: rspec
|
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - "~>"
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '3.13'
|
|
82
|
+
type: :development
|
|
83
|
+
prerelease: false
|
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
85
|
+
requirements:
|
|
86
|
+
- - "~>"
|
|
87
|
+
- !ruby/object:Gem::Version
|
|
88
|
+
version: '3.13'
|
|
89
|
+
- !ruby/object:Gem::Dependency
|
|
90
|
+
name: rubocop
|
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
|
92
|
+
requirements:
|
|
93
|
+
- - "~>"
|
|
94
|
+
- !ruby/object:Gem::Version
|
|
95
|
+
version: '1.60'
|
|
96
|
+
type: :development
|
|
97
|
+
prerelease: false
|
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
99
|
+
requirements:
|
|
100
|
+
- - "~>"
|
|
101
|
+
- !ruby/object:Gem::Version
|
|
102
|
+
version: '1.60'
|
|
103
|
+
- !ruby/object:Gem::Dependency
|
|
104
|
+
name: rubocop-rspec
|
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
|
106
|
+
requirements:
|
|
107
|
+
- - "~>"
|
|
108
|
+
- !ruby/object:Gem::Version
|
|
109
|
+
version: '3.0'
|
|
110
|
+
type: :development
|
|
111
|
+
prerelease: false
|
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
113
|
+
requirements:
|
|
114
|
+
- - "~>"
|
|
115
|
+
- !ruby/object:Gem::Version
|
|
116
|
+
version: '3.0'
|
|
117
|
+
- !ruby/object:Gem::Dependency
|
|
118
|
+
name: simplecov
|
|
119
|
+
requirement: !ruby/object:Gem::Requirement
|
|
120
|
+
requirements:
|
|
121
|
+
- - "~>"
|
|
122
|
+
- !ruby/object:Gem::Version
|
|
123
|
+
version: '0.22'
|
|
124
|
+
type: :development
|
|
125
|
+
prerelease: false
|
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
127
|
+
requirements:
|
|
128
|
+
- - "~>"
|
|
129
|
+
- !ruby/object:Gem::Version
|
|
130
|
+
version: '0.22'
|
|
131
|
+
description: A modernized and actively maintained Fluentd output plugin for Azure
|
|
132
|
+
Event Hubs with Ruby 3.x and Fluentd 1.x support. Forked from the original fluent-plugin-azureeventhubs
|
|
133
|
+
with improved security and error handling.
|
|
134
|
+
email:
|
|
135
|
+
- gnanirn@gmail.com
|
|
136
|
+
executables: []
|
|
137
|
+
extensions: []
|
|
138
|
+
extra_rdoc_files: []
|
|
139
|
+
files:
|
|
140
|
+
- Gemfile
|
|
141
|
+
- LICENSE
|
|
142
|
+
- NOTICE
|
|
143
|
+
- README.md
|
|
144
|
+
- Rakefile
|
|
145
|
+
- fluent-plugin-azureeventhubs-radiant.gemspec
|
|
146
|
+
- lib/fluent/plugin/azureeventhubs_radiant/http.rb
|
|
147
|
+
- lib/fluent/plugin/azureeventhubs_radiant/version.rb
|
|
148
|
+
- lib/fluent/plugin/out_azureeventhubs_radiant.rb
|
|
149
|
+
homepage: https://github.com/gnanirahulnutakki/fluent-plugin-azureeventhubs-radiant
|
|
150
|
+
licenses:
|
|
151
|
+
- MIT
|
|
152
|
+
metadata:
|
|
153
|
+
homepage_uri: https://github.com/gnanirahulnutakki/fluent-plugin-azureeventhubs-radiant
|
|
154
|
+
source_code_uri: https://github.com/gnanirahulnutakki/fluent-plugin-azureeventhubs-radiant
|
|
155
|
+
changelog_uri: https://github.com/gnanirahulnutakki/fluent-plugin-azureeventhubs-radiant/blob/main/CHANGELOG.md
|
|
156
|
+
bug_tracker_uri: https://github.com/gnanirahulnutakki/fluent-plugin-azureeventhubs-radiant/issues
|
|
157
|
+
documentation_uri: https://github.com/gnanirahulnutakki/fluent-plugin-azureeventhubs-radiant/blob/main/README.md
|
|
158
|
+
rubygems_mfa_required: 'true'
|
|
159
|
+
post_install_message:
|
|
160
|
+
rdoc_options: []
|
|
161
|
+
require_paths:
|
|
162
|
+
- lib
|
|
163
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
164
|
+
requirements:
|
|
165
|
+
- - ">="
|
|
166
|
+
- !ruby/object:Gem::Version
|
|
167
|
+
version: 3.0.0
|
|
168
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
|
+
requirements:
|
|
170
|
+
- - ">="
|
|
171
|
+
- !ruby/object:Gem::Version
|
|
172
|
+
version: '0'
|
|
173
|
+
requirements: []
|
|
174
|
+
rubygems_version: 3.5.3
|
|
175
|
+
signing_key:
|
|
176
|
+
specification_version: 4
|
|
177
|
+
summary: Modernized Fluentd output plugin for Azure Event Hubs
|
|
178
|
+
test_files: []
|