fluent-plugin-devo-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/LICENSE +235 -0
- data/NOTICE +19 -0
- data/README.md +77 -0
- data/lib/fluent/plugin/devo_radiant_constants.rb +14 -0
- data/lib/fluent/plugin/out_devo.rb +22 -0
- data/lib/fluent/plugin/out_devo_radiant.rb +191 -0
- data/lib/fluent_plugin_devo_radiant/syslog_tls/facility.rb +53 -0
- data/lib/fluent_plugin_devo_radiant/syslog_tls/logger.rb +76 -0
- data/lib/fluent_plugin_devo_radiant/syslog_tls/lookup_from_const.rb +42 -0
- data/lib/fluent_plugin_devo_radiant/syslog_tls/protocol.rb +133 -0
- data/lib/fluent_plugin_devo_radiant/syslog_tls/severity.rb +37 -0
- data/lib/fluent_plugin_devo_radiant/syslog_tls/ssl_transport.rb +222 -0
- data/lib/fluent_plugin_devo_radiant/syslog_tls/version.rb +24 -0
- metadata +129 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 11587ede4fb7a85c2e3d9994d80514e429ff24785fdde2e61c0ce4fd7621883b
|
|
4
|
+
data.tar.gz: b20e719d8d884847df0aacb90fb6b93a0fabbbc04c3997e815b7ef06c6e9ceab
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 4f1a8ff173b12a657be041f9969df4bc22f69cd33e21ccb0ec72ed27f4cfadab5b9c0c7340ef924d4a2f0fdb6848b923750d98ca71952fd3b57ef16526678769
|
|
7
|
+
data.tar.gz: 3b1f47135ecde3d48a20f335688c29c100fc39d58d290dbe39e50c1704dc48debc5d8bd85232cf8e4d9c3303e5f9d1d9e0d308c2e727853cc90bd12bd99675d7
|
data/LICENSE
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright {yyyy} {name of copyright owner}
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
202
|
+
|
|
203
|
+
-------------------------------------------------------------------------------
|
|
204
|
+
SOFTWARE DISTRIBUTED WITH SUMOLOGIC CLOUD SYSLOG (SyslogTLS's predecessor):
|
|
205
|
+
|
|
206
|
+
The Sumologic Cloud Syslog software includes a number of subcomponents with
|
|
207
|
+
separate copyright notices and license terms. Your use of the source
|
|
208
|
+
code for the these subcomponents is subject to the terms and conditions
|
|
209
|
+
of the following licenses.
|
|
210
|
+
|
|
211
|
+
-------------------------------------------------------------------------------
|
|
212
|
+
|
|
213
|
+
syslog_ruby (https://github.com/johnskopis/syslog_ruby)
|
|
214
|
+
Location: lib/sumologic_cloud_syslog
|
|
215
|
+
From: 'johnskopis' (https://github.com/johnskopis/syslog_ruby)
|
|
216
|
+
License: MIT License
|
|
217
|
+
|
|
218
|
+
Copyright 2009-2015 johnskopis. https://github.com/johnskopis/syslog_ruby
|
|
219
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
220
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
221
|
+
in the Software without restriction, including without limitation the rights
|
|
222
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
223
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
224
|
+
furnished to do so, subject to the following conditions:
|
|
225
|
+
|
|
226
|
+
The above copyright notice and this permission notice shall be included in
|
|
227
|
+
all copies or substantial portions of the Software.
|
|
228
|
+
|
|
229
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
230
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
231
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
232
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
233
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
234
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
235
|
+
THE SOFTWARE.
|
data/NOTICE
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
fluent-plugin-devo-radiant
|
|
2
|
+
Copyright 2026 Radiant Logic, Inc.
|
|
3
|
+
|
|
4
|
+
This product is a derivative work of DevoInc/fluent-plugin-devo version 1.2.0,
|
|
5
|
+
licensed under the Apache License, Version 2.0. The upstream source is available
|
|
6
|
+
at https://github.com/DevoInc/fluent-plugin-devo.
|
|
7
|
+
|
|
8
|
+
The derivative retains the upstream copyright and license notices. Its material
|
|
9
|
+
changes are:
|
|
10
|
+
|
|
11
|
+
- masks the Devo token and client private-key configuration values;
|
|
12
|
+
- uses Fluentd buffering and propagates send failures for chunk retry;
|
|
13
|
+
- supports Fluentd multi-worker operation with a worker-aware synchronized cache;
|
|
14
|
+
- warns when TLS verification is disabled and configures a minimum TLS version;
|
|
15
|
+
- moves the vendored syslog TLS client into a fork-specific Ruby namespace; and
|
|
16
|
+
- registers both the `devo_radiant` and compatibility `devo` output names.
|
|
17
|
+
|
|
18
|
+
The bundled syslog TLS implementation also contains portions attributed in the
|
|
19
|
+
LICENSE file to Acquia, t.e.morgan, JMC, Devo Inc., and syslog_ruby contributors.
|
data/README.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# fluent-plugin-devo-radiant
|
|
2
|
+
|
|
3
|
+
A hardened Fluentd output plugin for sending records to Devo over TLS. This is
|
|
4
|
+
a derivative of [DevoInc/fluent-plugin-devo 1.2.0](https://github.com/DevoInc/fluent-plugin-devo)
|
|
5
|
+
under the Apache License 2.0.
|
|
6
|
+
|
|
7
|
+
## Changes from upstream
|
|
8
|
+
|
|
9
|
+
- Fluentd buffering with retryable chunk failures instead of per-record error swallowing
|
|
10
|
+
- Secret masking for `token` and `client_key`
|
|
11
|
+
- Multi-worker support and synchronized, worker-aware logger caching
|
|
12
|
+
- Peer verification with the system CA store by default
|
|
13
|
+
- Explicit warnings if peer or hostname verification is disabled
|
|
14
|
+
- Configurable minimum TLS version (`TLSv1_2` by default; `TLSv1_3` is supported)
|
|
15
|
+
- Fork-specific namespace for the bundled syslog TLS implementation
|
|
16
|
+
- Both `@type devo_radiant` and `@type devo` registrations
|
|
17
|
+
|
|
18
|
+
Buffered delivery is at least once. If a chunk fails after some records were
|
|
19
|
+
accepted by the remote endpoint, Fluentd retries the chunk and those earlier
|
|
20
|
+
records can be delivered again.
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
fluent-gem install fluent-plugin-devo-radiant
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Configuration
|
|
29
|
+
|
|
30
|
+
```conf
|
|
31
|
+
<match devo.**>
|
|
32
|
+
@type devo_radiant
|
|
33
|
+
host logs.example.invalid
|
|
34
|
+
port 443
|
|
35
|
+
|
|
36
|
+
token YOUR_DEVO_TOKEN
|
|
37
|
+
ca_cert system
|
|
38
|
+
verify_cert_name true
|
|
39
|
+
tls_min_version TLSv1_2
|
|
40
|
+
|
|
41
|
+
# Optional mutual TLS credentials
|
|
42
|
+
client_cert /path/to/client.crt
|
|
43
|
+
client_key /path/to/client.key
|
|
44
|
+
|
|
45
|
+
<format>
|
|
46
|
+
@type json
|
|
47
|
+
</format>
|
|
48
|
+
|
|
49
|
+
<buffer tag>
|
|
50
|
+
@type file
|
|
51
|
+
path /var/log/fluent/devo-buffer
|
|
52
|
+
flush_interval 5s
|
|
53
|
+
retry_forever true
|
|
54
|
+
</buffer>
|
|
55
|
+
</match>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The buffer chunk key defaults to `tag`, so the explicit `<buffer tag>` argument
|
|
59
|
+
above is optional. A persistent file buffer and an intentional retry policy are
|
|
60
|
+
recommended for production durability.
|
|
61
|
+
|
|
62
|
+
Setting `ca_cert false` disables both certificate-chain and hostname
|
|
63
|
+
verification and produces a warning. Setting `verify_cert_name false` disables
|
|
64
|
+
hostname matching only and also produces a warning. Both weaken TLS security.
|
|
65
|
+
|
|
66
|
+
## Development
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
bundle install
|
|
70
|
+
bundle exec rake test
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Attribution and license
|
|
74
|
+
|
|
75
|
+
Copyright notices from the upstream project are retained in derived source
|
|
76
|
+
files. See [NOTICE](NOTICE) for the derivative-work statement and [LICENSE](LICENSE)
|
|
77
|
+
for the Apache License 2.0 and bundled-component notices.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2026 Radiant Logic, Inc.
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
|
|
8
|
+
module Fluent
|
|
9
|
+
module Plugin
|
|
10
|
+
module DevoRadiantConstants
|
|
11
|
+
VERSION = '0.1.0'
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2016 Acquia, Inc.
|
|
4
|
+
# Copyright 2016-2019 t.e.morgan.
|
|
5
|
+
# Copyright 2021 JMC
|
|
6
|
+
# Copyright 2026 Radiant Logic, Inc.
|
|
7
|
+
#
|
|
8
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
# you may not use this file except in compliance with the License.
|
|
10
|
+
# You may obtain a copy of the License at
|
|
11
|
+
#
|
|
12
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
#
|
|
14
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
# See the License for the specific language governing permissions and
|
|
18
|
+
# limitations under the License.
|
|
19
|
+
|
|
20
|
+
# Fluentd resolves `@type devo` by requiring this path. The implementation
|
|
21
|
+
# registers both `devo` and `devo_radiant`.
|
|
22
|
+
require 'fluent/plugin/out_devo_radiant'
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2016 Acquia, Inc.
|
|
4
|
+
# Copyright 2016-2019 t.e.morgan.
|
|
5
|
+
# Copyright 2021 JMC
|
|
6
|
+
# Copyright 2026 Radiant Logic, Inc.
|
|
7
|
+
#
|
|
8
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
# you may not use this file except in compliance with the License.
|
|
10
|
+
# You may obtain a copy of the License at
|
|
11
|
+
#
|
|
12
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
#
|
|
14
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
# See the License for the specific language governing permissions and
|
|
18
|
+
# limitations under the License.
|
|
19
|
+
|
|
20
|
+
require 'msgpack'
|
|
21
|
+
require 'socket'
|
|
22
|
+
require 'fluent/plugin/output'
|
|
23
|
+
require 'fluent_plugin_devo_radiant/syslog_tls/logger'
|
|
24
|
+
require_relative 'devo_radiant_constants'
|
|
25
|
+
|
|
26
|
+
module Fluent
|
|
27
|
+
module Plugin
|
|
28
|
+
class DevoRadiantOutput < Output
|
|
29
|
+
Fluent::Plugin.register_output('devo_radiant', self)
|
|
30
|
+
Fluent::Plugin.register_output('devo', self)
|
|
31
|
+
|
|
32
|
+
helpers :inject, :formatter, :compat_parameters
|
|
33
|
+
|
|
34
|
+
DEFAULT_FORMAT_TYPE = 'json'
|
|
35
|
+
TLS_MIN_VERSIONS = FluentPluginDevoRadiant::SyslogTls::SSLTransport::TLS_MIN_VERSIONS.keys.freeze
|
|
36
|
+
|
|
37
|
+
config_param :host, :string
|
|
38
|
+
config_param :port, :integer
|
|
39
|
+
config_param :idle_timeout, :integer, default: nil
|
|
40
|
+
config_param :ca_cert, :string, default: 'system'
|
|
41
|
+
config_param :verify_cert_name, :bool, default: true
|
|
42
|
+
config_param :token, :string, default: nil, secret: true
|
|
43
|
+
config_param :client_cert, :string, default: nil
|
|
44
|
+
config_param :client_key, :string, default: nil, secret: true
|
|
45
|
+
config_param :hostname, :string, default: nil
|
|
46
|
+
config_param :facility, :string, default: 'LOCAL0'
|
|
47
|
+
config_param :tls_min_version, :enum, list: TLS_MIN_VERSIONS, default: :'TLSv1_2'
|
|
48
|
+
|
|
49
|
+
SYSLOG_HEADERS = %i[severity facility hostname app_name procid msgid].freeze
|
|
50
|
+
|
|
51
|
+
SYSLOG_HEADERS.each do |key_name|
|
|
52
|
+
config_param :"#{key_name}_key", :string, default: nil
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
config_section :buffer do
|
|
56
|
+
config_set_default :chunk_keys, ['tag']
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
config_section :format do
|
|
60
|
+
config_set_default :@type, DEFAULT_FORMAT_TYPE
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
attr_accessor :formatter
|
|
64
|
+
|
|
65
|
+
def initialize
|
|
66
|
+
super
|
|
67
|
+
@loggers = {}
|
|
68
|
+
@loggers_mutex = Mutex.new
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def configure(conf)
|
|
72
|
+
conf['format'] = conf['output_type'] if conf['output_type'] && !conf['format']
|
|
73
|
+
compat_parameters_convert(conf, :inject, :formatter)
|
|
74
|
+
|
|
75
|
+
super
|
|
76
|
+
|
|
77
|
+
@hostname ||= Socket.gethostname.split('.').first
|
|
78
|
+
@mappings = {}
|
|
79
|
+
SYSLOG_HEADERS.each do |key_name|
|
|
80
|
+
conf_key = "#{key_name}_key"
|
|
81
|
+
@mappings[key_name] = conf[conf_key] if conf.key?(conf_key)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
@formatter = formatter_create(conf: conf.elements('format').first, default_type: DEFAULT_FORMAT_TYPE)
|
|
85
|
+
|
|
86
|
+
if peer_verification_disabled?
|
|
87
|
+
log.warn 'TLS peer and hostname verification are disabled because ca_cert is false'
|
|
88
|
+
elsif !verify_cert_name
|
|
89
|
+
log.warn 'TLS hostname verification is disabled because verify_cert_name is false'
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def shutdown
|
|
94
|
+
loggers = @loggers_mutex.synchronize do
|
|
95
|
+
current = @loggers.values
|
|
96
|
+
@loggers = {}
|
|
97
|
+
current
|
|
98
|
+
end
|
|
99
|
+
loggers.each { |cached_logger| cached_logger.close unless cached_logger.closed? }
|
|
100
|
+
super
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def prefer_buffered_processing
|
|
104
|
+
true
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def formatted_to_msgpack_binary?
|
|
108
|
+
true
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def multi_workers_ready?
|
|
112
|
+
true
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def format(tag, time, record)
|
|
116
|
+
record = inject_values_to_record(tag, time, record)
|
|
117
|
+
[time, record].to_msgpack
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def write(chunk)
|
|
121
|
+
tag = chunk.metadata.tag
|
|
122
|
+
raise 'buffer chunk is missing tag metadata' unless tag
|
|
123
|
+
|
|
124
|
+
chunk.msgpack_each do |time, record|
|
|
125
|
+
send_record(tag, time, record)
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# Compatibility path for explicitly non-buffered operation. Errors are
|
|
130
|
+
# intentionally allowed to escape so a failed send is never reported as
|
|
131
|
+
# successful.
|
|
132
|
+
def process(tag, event_stream)
|
|
133
|
+
event_stream.each do |time, record|
|
|
134
|
+
send_record(tag, time, inject_values_to_record(tag, time, record))
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
def logger(tag)
|
|
139
|
+
cache_key = [fluentd_worker_id, tag]
|
|
140
|
+
@loggers_mutex.synchronize do
|
|
141
|
+
cached_logger = @loggers[cache_key]
|
|
142
|
+
if cached_logger.nil? || cached_logger.closed?
|
|
143
|
+
cached_logger = new_logger(tag)
|
|
144
|
+
@loggers[cache_key] = cached_logger
|
|
145
|
+
end
|
|
146
|
+
cached_logger
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
def new_logger(tag)
|
|
151
|
+
transport = FluentPluginDevoRadiant::SyslogTls::SSLTransport.new(
|
|
152
|
+
host,
|
|
153
|
+
port,
|
|
154
|
+
idle_timeout: idle_timeout,
|
|
155
|
+
ca_cert: ca_cert,
|
|
156
|
+
client_cert: client_cert,
|
|
157
|
+
client_key: client_key,
|
|
158
|
+
verify_cert_name: verify_cert_name,
|
|
159
|
+
tls_min_version: tls_min_version,
|
|
160
|
+
max_retries: 3
|
|
161
|
+
)
|
|
162
|
+
syslog_logger = FluentPluginDevoRadiant::SyslogTls::Logger.new(transport, token)
|
|
163
|
+
syslog_logger.facility(facility)
|
|
164
|
+
syslog_logger.hostname(hostname)
|
|
165
|
+
syslog_logger.app_name(tag)
|
|
166
|
+
syslog_logger
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
private
|
|
170
|
+
|
|
171
|
+
def peer_verification_disabled?
|
|
172
|
+
ca_cert == false || ca_cert == 'false'
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
def send_record(tag, time, record)
|
|
176
|
+
severity = if @mappings.key?(:severity)
|
|
177
|
+
record[@mappings[:severity]] || 'INFO'
|
|
178
|
+
else
|
|
179
|
+
'INFO'
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
message = @formatter.format(tag, time, record)
|
|
183
|
+
logger(tag).log(severity, message, time: Time.at(time)) do |header|
|
|
184
|
+
@mappings.each do |name, record_key|
|
|
185
|
+
header.public_send(:"#{name}=", record[record_key]) unless record[record_key].nil?
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
end
|
|
191
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2016 Acquia, Inc.
|
|
4
|
+
# Copyright 2021 Devo .Inc.
|
|
5
|
+
# Copyright 2026 Radiant Logic, Inc.
|
|
6
|
+
#
|
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
# you may not use this file except in compliance with the License.
|
|
9
|
+
# You may obtain a copy of the License at
|
|
10
|
+
#
|
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
#
|
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
# See the License for the specific language governing permissions and
|
|
17
|
+
# limitations under the License.
|
|
18
|
+
|
|
19
|
+
require_relative 'lookup_from_const'
|
|
20
|
+
|
|
21
|
+
module FluentPluginDevoRadiant
|
|
22
|
+
module SyslogTls
|
|
23
|
+
module Facility
|
|
24
|
+
extend LookupFromConst
|
|
25
|
+
|
|
26
|
+
KERN = 0
|
|
27
|
+
USER = 1
|
|
28
|
+
MAIL = 2
|
|
29
|
+
DAEMON = 3
|
|
30
|
+
AUTH = 4
|
|
31
|
+
SYSLOG = 5
|
|
32
|
+
LPR = 6
|
|
33
|
+
NEWS = 7
|
|
34
|
+
UUCP = 8
|
|
35
|
+
CRON = 9
|
|
36
|
+
AUTHPRIV = 10
|
|
37
|
+
FTP = 11
|
|
38
|
+
NTP = 12
|
|
39
|
+
SECURITY = 13
|
|
40
|
+
CONSOLE = 14
|
|
41
|
+
RAS = 15
|
|
42
|
+
LOCAL0 = 16
|
|
43
|
+
LOCAL1 = 17
|
|
44
|
+
LOCAL2 = 18
|
|
45
|
+
LOCAL3 = 19
|
|
46
|
+
LOCAL4 = 20
|
|
47
|
+
LOCAL5 = 21
|
|
48
|
+
LOCAL6 = 22
|
|
49
|
+
LOCAL7 = 23
|
|
50
|
+
NONE = SYSLOG
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2016 Acquia, Inc.
|
|
4
|
+
# Copyright 2016 t.e.morgan.
|
|
5
|
+
# Copyright 2021 Devo .Inc.
|
|
6
|
+
# Copyright 2026 Radiant Logic, Inc.
|
|
7
|
+
#
|
|
8
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
# you may not use this file except in compliance with the License.
|
|
10
|
+
# You may obtain a copy of the License at
|
|
11
|
+
#
|
|
12
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
#
|
|
14
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
# See the License for the specific language governing permissions and
|
|
18
|
+
# limitations under the License.
|
|
19
|
+
|
|
20
|
+
require_relative 'protocol'
|
|
21
|
+
require_relative 'ssl_transport'
|
|
22
|
+
|
|
23
|
+
module FluentPluginDevoRadiant
|
|
24
|
+
module SyslogTls
|
|
25
|
+
class Logger
|
|
26
|
+
attr_reader :token
|
|
27
|
+
attr_accessor :transport
|
|
28
|
+
|
|
29
|
+
def initialize(transport, token = nil)
|
|
30
|
+
@transport = transport
|
|
31
|
+
@token = token
|
|
32
|
+
@default_header = Header.new
|
|
33
|
+
@default_structured_data = StructuredData.new(token)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def facility(value)
|
|
37
|
+
@default_header.facility = value
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def hostname(value)
|
|
41
|
+
@default_header.hostname = value
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def app_name(value)
|
|
45
|
+
@default_header.app_name = value
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def procid(value)
|
|
49
|
+
@default_header.procid = value
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def closed?
|
|
53
|
+
transport && transport.closed?
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def close
|
|
57
|
+
transport.close
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def log(severity, message, time: nil)
|
|
61
|
+
time ||= Time.now
|
|
62
|
+
|
|
63
|
+
syslog_message = Message.new
|
|
64
|
+
syslog_message.structured_data << @default_structured_data
|
|
65
|
+
syslog_message.header = @default_header.dup
|
|
66
|
+
syslog_message.header.severity = severity
|
|
67
|
+
syslog_message.header.timestamp = time
|
|
68
|
+
|
|
69
|
+
yield syslog_message.header if block_given?
|
|
70
|
+
|
|
71
|
+
syslog_message.msg = message
|
|
72
|
+
transport.write(syslog_message.to_s)
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2016 Acquia, Inc.
|
|
4
|
+
# Copyright 2021 Devo .Inc.
|
|
5
|
+
# Copyright 2026 Radiant Logic, Inc.
|
|
6
|
+
#
|
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
# you may not use this file except in compliance with the License.
|
|
9
|
+
# You may obtain a copy of the License at
|
|
10
|
+
#
|
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
#
|
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
# See the License for the specific language governing permissions and
|
|
17
|
+
# limitations under the License.
|
|
18
|
+
|
|
19
|
+
module FluentPluginDevoRadiant
|
|
20
|
+
module SyslogTls
|
|
21
|
+
module LookupFromConst
|
|
22
|
+
def setup_constants(destination)
|
|
23
|
+
constants.each do |priority|
|
|
24
|
+
value = const_get(priority)
|
|
25
|
+
|
|
26
|
+
destination[priority] = value
|
|
27
|
+
destination[priority.downcase] = value
|
|
28
|
+
|
|
29
|
+
destination[:"LOG_#{priority}"] = value
|
|
30
|
+
destination[:"LOG_#{priority.to_s.downcase}"] = value
|
|
31
|
+
const_set(:"LOG_#{priority}", value)
|
|
32
|
+
|
|
33
|
+
destination[priority.to_s] = value
|
|
34
|
+
destination[priority.to_s.downcase] = value
|
|
35
|
+
|
|
36
|
+
destination[value] = value
|
|
37
|
+
destination[value.to_s] = value
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2016 Acquia, Inc.
|
|
4
|
+
# Copyright 2016 t.e.morgan.
|
|
5
|
+
# Copyright 2021 Devo .Inc.
|
|
6
|
+
# Copyright 2026 Radiant Logic, Inc.
|
|
7
|
+
#
|
|
8
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
# you may not use this file except in compliance with the License.
|
|
10
|
+
# You may obtain a copy of the License at
|
|
11
|
+
#
|
|
12
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
#
|
|
14
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
# See the License for the specific language governing permissions and
|
|
18
|
+
# limitations under the License.
|
|
19
|
+
|
|
20
|
+
require 'date'
|
|
21
|
+
|
|
22
|
+
require_relative 'facility'
|
|
23
|
+
require_relative 'severity'
|
|
24
|
+
|
|
25
|
+
module FluentPluginDevoRadiant
|
|
26
|
+
module SyslogTls
|
|
27
|
+
NIL_VALUE = ''
|
|
28
|
+
|
|
29
|
+
class Header
|
|
30
|
+
attr_accessor :version, :hostname, :app_name, :procid, :msgid
|
|
31
|
+
attr_reader :facility, :severity, :timestamp
|
|
32
|
+
|
|
33
|
+
FACILITIES = {}
|
|
34
|
+
SEVERITIES = {}
|
|
35
|
+
|
|
36
|
+
Facility.setup_constants(FACILITIES)
|
|
37
|
+
Severity.setup_constants(SEVERITIES)
|
|
38
|
+
|
|
39
|
+
def initialize
|
|
40
|
+
@timestamp = Time.now
|
|
41
|
+
@severity = 'INFO'
|
|
42
|
+
@facility = 'LOCAL0'
|
|
43
|
+
@version = 1
|
|
44
|
+
@hostname = NIL_VALUE
|
|
45
|
+
@app_name = NIL_VALUE
|
|
46
|
+
@procid = NIL_VALUE
|
|
47
|
+
@msgid = NIL_VALUE
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def timestamp=(value)
|
|
51
|
+
raise ArgumentError, "Must provide Time object value instead: #{value.inspect}" unless value.is_a?(Time)
|
|
52
|
+
|
|
53
|
+
@timestamp = value
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def facility=(value)
|
|
57
|
+
raise ArgumentError, "Invalid facility value: #{value.inspect}" unless FACILITIES.key?(value)
|
|
58
|
+
|
|
59
|
+
@facility = value
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def severity=(value)
|
|
63
|
+
raise ArgumentError, "Invalid severity value: #{value.inspect}" unless SEVERITIES.key?(value)
|
|
64
|
+
|
|
65
|
+
@severity = value
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def pri
|
|
69
|
+
FACILITIES[facility] * 8 + SEVERITIES[severity]
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def assemble
|
|
73
|
+
[
|
|
74
|
+
"<#{pri}>#{timestamp.to_datetime.strftime('%b %d %H:%M:%S')}",
|
|
75
|
+
hostname,
|
|
76
|
+
app_name
|
|
77
|
+
].join(' ')
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def to_s
|
|
81
|
+
assemble
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
class StructuredData
|
|
86
|
+
attr_accessor :id, :data
|
|
87
|
+
|
|
88
|
+
def initialize(id)
|
|
89
|
+
@id = id
|
|
90
|
+
@data = {}
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def assemble
|
|
94
|
+
return NIL_VALUE unless id
|
|
95
|
+
|
|
96
|
+
parts = [id]
|
|
97
|
+
data.each do |key, value|
|
|
98
|
+
value = value.gsub(/(\"|\]|\\)/) { |match| '\\' + match }
|
|
99
|
+
parts << "#{key}=\"#{value}\""
|
|
100
|
+
end
|
|
101
|
+
"[#{parts.join(' ')}]"
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def to_s
|
|
105
|
+
assemble
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
class Message
|
|
110
|
+
attr_accessor :structured_data, :msg
|
|
111
|
+
attr_writer :header
|
|
112
|
+
|
|
113
|
+
def initialize
|
|
114
|
+
@msg = ''
|
|
115
|
+
@structured_data = []
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def header
|
|
119
|
+
@header ||= Header.new
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def assemble
|
|
123
|
+
output = [header.to_s]
|
|
124
|
+
output << msg if msg.length.positive?
|
|
125
|
+
output.join(' ') + "\n"
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def to_s
|
|
129
|
+
assemble
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2016 Acquia, Inc.
|
|
4
|
+
# Copyright 2021 Devo .Inc.
|
|
5
|
+
# Copyright 2026 Radiant Logic, Inc.
|
|
6
|
+
#
|
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
# you may not use this file except in compliance with the License.
|
|
9
|
+
# You may obtain a copy of the License at
|
|
10
|
+
#
|
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
#
|
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
# See the License for the specific language governing permissions and
|
|
17
|
+
# limitations under the License.
|
|
18
|
+
|
|
19
|
+
require_relative 'lookup_from_const'
|
|
20
|
+
|
|
21
|
+
module FluentPluginDevoRadiant
|
|
22
|
+
module SyslogTls
|
|
23
|
+
module Severity
|
|
24
|
+
extend LookupFromConst
|
|
25
|
+
|
|
26
|
+
EMERG = PANIC = 0
|
|
27
|
+
ALERT = 1
|
|
28
|
+
CRIT = 2
|
|
29
|
+
ERR = ERROR = 3
|
|
30
|
+
WARN = WARNING = 4
|
|
31
|
+
NOTICE = 5
|
|
32
|
+
INFO = 6
|
|
33
|
+
DEBUG = 7
|
|
34
|
+
NONE = 10
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2016 Acquia, Inc.
|
|
4
|
+
# Copyright 2016-2019 t.e.morgan.
|
|
5
|
+
# Copyright 2021 Devo .Inc.
|
|
6
|
+
# Copyright 2026 Radiant Logic, Inc.
|
|
7
|
+
#
|
|
8
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
# you may not use this file except in compliance with the License.
|
|
10
|
+
# You may obtain a copy of the License at
|
|
11
|
+
#
|
|
12
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
#
|
|
14
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
# See the License for the specific language governing permissions and
|
|
18
|
+
# limitations under the License.
|
|
19
|
+
|
|
20
|
+
require 'openssl'
|
|
21
|
+
require 'rbconfig'
|
|
22
|
+
require 'socket'
|
|
23
|
+
|
|
24
|
+
module FluentPluginDevoRadiant
|
|
25
|
+
module SyslogTls
|
|
26
|
+
class SSLTransport
|
|
27
|
+
CONNECT_TIMEOUT = 10
|
|
28
|
+
WRITE_TIMEOUT = 5
|
|
29
|
+
|
|
30
|
+
TLS_MIN_VERSIONS = {
|
|
31
|
+
:'TLSv1_2' => OpenSSL::SSL::TLS1_2_VERSION
|
|
32
|
+
}.tap do |versions|
|
|
33
|
+
versions[:'TLSv1_3'] = OpenSSL::SSL::TLS1_3_VERSION if defined?(OpenSSL::SSL::TLS1_3_VERSION)
|
|
34
|
+
end.freeze
|
|
35
|
+
|
|
36
|
+
attr_accessor :socket
|
|
37
|
+
attr_reader :host, :port, :idle_timeout, :ca_cert, :client_cert, :client_key,
|
|
38
|
+
:verify_cert_name, :tls_min_version
|
|
39
|
+
attr_writer :retries
|
|
40
|
+
|
|
41
|
+
def initialize(host, port, idle_timeout: nil, ca_cert: 'system', client_cert: nil,
|
|
42
|
+
client_key: nil, verify_cert_name: true, tls_min_version: :'TLSv1_2',
|
|
43
|
+
max_retries: 1)
|
|
44
|
+
@host = host
|
|
45
|
+
@port = port
|
|
46
|
+
@idle_timeout = idle_timeout
|
|
47
|
+
@ca_cert = ca_cert
|
|
48
|
+
@client_cert = client_cert
|
|
49
|
+
@client_key = client_key
|
|
50
|
+
@verify_cert_name = verify_cert_name
|
|
51
|
+
@tls_min_version = tls_min_version.to_sym
|
|
52
|
+
@retries = max_retries
|
|
53
|
+
@write_mutex = Mutex.new
|
|
54
|
+
|
|
55
|
+
raise ArgumentError, "Unsupported minimum TLS version: #{tls_min_version}" unless
|
|
56
|
+
TLS_MIN_VERSIONS.key?(@tls_min_version)
|
|
57
|
+
|
|
58
|
+
connect
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def connect
|
|
62
|
+
@socket = get_ssl_connection
|
|
63
|
+
begin
|
|
64
|
+
begin
|
|
65
|
+
@socket.connect_nonblock
|
|
66
|
+
rescue Errno::EAGAIN, Errno::EWOULDBLOCK, IO::WaitReadable
|
|
67
|
+
select_with_timeout(@socket, :connect_read) && retry
|
|
68
|
+
rescue IO::WaitWritable
|
|
69
|
+
select_with_timeout(@socket, :connect_write) && retry
|
|
70
|
+
end
|
|
71
|
+
rescue Errno::ETIMEDOUT
|
|
72
|
+
raise 'Socket timeout during connect'
|
|
73
|
+
end
|
|
74
|
+
@last_write = Time.now if idle_timeout
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def get_tcp_connection
|
|
78
|
+
tcp = nil
|
|
79
|
+
family = Socket::Constants::AF_UNSPEC
|
|
80
|
+
socket_type = Socket::Constants::SOCK_STREAM
|
|
81
|
+
address_info = Socket.getaddrinfo(host, port, family, socket_type, nil, nil, false).first
|
|
82
|
+
_, resolved_port, _, address, family, socket_type = address_info
|
|
83
|
+
|
|
84
|
+
begin
|
|
85
|
+
socket_address = Socket.sockaddr_in(resolved_port, address)
|
|
86
|
+
tcp = Socket.new(family, socket_type, 0)
|
|
87
|
+
tcp.setsockopt(Socket::SOL_SOCKET, Socket::Constants::SO_REUSEADDR, false)
|
|
88
|
+
unless RbConfig::CONFIG['host_os'].match?(/mswin|mingw|cygwin/)
|
|
89
|
+
tcp.setsockopt(Socket::SOL_SOCKET, Socket::Constants::SO_REUSEPORT, false)
|
|
90
|
+
end
|
|
91
|
+
tcp.connect_nonblock(socket_address)
|
|
92
|
+
rescue Errno::EINPROGRESS
|
|
93
|
+
select_with_timeout(tcp, :connect_write)
|
|
94
|
+
begin
|
|
95
|
+
tcp.connect_nonblock(socket_address)
|
|
96
|
+
rescue Errno::EISCONN
|
|
97
|
+
# Connected.
|
|
98
|
+
rescue SystemCallError
|
|
99
|
+
tcp.close rescue nil
|
|
100
|
+
raise
|
|
101
|
+
end
|
|
102
|
+
rescue SystemCallError
|
|
103
|
+
tcp.close rescue nil
|
|
104
|
+
raise
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
tcp.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, true)
|
|
108
|
+
tcp
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def get_ssl_connection
|
|
112
|
+
tcp = get_tcp_connection
|
|
113
|
+
context = build_ssl_context
|
|
114
|
+
ssl_socket = OpenSSL::SSL::SSLSocket.new(tcp, context)
|
|
115
|
+
ssl_socket.hostname = host
|
|
116
|
+
ssl_socket.sync_close = true
|
|
117
|
+
ssl_socket
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def write(string)
|
|
121
|
+
@write_mutex.synchronize { write_with_retries(string) }
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def do_write(data)
|
|
125
|
+
data = data.dup.force_encoding(Encoding::BINARY)
|
|
126
|
+
loop do
|
|
127
|
+
sent = 0
|
|
128
|
+
begin
|
|
129
|
+
sent = @socket.write_nonblock(data)
|
|
130
|
+
rescue OpenSSL::SSL::SSLError, Errno::EAGAIN, Errno::EWOULDBLOCK, IO::WaitWritable => error
|
|
131
|
+
if error.is_a?(OpenSSL::SSL::SSLError) && error.message !~ /write would block/
|
|
132
|
+
raise error
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
select_with_timeout(@socket, :write) && retry
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
break if sent >= data.bytesize
|
|
139
|
+
|
|
140
|
+
data = data.byteslice(sent, data.bytesize - sent)
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def select_with_timeout(tcp, type)
|
|
145
|
+
arguments = case type
|
|
146
|
+
when :connect_read
|
|
147
|
+
[[tcp], nil, nil, CONNECT_TIMEOUT]
|
|
148
|
+
when :connect_write
|
|
149
|
+
[nil, [tcp], nil, CONNECT_TIMEOUT]
|
|
150
|
+
when :write
|
|
151
|
+
[nil, [tcp], nil, WRITE_TIMEOUT]
|
|
152
|
+
else
|
|
153
|
+
raise "Unknown select type #{type}"
|
|
154
|
+
end
|
|
155
|
+
IO.select(*arguments) || raise("Socket timeout during #{type}")
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
def method_missing(method_name, *arguments, &block)
|
|
159
|
+
return super unless @socket.respond_to?(method_name)
|
|
160
|
+
|
|
161
|
+
@socket.public_send(method_name, *arguments, &block)
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
def respond_to_missing?(method_name, include_private = false)
|
|
165
|
+
@socket.respond_to?(method_name, include_private) || super
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
private
|
|
169
|
+
|
|
170
|
+
def build_ssl_context
|
|
171
|
+
context = OpenSSL::SSL::SSLContext.new
|
|
172
|
+
context.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
|
173
|
+
context.verify_hostname = verify_cert_name != false
|
|
174
|
+
configure_tls_min_version(context)
|
|
175
|
+
|
|
176
|
+
case ca_cert
|
|
177
|
+
when true, 'true', 'system'
|
|
178
|
+
context.cert_store = OpenSSL::X509::Store.new
|
|
179
|
+
context.cert_store.set_default_paths
|
|
180
|
+
when false, 'false'
|
|
181
|
+
context.verify_hostname = false
|
|
182
|
+
context.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
|
183
|
+
when %r{/$}
|
|
184
|
+
context.ca_path = ca_cert
|
|
185
|
+
when String
|
|
186
|
+
context.ca_file = ca_cert
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
context.cert = OpenSSL::X509::Certificate.new(File.read(client_cert)) if client_cert
|
|
190
|
+
context.key = OpenSSL::PKey.read(File.read(client_key)) if client_key
|
|
191
|
+
context
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
def configure_tls_min_version(context)
|
|
195
|
+
context.min_version = TLS_MIN_VERSIONS.fetch(tls_min_version)
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
def write_with_retries(string)
|
|
199
|
+
if idle_timeout
|
|
200
|
+
if (now = Time.now) > @last_write + idle_timeout
|
|
201
|
+
@socket.close rescue nil
|
|
202
|
+
connect
|
|
203
|
+
else
|
|
204
|
+
@last_write = now
|
|
205
|
+
end
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
begin
|
|
209
|
+
retry_id ||= 0
|
|
210
|
+
do_write(string)
|
|
211
|
+
rescue StandardError => error
|
|
212
|
+
if (retry_id += 1) < @retries
|
|
213
|
+
@socket.close rescue nil
|
|
214
|
+
connect
|
|
215
|
+
retry
|
|
216
|
+
end
|
|
217
|
+
raise error
|
|
218
|
+
end
|
|
219
|
+
end
|
|
220
|
+
end
|
|
221
|
+
end
|
|
222
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2016 Acquia, Inc.
|
|
4
|
+
# Copyright 2016-2019 t.e.morgan.
|
|
5
|
+
# Copyright 2021 Devo .Inc.
|
|
6
|
+
# Copyright 2026 Radiant Logic, Inc.
|
|
7
|
+
#
|
|
8
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
# you may not use this file except in compliance with the License.
|
|
10
|
+
# You may obtain a copy of the License at
|
|
11
|
+
#
|
|
12
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
#
|
|
14
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
# See the License for the specific language governing permissions and
|
|
18
|
+
# limitations under the License.
|
|
19
|
+
|
|
20
|
+
module FluentPluginDevoRadiant
|
|
21
|
+
module SyslogTls
|
|
22
|
+
VERSION = '1.2.0'
|
|
23
|
+
end
|
|
24
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: fluent-plugin-devo-radiant
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Radiant Logic, Inc.
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2026-09-03 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'
|
|
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'
|
|
33
|
+
- !ruby/object:Gem::Dependency
|
|
34
|
+
name: bundler
|
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '2'
|
|
40
|
+
- - "<"
|
|
41
|
+
- !ruby/object:Gem::Version
|
|
42
|
+
version: '3'
|
|
43
|
+
type: :development
|
|
44
|
+
prerelease: false
|
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
46
|
+
requirements:
|
|
47
|
+
- - ">="
|
|
48
|
+
- !ruby/object:Gem::Version
|
|
49
|
+
version: '2'
|
|
50
|
+
- - "<"
|
|
51
|
+
- !ruby/object:Gem::Version
|
|
52
|
+
version: '3'
|
|
53
|
+
- !ruby/object:Gem::Dependency
|
|
54
|
+
name: rake
|
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
|
56
|
+
requirements:
|
|
57
|
+
- - "~>"
|
|
58
|
+
- !ruby/object:Gem::Version
|
|
59
|
+
version: '13.0'
|
|
60
|
+
type: :development
|
|
61
|
+
prerelease: false
|
|
62
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
63
|
+
requirements:
|
|
64
|
+
- - "~>"
|
|
65
|
+
- !ruby/object:Gem::Version
|
|
66
|
+
version: '13.0'
|
|
67
|
+
- !ruby/object:Gem::Dependency
|
|
68
|
+
name: test-unit
|
|
69
|
+
requirement: !ruby/object:Gem::Requirement
|
|
70
|
+
requirements:
|
|
71
|
+
- - "~>"
|
|
72
|
+
- !ruby/object:Gem::Version
|
|
73
|
+
version: '3.6'
|
|
74
|
+
type: :development
|
|
75
|
+
prerelease: false
|
|
76
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
77
|
+
requirements:
|
|
78
|
+
- - "~>"
|
|
79
|
+
- !ruby/object:Gem::Version
|
|
80
|
+
version: '3.6'
|
|
81
|
+
description: A production-hardened fork of fluent-plugin-devo 1.2.0 with buffered
|
|
82
|
+
retry semantics, credential masking, multi-worker support, configurable minimum
|
|
83
|
+
TLS versions, and a collision-free vendored syslog TLS namespace.
|
|
84
|
+
email:
|
|
85
|
+
- support@radiantlogic.com
|
|
86
|
+
executables: []
|
|
87
|
+
extensions: []
|
|
88
|
+
extra_rdoc_files: []
|
|
89
|
+
files:
|
|
90
|
+
- LICENSE
|
|
91
|
+
- NOTICE
|
|
92
|
+
- README.md
|
|
93
|
+
- lib/fluent/plugin/devo_radiant_constants.rb
|
|
94
|
+
- lib/fluent/plugin/out_devo.rb
|
|
95
|
+
- lib/fluent/plugin/out_devo_radiant.rb
|
|
96
|
+
- lib/fluent_plugin_devo_radiant/syslog_tls/facility.rb
|
|
97
|
+
- lib/fluent_plugin_devo_radiant/syslog_tls/logger.rb
|
|
98
|
+
- lib/fluent_plugin_devo_radiant/syslog_tls/lookup_from_const.rb
|
|
99
|
+
- lib/fluent_plugin_devo_radiant/syslog_tls/protocol.rb
|
|
100
|
+
- lib/fluent_plugin_devo_radiant/syslog_tls/severity.rb
|
|
101
|
+
- lib/fluent_plugin_devo_radiant/syslog_tls/ssl_transport.rb
|
|
102
|
+
- lib/fluent_plugin_devo_radiant/syslog_tls/version.rb
|
|
103
|
+
homepage: https://github.com/gnanirahulnutakki/fluent-plugin-devo-radiant
|
|
104
|
+
licenses:
|
|
105
|
+
- Apache-2.0
|
|
106
|
+
metadata:
|
|
107
|
+
bug_tracker_uri: https://github.com/gnanirahulnutakki/fluent-plugin-devo-radiant/issues
|
|
108
|
+
source_code_uri: https://github.com/gnanirahulnutakki/fluent-plugin-devo-radiant
|
|
109
|
+
rubygems_mfa_required: 'true'
|
|
110
|
+
post_install_message:
|
|
111
|
+
rdoc_options: []
|
|
112
|
+
require_paths:
|
|
113
|
+
- lib
|
|
114
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
115
|
+
requirements:
|
|
116
|
+
- - ">="
|
|
117
|
+
- !ruby/object:Gem::Version
|
|
118
|
+
version: 3.1.0
|
|
119
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
|
+
requirements:
|
|
121
|
+
- - ">="
|
|
122
|
+
- !ruby/object:Gem::Version
|
|
123
|
+
version: '0'
|
|
124
|
+
requirements: []
|
|
125
|
+
rubygems_version: 3.5.3
|
|
126
|
+
signing_key:
|
|
127
|
+
specification_version: 4
|
|
128
|
+
summary: Hardened Fluentd TLS output plugin for Devo
|
|
129
|
+
test_files: []
|