fluent-plugin-f5-beacon 0.0.1
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/.gitignore +26 -0
- data/Gemfile +6 -0
- data/LICENSE +201 -0
- data/README.md +76 -0
- data/Rakefile +10 -0
- data/SUPPORT.md +1 -0
- data/TERMS OF USE.txt +1 -0
- data/fluent-plugin-f5-beacon.gemspec +25 -0
- data/lib/fluent/plugin/out_f5_beacon.rb +224 -0
- data/test/plugin/test_out_f5_beacon.rb +415 -0
- data/test/test_helper.rb +52 -0
- metadata +138 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 122e12c823083c65edad68dc9d478187601e9ae1b79659097834e55ab142d01e
|
4
|
+
data.tar.gz: de0235a5a604e94af08819f147b962431492684cdb92cf1cbcb41fc4b50c32db
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5fff45597fbbb9e9647d37166e70de5396c0b30c47550a6215047f2f7258636d36eca0c332795aae1d939132f92391747a0937cf0ae4a04e1d52ac98f4729e43
|
7
|
+
data.tar.gz: 7805ed6fcdbc99d23815f1d0edab6c5337df6fa6289fd5496ce7590ff4a09906939333156530aacb1f3aa5d37eae6c7f4ceaae3f68f18aa1a6299a35699fc12d
|
data/.gitignore
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
## Documentation cache and generated files:
|
14
|
+
/.yardoc/
|
15
|
+
/_yardoc/
|
16
|
+
/doc/
|
17
|
+
/rdoc/
|
18
|
+
|
19
|
+
## Environment normalization:
|
20
|
+
/.bundle/
|
21
|
+
/vendor/bundle
|
22
|
+
/lib/bundler/man/
|
23
|
+
|
24
|
+
Gemfile.lock
|
25
|
+
.rakeTasks
|
26
|
+
*.iml
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,201 @@
|
|
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 2020 F5 Networks, Inc.
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
# Fluent::Plugin::Beacon, a plugin for [Fluentd](http://fluentd.org)
|
2
|
+
|
3
|
+
fluent-plugin-f5-beacon is a buffered output plugin for Fluentd and F5 Beacon.
|
4
|
+
|
5
|
+
## Requirements
|
6
|
+
|
7
|
+
| fluent-plugin-f5-beacon | fluentd | ruby |
|
8
|
+
|------------------------|---------|------|
|
9
|
+
| * | >= v1.0.0 | >= 2.3 |
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
$ fluent-gem install fluent-plugin-f5-beacon
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
Just like other regular output plugins, use type `f5-beacon` in your Fluentd configuration under `match` scope:
|
18
|
+
|
19
|
+
`@type` `f5_beacon`
|
20
|
+
|
21
|
+
--------------
|
22
|
+
|
23
|
+
**Options:**
|
24
|
+
|
25
|
+
`source_name`: The name of the source within Beacon. This is required.
|
26
|
+
|
27
|
+
`token`: The Beacon ingestion token to be used. This is required.
|
28
|
+
|
29
|
+
`measurement`: The measurement/series to use. The default is nil. If not specified, Fluentd's tag is used.
|
30
|
+
|
31
|
+
`time_key`: Use the value of this tag if it exists in the event instead of the event timestamp.
|
32
|
+
|
33
|
+
`auto_tags`: Enable/disable auto-tagging behavior which makes strings tags. The default is false.
|
34
|
+
|
35
|
+
`tag_keys`: The names of the keys to use as tags instead of fields.
|
36
|
+
|
37
|
+
`sequence_tag`: The name of the tag whose value is incremented for the consecutive simultaneous events and reset to zero for a new event with the different timestamp.
|
38
|
+
|
39
|
+
`cast_number_to_float`: Enable/disable casting numbers to floats. Within a measurement, a given field must be integer or float. If your pipeline cannot unify the record value, this parameter may help avoid errors due to type conflicts.
|
40
|
+
|
41
|
+
## Configuration Example
|
42
|
+
|
43
|
+
```
|
44
|
+
<match mylog.*>
|
45
|
+
@type f5_beacon
|
46
|
+
source_name server1
|
47
|
+
token a-123456789#token
|
48
|
+
tag_keys ["key1", "key2"]
|
49
|
+
</match>
|
50
|
+
```
|
51
|
+
|
52
|
+
## Cache and multiprocess
|
53
|
+
|
54
|
+
The plugin is a buffered output plugin. So additional buffer configuration (with default values) looks like:
|
55
|
+
|
56
|
+
```
|
57
|
+
<buffer>
|
58
|
+
@type memory
|
59
|
+
chunk_limit_size 524288 # 512 * 1024
|
60
|
+
chunk_limit_records 1024
|
61
|
+
flush_interval 60
|
62
|
+
retry_limit 17
|
63
|
+
retry_wait 1.0
|
64
|
+
num_threads 1
|
65
|
+
</buffer>
|
66
|
+
```
|
67
|
+
|
68
|
+
Details around buffering can be found [here](https://docs.fluentd.org/buffer).
|
69
|
+
|
70
|
+
---
|
71
|
+
|
72
|
+
## Unit tests
|
73
|
+
|
74
|
+
```
|
75
|
+
bundle exec rake test
|
76
|
+
```
|
data/Rakefile
ADDED
data/SUPPORT.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Maintenance and F5 Technical Support of the F5 code is provided only if the software (i) is unmodified; and (ii) has been marked as F5 Supported in SOL80012344, (https://support.f5.com/csp/article/K80012344). Support will only be provided to customers who have an existing support contract, purchased separately, subject to F5’s support policies available at http://www.f5.com/about/guidelines-policies/ and http://askf5.com.
|
data/TERMS OF USE.txt
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
THIS LICENSE AGREEMENT IS ENTERED INTO BETWEEN THE SUBMITTING PARTY AND F5 NETWORKS, INC. AND THE SUBMITTING PARTY AGREES TO BE BOUND BY THE TERMS OF THIS AGREEMENT BY SUBMITTING, POSTING, DOWNLOADING, COPYING, MODIFYING, INPUTTING, INSTALLATION, UPLOAD OR OTHER USE OF F5 MATERIALS AND THE SUBMISSIONS. IF YOU DO NOT AGREE TO THE FOREGOING, DO NOT POST THE SUBMISSIONS OR USE THE F5 MATERIALS.
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "fluent-plugin-f5-beacon"
|
6
|
+
s.version = '0.0.1'
|
7
|
+
s.authors = ["Matt Davey"]
|
8
|
+
s.email = ["m.davey@f5.com"]
|
9
|
+
s.description = %q{F5 Beacon output plugin for Fluentd}
|
10
|
+
s.summary = %q{A buffered output plugin for Fluentd and F5 Beacon}
|
11
|
+
s.homepage = "https://github.com/f5devcentral/fluent-plugin-f5-beacon"
|
12
|
+
s.license = "Apache-2.0"
|
13
|
+
|
14
|
+
s.files = `git ls-files`.split($/)
|
15
|
+
s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
16
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
|
19
|
+
s.add_runtime_dependency "fluentd", [">= 1.0", "< 2"]
|
20
|
+
s.add_runtime_dependency "influxdb", [">= 0.8.0", "< 1"]
|
21
|
+
|
22
|
+
s.add_development_dependency "rake"
|
23
|
+
s.add_development_dependency "pry"
|
24
|
+
s.add_development_dependency "test-unit"
|
25
|
+
end
|
@@ -0,0 +1,224 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2020 F5 Networks, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
# encoding: UTF-8
|
17
|
+
require 'date'
|
18
|
+
require 'fluent/mixin'
|
19
|
+
require 'fluent/plugin/output'
|
20
|
+
require 'influxdb'
|
21
|
+
require 'net/http'
|
22
|
+
require 'openssl'
|
23
|
+
require 'uri'
|
24
|
+
|
25
|
+
module Fluent::Plugin class BeaconOutput < Output
|
26
|
+
Fluent::Plugin.register_output('f5_beacon', self)
|
27
|
+
|
28
|
+
helpers :compat_parameters
|
29
|
+
|
30
|
+
DEFAULT_BUFFER_TYPE = "memory"
|
31
|
+
|
32
|
+
config_param :endpoint, :string, default: 'https://ingestion.ovr.prd.f5aas.com:50443/beacon/v1/ingest-metrics',
|
33
|
+
desc: "The target endpoint for sending data."
|
34
|
+
config_param :token, :string, desc: "The Beacon access token. This is a required field."
|
35
|
+
config_param :source_name, :string, desc: "The source name shown in Beacon. This is a required field."
|
36
|
+
config_param :measurement, :string, default: nil,
|
37
|
+
desc: "The measurement name to insert event. If not specified, fluentd's tag is used."
|
38
|
+
config_param :time_key, :string, default: 'time',
|
39
|
+
desc: 'Use value of this tag if it exists in event instead of event timestamp.'
|
40
|
+
config_param :auto_tags, :bool, default: false,
|
41
|
+
desc: "Enable/disable auto-tagging behavior which makes strings tags."
|
42
|
+
config_param :tag_keys, :array, default: [],
|
43
|
+
desc: "The names of the keys to use as tags."
|
44
|
+
config_param :sequence_tag, :string, default: nil,
|
45
|
+
desc: <<-DESC
|
46
|
+
The name of the tag whose value is incremented for the consecutive simultaneous
|
47
|
+
events and reset to zero for a new event with the different timestamp.
|
48
|
+
DESC
|
49
|
+
config_param :cast_number_to_float, :bool, default: false,
|
50
|
+
desc: "Enable/disable casting numbers to float."
|
51
|
+
|
52
|
+
config_section :buffer do
|
53
|
+
config_set_default :@type, DEFAULT_BUFFER_TYPE
|
54
|
+
config_set_default :chunk_keys, ['tag']
|
55
|
+
end
|
56
|
+
|
57
|
+
def initialize
|
58
|
+
super
|
59
|
+
@seq = 0
|
60
|
+
@prev_timestamp = nil
|
61
|
+
end
|
62
|
+
|
63
|
+
def configure(conf)
|
64
|
+
compat_parameters_convert(conf, :buffer)
|
65
|
+
super
|
66
|
+
raise Fluent::ConfigError, "'tag' in chunk_keys is required." if not @chunk_key_tag
|
67
|
+
end
|
68
|
+
|
69
|
+
def start
|
70
|
+
super
|
71
|
+
log.info "Starting F5 Beacon plugin..."
|
72
|
+
end
|
73
|
+
|
74
|
+
FORMATTED_RESULT_FOR_INVALID_RECORD = ''.freeze
|
75
|
+
|
76
|
+
def format(tag, time, record)
|
77
|
+
# Remove nil/empty values
|
78
|
+
record.delete_if { |k, v| v.nil? || v.to_s.empty? }
|
79
|
+
|
80
|
+
if record.empty?
|
81
|
+
log.warn "Skip record '#{record}' in '#{tag}', because record has no values"
|
82
|
+
FORMATTED_RESULT_FOR_INVALID_RECORD
|
83
|
+
else
|
84
|
+
[precision_time(time), record].to_msgpack
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def shutdown
|
89
|
+
super
|
90
|
+
end
|
91
|
+
|
92
|
+
def formatted_to_msgpack_binary
|
93
|
+
true
|
94
|
+
end
|
95
|
+
|
96
|
+
def multi_workers_ready?
|
97
|
+
true
|
98
|
+
end
|
99
|
+
|
100
|
+
def write(chunk)
|
101
|
+
points = []
|
102
|
+
tag = chunk.metadata.tag
|
103
|
+
chunk.msgpack_each do |time, record|
|
104
|
+
timestamp = record.delete(@time_key) || time
|
105
|
+
if tag_keys.empty? && !@auto_tags
|
106
|
+
values = record
|
107
|
+
tags = {}
|
108
|
+
else
|
109
|
+
values = {}
|
110
|
+
tags = {}
|
111
|
+
record.each_pair do |k, v|
|
112
|
+
if (@auto_tags && v.is_a?(String)) || @tag_keys.include?(k)
|
113
|
+
# If the tag value is not nil, empty, or a space, add the tag
|
114
|
+
if v.to_s.strip != ''
|
115
|
+
tags[k] = v
|
116
|
+
end
|
117
|
+
else
|
118
|
+
values[k] = v
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
if @sequence_tag
|
123
|
+
if @prev_timestamp == timestamp
|
124
|
+
@seq += 1
|
125
|
+
else
|
126
|
+
@seq = 0
|
127
|
+
end
|
128
|
+
tags[@sequence_tag] = @seq
|
129
|
+
@prev_timestamp = timestamp
|
130
|
+
end
|
131
|
+
|
132
|
+
if values.empty?
|
133
|
+
log.warn "Skip record '#{record}', because InfluxDB requires at least one value in raw"
|
134
|
+
next
|
135
|
+
end
|
136
|
+
|
137
|
+
if @cast_number_to_float
|
138
|
+
values.each do |key, value|
|
139
|
+
if value.is_a?(Integer)
|
140
|
+
values[key] = Float(value)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
tags["beacon-fluent-source"] = @source_name
|
146
|
+
|
147
|
+
point = {
|
148
|
+
timestamp: timestamp,
|
149
|
+
series: @measurement || tag,
|
150
|
+
values: values,
|
151
|
+
tags: tags,
|
152
|
+
}
|
153
|
+
points << point
|
154
|
+
end
|
155
|
+
|
156
|
+
write_points(points)
|
157
|
+
end
|
158
|
+
|
159
|
+
def write_points(points)
|
160
|
+
payload = serialize(points)
|
161
|
+
handle_payload(payload)
|
162
|
+
end
|
163
|
+
|
164
|
+
def serialize(points)
|
165
|
+
points.map do |point|
|
166
|
+
InfluxDB::PointValue.new(point).dump
|
167
|
+
end.join("\n".freeze)
|
168
|
+
end
|
169
|
+
|
170
|
+
def precision_time(time)
|
171
|
+
# nsec is supported from v0.14
|
172
|
+
time * (10 ** 9) + (time.is_a?(Integer) ? 0 : time.nsec)
|
173
|
+
end
|
174
|
+
|
175
|
+
def handle_payload(payload)
|
176
|
+
req, uri = create_request(payload)
|
177
|
+
send_request(req, uri)
|
178
|
+
end
|
179
|
+
|
180
|
+
def create_request(payload)
|
181
|
+
uri = URI.parse(@endpoint)
|
182
|
+
|
183
|
+
req = Net::HTTP.const_get("Post").new(uri.request_uri)
|
184
|
+
req['X-F5-Ingestion-Token'] = @token
|
185
|
+
req['Content-Type'] = 'text/plain'
|
186
|
+
req.body = payload
|
187
|
+
|
188
|
+
return req, uri
|
189
|
+
end
|
190
|
+
|
191
|
+
def send_request(req, uri)
|
192
|
+
res = nil
|
193
|
+
|
194
|
+
begin
|
195
|
+
res = Net::HTTP.start(uri.host, uri.port, **http_opts(uri)) {|http| http.request(req) }
|
196
|
+
|
197
|
+
rescue => e # rescue all StandardErrors
|
198
|
+
# server didn't respond
|
199
|
+
log.warn "Net::HTTP.#{req.method.capitalize} raises exception: #{e.class}, '#{e.message}'"
|
200
|
+
raise e
|
201
|
+
else
|
202
|
+
unless res and res.is_a?(Net::HTTPSuccess)
|
203
|
+
res_summary = if res
|
204
|
+
"#{res.code} #{res.message} #{res.body}"
|
205
|
+
else
|
206
|
+
"res=nil"
|
207
|
+
end
|
208
|
+
log.warn "failed to #{req.method} #{uri} (#{res_summary})"
|
209
|
+
end #end unless
|
210
|
+
end # end begin
|
211
|
+
end # end send_request
|
212
|
+
|
213
|
+
def http_opts(uri)
|
214
|
+
opts = {
|
215
|
+
:use_ssl => true,
|
216
|
+
:verify_mode => OpenSSL::SSL::VERIFY_PEER,
|
217
|
+
:ssl_version => :TLSv1_2,
|
218
|
+
:ciphers => ['AES128-GCM-SHA256', 'AES128-SHA256', 'AES256-GCM-SHA384', 'AES256-SHA256', 'ECDHE-RSA-AES128-GCM-SHA256', 'ECDHE-RSA-AES128-SHA256', 'ECDHE-RSA-AES256-GCM-SHA384', 'ECDHE-RSA-AES256-SHA384'],
|
219
|
+
}
|
220
|
+
opts
|
221
|
+
end
|
222
|
+
|
223
|
+
end
|
224
|
+
end
|
@@ -0,0 +1,415 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2020 F5 Networks, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
require 'test_helper'
|
17
|
+
|
18
|
+
class BeaconOutputTest < Test::Unit::TestCase
|
19
|
+
class TestBeaconOutput < Fluent::Plugin::BeaconOutput
|
20
|
+
attr_reader :points
|
21
|
+
attr_reader :req
|
22
|
+
attr_reader :uri
|
23
|
+
|
24
|
+
def configure(conf)
|
25
|
+
@points = []
|
26
|
+
super
|
27
|
+
end
|
28
|
+
|
29
|
+
def format(tag, time, record)
|
30
|
+
super
|
31
|
+
end
|
32
|
+
|
33
|
+
def formatted_to_msgpack_binary
|
34
|
+
super
|
35
|
+
end
|
36
|
+
|
37
|
+
def write(chunk)
|
38
|
+
super
|
39
|
+
end
|
40
|
+
|
41
|
+
def write_points(points)
|
42
|
+
@points << [points]
|
43
|
+
super
|
44
|
+
end
|
45
|
+
|
46
|
+
def send_request(req, uri)
|
47
|
+
@req = req
|
48
|
+
@uri = uri
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def setup
|
53
|
+
Fluent::Test.setup
|
54
|
+
end
|
55
|
+
|
56
|
+
CONFIG = %[
|
57
|
+
source_name test-source-name
|
58
|
+
token test-token
|
59
|
+
]
|
60
|
+
|
61
|
+
def create_raw_driver(conf=CONFIG)
|
62
|
+
Fluent::Test::Driver::Output.new(Fluent::Plugin::BeaconOutput).configure(conf)
|
63
|
+
end
|
64
|
+
|
65
|
+
def create_driver(conf=CONFIG)
|
66
|
+
Fluent::Test::Driver::Output.new(TestBeaconOutput).configure(conf)
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_configure
|
70
|
+
driver = create_raw_driver %[
|
71
|
+
source_name test-source-name
|
72
|
+
token test-token
|
73
|
+
endpoint https://localhost/beacon/v1/ingest-metrics
|
74
|
+
token a-0123456789#fake-token
|
75
|
+
]
|
76
|
+
assert_equal('https://localhost/beacon/v1/ingest-metrics', driver.instance.config['endpoint'])
|
77
|
+
assert_equal('a-0123456789#fake-token', driver.instance.config['token'])
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_configure_without_tag_chunk_key
|
81
|
+
assert_raise(Fluent::ConfigError) do
|
82
|
+
create_raw_driver %[
|
83
|
+
source_name test-source-name
|
84
|
+
token test-token
|
85
|
+
<buffer arbitrary_key>
|
86
|
+
@type memory
|
87
|
+
</buffer>
|
88
|
+
]
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def test_configure_without_source
|
93
|
+
assert_raise(Fluent::ConfigError) do
|
94
|
+
create_raw_driver %[
|
95
|
+
token test-token
|
96
|
+
]
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def test_configure_without_token
|
101
|
+
assert_raise(Fluent::ConfigError) do
|
102
|
+
create_raw_driver %[
|
103
|
+
source_name test-source-name
|
104
|
+
]
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
def test_format
|
109
|
+
driver = create_driver(CONFIG)
|
110
|
+
time = event_time('2011-01-02 13:14:15 UTC')
|
111
|
+
|
112
|
+
driver.run(default_tag: 'test') do
|
113
|
+
driver.feed(time, {'a' => 1,'b' => nil})
|
114
|
+
driver.feed(time, {'a' => 2})
|
115
|
+
end
|
116
|
+
|
117
|
+
assert_equal [[to_ns(time), {'a' => 1}].to_msgpack,
|
118
|
+
[to_ns(time), {'a' => 2}].to_msgpack], driver.formatted
|
119
|
+
end
|
120
|
+
|
121
|
+
sub_test_case "#write" do
|
122
|
+
test "buffer" do
|
123
|
+
driver = create_driver(CONFIG)
|
124
|
+
|
125
|
+
time = event_time("2011-01-02 13:14:15 UTC")
|
126
|
+
driver.run(default_tag: 'input.influxdb') do
|
127
|
+
driver.feed(time, {'a' => 1})
|
128
|
+
driver.feed(time, {'a' => 2})
|
129
|
+
end
|
130
|
+
|
131
|
+
assert_equal([
|
132
|
+
[
|
133
|
+
[
|
134
|
+
{
|
135
|
+
timestamp: to_ns(time),
|
136
|
+
series: 'input.influxdb',
|
137
|
+
tags: {'beacon-fluent-source' => 'test-source-name'},
|
138
|
+
values: {'a' => 1}
|
139
|
+
},
|
140
|
+
{
|
141
|
+
timestamp: to_ns(time),
|
142
|
+
series: 'input.influxdb',
|
143
|
+
tags: {'beacon-fluent-source' => 'test-source-name'},
|
144
|
+
values: {'a' => 2}
|
145
|
+
},
|
146
|
+
]
|
147
|
+
]
|
148
|
+
], driver.instance.points)
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
def test_write_with_measurement
|
153
|
+
config_with_measurement = %Q(
|
154
|
+
#{CONFIG}
|
155
|
+
measurement test
|
156
|
+
)
|
157
|
+
|
158
|
+
driver = create_driver(config_with_measurement)
|
159
|
+
|
160
|
+
time = event_time('2011-01-02 13:14:15 UTC')
|
161
|
+
driver.run(default_tag: 'input.influxdb') do
|
162
|
+
driver.feed(time, {'a' => 1})
|
163
|
+
driver.feed(time, {'a' => 2})
|
164
|
+
end
|
165
|
+
|
166
|
+
assert_equal([
|
167
|
+
[
|
168
|
+
[
|
169
|
+
{
|
170
|
+
:timestamp => to_ns(time),
|
171
|
+
:series => 'test',
|
172
|
+
:tags => {'beacon-fluent-source' => 'test-source-name'},
|
173
|
+
:values => {'a' => 1}
|
174
|
+
},
|
175
|
+
{
|
176
|
+
:timestamp => to_ns(time),
|
177
|
+
:series => 'test',
|
178
|
+
:tags => {'beacon-fluent-source' => 'test-source-name'},
|
179
|
+
:values => {'a' => 2}
|
180
|
+
},
|
181
|
+
]
|
182
|
+
]
|
183
|
+
], driver.instance.points)
|
184
|
+
|
185
|
+
assert_equal('https://ingestion.ovr.prd.f5aas.com:50443/beacon/v1/ingest-metrics', driver.instance.uri.to_s)
|
186
|
+
assert_equal('test-token', driver.instance.req['X-F5-Ingestion-Token'])
|
187
|
+
assert_equal('text/plain', driver.instance.req['Content-Type'])
|
188
|
+
assert_equal("test,beacon-fluent-source=test-source-name a=1i 1293974055000000000\n" +
|
189
|
+
"test,beacon-fluent-source=test-source-name a=2i 1293974055000000000", driver.instance.req.body)
|
190
|
+
end
|
191
|
+
|
192
|
+
def test_empty_tag_keys
|
193
|
+
config_with_tags = %Q(
|
194
|
+
#{CONFIG}
|
195
|
+
tag_keys ["b"]
|
196
|
+
)
|
197
|
+
|
198
|
+
driver = create_driver(config_with_tags)
|
199
|
+
|
200
|
+
time = event_time("2011-01-02 13:14:15 UTC")
|
201
|
+
driver.run(default_tag: 'input.influxdb') do
|
202
|
+
driver.feed(time, {'a' => 1, 'b' => ''})
|
203
|
+
driver.feed(time, {'a' => 2, 'b' => 1})
|
204
|
+
driver.feed(time, {'a' => 3, 'b' => ' '})
|
205
|
+
end
|
206
|
+
|
207
|
+
assert_equal([
|
208
|
+
[
|
209
|
+
[
|
210
|
+
{
|
211
|
+
timestamp: to_ns(time),
|
212
|
+
series: 'input.influxdb',
|
213
|
+
values: {'a' => 1},
|
214
|
+
tags: {'beacon-fluent-source' => 'test-source-name'},
|
215
|
+
},
|
216
|
+
{
|
217
|
+
timestamp: to_ns(time),
|
218
|
+
series: 'input.influxdb',
|
219
|
+
values: {'a' => 2},
|
220
|
+
tags: {'b' => 1, 'beacon-fluent-source' => 'test-source-name'},
|
221
|
+
},
|
222
|
+
{
|
223
|
+
timestamp: to_ns(time),
|
224
|
+
series: 'input.influxdb',
|
225
|
+
values: {'a' => 3},
|
226
|
+
tags: {'beacon-fluent-source' => 'test-source-name'},
|
227
|
+
},
|
228
|
+
]
|
229
|
+
]
|
230
|
+
], driver.instance.points)
|
231
|
+
end
|
232
|
+
|
233
|
+
def test_auto_tagging
|
234
|
+
config_with_tags = %Q(
|
235
|
+
#{CONFIG}
|
236
|
+
|
237
|
+
auto_tags true
|
238
|
+
)
|
239
|
+
|
240
|
+
driver = create_driver(config_with_tags)
|
241
|
+
|
242
|
+
time = event_time("2011-01-02 13:14:15 UTC")
|
243
|
+
driver.run(default_tag: 'input.influxdb') do
|
244
|
+
driver.feed(time, {'a' => 1, 'b' => '1'})
|
245
|
+
driver.feed(time, {'a' => 2, 'b' => 1})
|
246
|
+
driver.feed(time, {'a' => 3, 'b' => ' '})
|
247
|
+
end
|
248
|
+
|
249
|
+
assert_equal([
|
250
|
+
[
|
251
|
+
[
|
252
|
+
{
|
253
|
+
:timestamp => to_ns(time),
|
254
|
+
:series => 'input.influxdb',
|
255
|
+
|
256
|
+
:values => {'a' => 1},
|
257
|
+
:tags => {'b' => '1', 'beacon-fluent-source' => 'test-source-name'},
|
258
|
+
},
|
259
|
+
{
|
260
|
+
:timestamp => to_ns(time),
|
261
|
+
:series => 'input.influxdb',
|
262
|
+
:values => {'a' => 2, 'b' => 1},
|
263
|
+
:tags => {'beacon-fluent-source' => 'test-source-name'},
|
264
|
+
},
|
265
|
+
{
|
266
|
+
:timestamp => to_ns(time),
|
267
|
+
:series => 'input.influxdb',
|
268
|
+
:values => {'a' => 3},
|
269
|
+
:tags => {'beacon-fluent-source' => 'test-source-name'},
|
270
|
+
},
|
271
|
+
]
|
272
|
+
]
|
273
|
+
], driver.instance.points)
|
274
|
+
end
|
275
|
+
|
276
|
+
def test_ignore_empty_values
|
277
|
+
config_with_tags = %Q(
|
278
|
+
#{CONFIG}
|
279
|
+
|
280
|
+
tag_keys ["b"]
|
281
|
+
)
|
282
|
+
|
283
|
+
driver = create_driver(config_with_tags)
|
284
|
+
|
285
|
+
time = event_time('2011-01-02 13:14:15 UTC')
|
286
|
+
driver.run(default_tag: 'input.influxdb') do
|
287
|
+
driver.feed(time, {'b' => '3'})
|
288
|
+
driver.feed(time, {'a' => 2, 'b' => 1})
|
289
|
+
end
|
290
|
+
|
291
|
+
assert_equal([
|
292
|
+
[
|
293
|
+
[
|
294
|
+
{
|
295
|
+
:timestamp => to_ns(time),
|
296
|
+
:series => 'input.influxdb',
|
297
|
+
|
298
|
+
:values => {'a' => 2},
|
299
|
+
:tags => {'b' => 1, 'beacon-fluent-source' => 'test-source-name'},
|
300
|
+
}
|
301
|
+
]
|
302
|
+
]
|
303
|
+
], driver.instance.points)
|
304
|
+
end
|
305
|
+
|
306
|
+
def test_seq
|
307
|
+
config = %[
|
308
|
+
type beacon
|
309
|
+
source_name test-source-name
|
310
|
+
token test-token
|
311
|
+
sequence_tag _seq
|
312
|
+
]
|
313
|
+
driver = create_driver(config)
|
314
|
+
|
315
|
+
time = event_time("2011-01-02 13:14:15 UTC")
|
316
|
+
next_time = Fluent::EventTime.new(time + 1)
|
317
|
+
driver.run(default_tag: 'input.influxdb') do
|
318
|
+
driver.feed(time, {'a' => 1})
|
319
|
+
driver.feed(time, {'a' => 2})
|
320
|
+
|
321
|
+
driver.feed(next_time, {'a' => 1})
|
322
|
+
driver.feed(next_time, {'a' => 2})
|
323
|
+
end
|
324
|
+
|
325
|
+
assert_equal([
|
326
|
+
[
|
327
|
+
[
|
328
|
+
{
|
329
|
+
timestamp: to_ns(time),
|
330
|
+
series: 'input.influxdb',
|
331
|
+
values: {'a' => 1},
|
332
|
+
tags: {'_seq' => 0, 'beacon-fluent-source' => 'test-source-name'},
|
333
|
+
},
|
334
|
+
{
|
335
|
+
timestamp: to_ns(time),
|
336
|
+
series: 'input.influxdb',
|
337
|
+
values: {'a' => 2},
|
338
|
+
tags: {'_seq' => 1, 'beacon-fluent-source' => 'test-source-name'},
|
339
|
+
},
|
340
|
+
{
|
341
|
+
timestamp: to_ns(time + 1),
|
342
|
+
series: 'input.influxdb',
|
343
|
+
values: {'a' => 1},
|
344
|
+
tags: {'_seq' => 0, 'beacon-fluent-source' => 'test-source-name'},
|
345
|
+
},
|
346
|
+
{
|
347
|
+
timestamp: to_ns(time + 1),
|
348
|
+
series: 'input.influxdb',
|
349
|
+
values: {'a' => 2},
|
350
|
+
tags: {'_seq' => 1, 'beacon-fluent-source' => 'test-source-name'},
|
351
|
+
}
|
352
|
+
]
|
353
|
+
]
|
354
|
+
], driver.instance.points)
|
355
|
+
end
|
356
|
+
|
357
|
+
def test_cast_number
|
358
|
+
config = %Q(
|
359
|
+
#{CONFIG}
|
360
|
+
cast_number_to_float true
|
361
|
+
)
|
362
|
+
|
363
|
+
driver = create_driver(config)
|
364
|
+
|
365
|
+
time = event_time("2011-01-02 13:14:15 UTC")
|
366
|
+
driver.run(default_tag: 'input.influxdb') do
|
367
|
+
driver.feed(time, {'a' => 1})
|
368
|
+
end
|
369
|
+
|
370
|
+
assert_equal([
|
371
|
+
[
|
372
|
+
[
|
373
|
+
{
|
374
|
+
timestamp: to_ns(time),
|
375
|
+
series: 'input.influxdb',
|
376
|
+
values: {'a' => 1.0},
|
377
|
+
tags: {'beacon-fluent-source' => 'test-source-name'},
|
378
|
+
},
|
379
|
+
]
|
380
|
+
]
|
381
|
+
], driver.instance.points)
|
382
|
+
end
|
383
|
+
|
384
|
+
def test_time_key
|
385
|
+
config = %Q(
|
386
|
+
#{CONFIG}
|
387
|
+
time_key b
|
388
|
+
)
|
389
|
+
|
390
|
+
driver = create_driver(config)
|
391
|
+
|
392
|
+
time = event_time("2020-01-02 13:14:15 UTC")
|
393
|
+
driver.run(default_tag: 'input.influxdb') do
|
394
|
+
driver.feed(time, {'a' => 1, 'b' => 1293974055000000000})
|
395
|
+
end
|
396
|
+
|
397
|
+
assert_equal([
|
398
|
+
[
|
399
|
+
[
|
400
|
+
{
|
401
|
+
timestamp: 1293974055000000000,
|
402
|
+
series: 'input.influxdb',
|
403
|
+
values: {'a' => 1.0},
|
404
|
+
tags: {'beacon-fluent-source' => 'test-source-name'},
|
405
|
+
},
|
406
|
+
]
|
407
|
+
]
|
408
|
+
], driver.instance.points)
|
409
|
+
end
|
410
|
+
|
411
|
+
def to_ns(time)
|
412
|
+
time * 1000000000
|
413
|
+
end
|
414
|
+
|
415
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2020 F5 Networks, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
require 'simplecov'
|
17
|
+
SimpleCov.start
|
18
|
+
|
19
|
+
require 'rubygems'
|
20
|
+
require 'bundler'
|
21
|
+
require 'pry'
|
22
|
+
|
23
|
+
begin
|
24
|
+
Bundler.setup(:default, :development)
|
25
|
+
rescue Bundler::BundlerError => e
|
26
|
+
$stderr.puts e.message
|
27
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
28
|
+
exit e.status_code
|
29
|
+
end
|
30
|
+
require 'test/unit'
|
31
|
+
|
32
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
33
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
34
|
+
require 'fluent/test'
|
35
|
+
require 'fluent/test/driver/output'
|
36
|
+
unless ENV.has_key?('VERBOSE')
|
37
|
+
nulllogger = Object.new
|
38
|
+
nulllogger.instance_eval {|obj|
|
39
|
+
def method_missing(method, *args)
|
40
|
+
# pass
|
41
|
+
end
|
42
|
+
}
|
43
|
+
$log = nulllogger
|
44
|
+
end
|
45
|
+
|
46
|
+
require 'fluent/test/helpers'
|
47
|
+
require 'fluent/plugin/out_f5_beacon'
|
48
|
+
|
49
|
+
include Fluent::Test::Helpers
|
50
|
+
|
51
|
+
class Test::Unit::TestCase
|
52
|
+
end
|
metadata
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fluent-plugin-f5-beacon
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Matt Davey
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-07-14 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.0'
|
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.0'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '2'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: influxdb
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 0.8.0
|
40
|
+
- - "<"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '1'
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 0.8.0
|
50
|
+
- - "<"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '1'
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: rake
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
type: :development
|
61
|
+
prerelease: false
|
62
|
+
version_requirements: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
name: pry
|
69
|
+
requirement: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
type: :development
|
75
|
+
prerelease: false
|
76
|
+
version_requirements: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: test-unit
|
83
|
+
requirement: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
description: F5 Beacon output plugin for Fluentd
|
96
|
+
email:
|
97
|
+
- m.davey@f5.com
|
98
|
+
executables: []
|
99
|
+
extensions: []
|
100
|
+
extra_rdoc_files: []
|
101
|
+
files:
|
102
|
+
- ".gitignore"
|
103
|
+
- Gemfile
|
104
|
+
- LICENSE
|
105
|
+
- README.md
|
106
|
+
- Rakefile
|
107
|
+
- SUPPORT.md
|
108
|
+
- TERMS OF USE.txt
|
109
|
+
- fluent-plugin-f5-beacon.gemspec
|
110
|
+
- lib/fluent/plugin/out_f5_beacon.rb
|
111
|
+
- test/plugin/test_out_f5_beacon.rb
|
112
|
+
- test/test_helper.rb
|
113
|
+
homepage: https://github.com/f5devcentral/fluent-plugin-f5-beacon
|
114
|
+
licenses:
|
115
|
+
- Apache-2.0
|
116
|
+
metadata: {}
|
117
|
+
post_install_message:
|
118
|
+
rdoc_options: []
|
119
|
+
require_paths:
|
120
|
+
- lib
|
121
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
requirements: []
|
132
|
+
rubygems_version: 3.1.2
|
133
|
+
signing_key:
|
134
|
+
specification_version: 4
|
135
|
+
summary: A buffered output plugin for Fluentd and F5 Beacon
|
136
|
+
test_files:
|
137
|
+
- test/plugin/test_out_f5_beacon.rb
|
138
|
+
- test/test_helper.rb
|