fluent-plugin-f5-beacon 0.0.1 → 0.0.2
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 +4 -4
- data/.github/dependabot.yml +11 -0
- data/.github/workflows/ruby.yml +33 -0
- data/README.md +14 -1
- data/fluent-plugin-f5-beacon.gemspec +4 -4
- data/lib/fluent/plugin/out_f5_beacon.rb +17 -6
- data/test/plugin/test_out_f5_beacon.rb +64 -4
- metadata +14 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0bd86674dfa590a76b417a6be99dac3515c158b394190d53884fc344791b6b83
|
4
|
+
data.tar.gz: 821a5864aa6bf080c58381804a93db0ca44e97b2befedb08fcdf1d44e7495fdb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7becbd33d8ee90dc246cc36a511d1fe1209892e52de89b08098146ebbd6becd7931131d46ed40a8456c6a07c0dc9115938a707c452dcaf9ee82d7cbf3a41fdc
|
7
|
+
data.tar.gz: 9b155afff0ad311849ca79e6aeffd88ba09b6ce69016e7f7e5bac32c305c71a9320f73a6202eeaee55ce2a97281adaeac417b85ca79dc402b08bbb6547ba66a9
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# To get started with Dependabot version updates, you'll need to specify which
|
2
|
+
# package ecosystems to update and where the package manifests are located.
|
3
|
+
# Please see the documentation for all configuration options:
|
4
|
+
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
5
|
+
|
6
|
+
version: 2
|
7
|
+
updates:
|
8
|
+
- package-ecosystem: "bundler" # See documentation for possible values
|
9
|
+
directory: "/" # Location of package manifests
|
10
|
+
schedule:
|
11
|
+
interval: "daily"
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
2
|
+
# They are provided by a third-party and are governed by
|
3
|
+
# separate terms of service, privacy policy, and support
|
4
|
+
# documentation.
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
+
|
8
|
+
name: Ruby
|
9
|
+
|
10
|
+
on:
|
11
|
+
push:
|
12
|
+
branches: [ master ]
|
13
|
+
pull_request:
|
14
|
+
branches: [ master ]
|
15
|
+
|
16
|
+
jobs:
|
17
|
+
test:
|
18
|
+
|
19
|
+
runs-on: ubuntu-latest
|
20
|
+
|
21
|
+
steps:
|
22
|
+
- uses: actions/checkout@v2
|
23
|
+
- name: Set up Ruby
|
24
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
25
|
+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
26
|
+
# uses: ruby/setup-ruby@v1
|
27
|
+
uses: ruby/setup-ruby@ec106b438a1ff6ff109590de34ddc62c540232e0
|
28
|
+
with:
|
29
|
+
ruby-version: 2.6
|
30
|
+
- name: Install dependencies
|
31
|
+
run: bundle install
|
32
|
+
- name: Run tests
|
33
|
+
run: bundle exec rake
|
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
 [](https://badge.fury.io/rb/fluent-plugin-f5-beacon)
|
2
|
+
|
1
3
|
# Fluent::Plugin::Beacon, a plugin for [Fluentd](http://fluentd.org)
|
2
4
|
|
3
5
|
fluent-plugin-f5-beacon is a buffered output plugin for Fluentd and F5 Beacon.
|
@@ -12,6 +14,17 @@ fluent-plugin-f5-beacon is a buffered output plugin for Fluentd and F5 Beacon.
|
|
12
14
|
|
13
15
|
$ fluent-gem install fluent-plugin-f5-beacon
|
14
16
|
|
17
|
+
Alternatively, with td-agent:
|
18
|
+
|
19
|
+
$ td-agent-gem install fluent-plugin-f5-beacon
|
20
|
+
|
21
|
+
Or via source (swap `td-agent-gem` for `fluent-gem` as needed):
|
22
|
+
|
23
|
+
$ git clone https://github.com/f5devcentral/fluent-plugin-f5-beacon.git
|
24
|
+
$ cd fluent-plugin-f5-beacon/
|
25
|
+
$ fluent-gem build fluent-plugin-f5-beacon.gemspec
|
26
|
+
$ fluent-gem install fluent-plugin-f5-beacon-#.#.#.gem
|
27
|
+
|
15
28
|
## Usage
|
16
29
|
|
17
30
|
Just like other regular output plugins, use type `f5-beacon` in your Fluentd configuration under `match` scope:
|
@@ -73,4 +86,4 @@ Details around buffering can be found [here](https://docs.fluentd.org/buffer).
|
|
73
86
|
|
74
87
|
```
|
75
88
|
bundle exec rake test
|
76
|
-
```
|
89
|
+
```
|
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "fluent-plugin-f5-beacon"
|
6
|
-
s.version = '0.0.
|
6
|
+
s.version = '0.0.2'
|
7
7
|
s.authors = ["Matt Davey"]
|
8
8
|
s.email = ["m.davey@f5.com"]
|
9
9
|
s.description = %q{F5 Beacon output plugin for Fluentd}
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.add_runtime_dependency "fluentd", [">= 1.0", "< 2"]
|
20
20
|
s.add_runtime_dependency "influxdb", [">= 0.8.0", "< 1"]
|
21
21
|
|
22
|
-
s.add_development_dependency "rake"
|
23
|
-
s.add_development_dependency "pry"
|
24
|
-
s.add_development_dependency "test-unit"
|
22
|
+
s.add_development_dependency "rake", '~> 13'
|
23
|
+
s.add_development_dependency "pry", '~> 0'
|
24
|
+
s.add_development_dependency "test-unit", '~> 3'
|
25
25
|
end
|
@@ -68,7 +68,7 @@ events and reset to zero for a new event with the different timestamp.
|
|
68
68
|
|
69
69
|
def start
|
70
70
|
super
|
71
|
-
log.info "
|
71
|
+
log.info "starting F5 Beacon plugin..."
|
72
72
|
end
|
73
73
|
|
74
74
|
FORMATTED_RESULT_FOR_INVALID_RECORD = ''.freeze
|
@@ -78,7 +78,7 @@ events and reset to zero for a new event with the different timestamp.
|
|
78
78
|
record.delete_if { |k, v| v.nil? || v.to_s.empty? }
|
79
79
|
|
80
80
|
if record.empty?
|
81
|
-
log.warn "
|
81
|
+
log.warn "skip record '#{record}' in '#{tag}', because record has no values"
|
82
82
|
FORMATTED_RESULT_FOR_INVALID_RECORD
|
83
83
|
else
|
84
84
|
[precision_time(time), record].to_msgpack
|
@@ -111,14 +111,16 @@ events and reset to zero for a new event with the different timestamp.
|
|
111
111
|
record.each_pair do |k, v|
|
112
112
|
if (@auto_tags && v.is_a?(String)) || @tag_keys.include?(k)
|
113
113
|
# If the tag value is not nil, empty, or a space, add the tag
|
114
|
-
|
115
|
-
|
114
|
+
normalized_value = v.to_s.strip
|
115
|
+
if normalized_value != ''
|
116
|
+
tags[k] = normalized_value
|
116
117
|
end
|
117
118
|
else
|
118
119
|
values[k] = v
|
119
120
|
end
|
120
121
|
end
|
121
122
|
end
|
123
|
+
|
122
124
|
if @sequence_tag
|
123
125
|
if @prev_timestamp == timestamp
|
124
126
|
@seq += 1
|
@@ -129,8 +131,15 @@ events and reset to zero for a new event with the different timestamp.
|
|
129
131
|
@prev_timestamp = timestamp
|
130
132
|
end
|
131
133
|
|
134
|
+
values.delete_if do |k, v|
|
135
|
+
if v.is_a?(Array) || v.is_a?(Hash)
|
136
|
+
log.warn "array/hash field '#{k}' discarded; consider using a plugin to map"
|
137
|
+
true
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
132
141
|
if values.empty?
|
133
|
-
log.warn "
|
142
|
+
log.warn "skip record '#{record}', because one value is required"
|
134
143
|
next
|
135
144
|
end
|
136
145
|
|
@@ -153,7 +162,9 @@ events and reset to zero for a new event with the different timestamp.
|
|
153
162
|
points << point
|
154
163
|
end
|
155
164
|
|
156
|
-
|
165
|
+
if points.length > 0
|
166
|
+
write_points(points)
|
167
|
+
end
|
157
168
|
end
|
158
169
|
|
159
170
|
def write_points(points)
|
@@ -217,7 +217,7 @@ class BeaconOutputTest < Test::Unit::TestCase
|
|
217
217
|
timestamp: to_ns(time),
|
218
218
|
series: 'input.influxdb',
|
219
219
|
values: {'a' => 2},
|
220
|
-
tags: {'b' => 1, 'beacon-fluent-source' => 'test-source-name'},
|
220
|
+
tags: {'b' => '1', 'beacon-fluent-source' => 'test-source-name'},
|
221
221
|
},
|
222
222
|
{
|
223
223
|
timestamp: to_ns(time),
|
@@ -233,7 +233,6 @@ class BeaconOutputTest < Test::Unit::TestCase
|
|
233
233
|
def test_auto_tagging
|
234
234
|
config_with_tags = %Q(
|
235
235
|
#{CONFIG}
|
236
|
-
|
237
236
|
auto_tags true
|
238
237
|
)
|
239
238
|
|
@@ -276,7 +275,6 @@ class BeaconOutputTest < Test::Unit::TestCase
|
|
276
275
|
def test_ignore_empty_values
|
277
276
|
config_with_tags = %Q(
|
278
277
|
#{CONFIG}
|
279
|
-
|
280
278
|
tag_keys ["b"]
|
281
279
|
)
|
282
280
|
|
@@ -296,7 +294,7 @@ class BeaconOutputTest < Test::Unit::TestCase
|
|
296
294
|
:series => 'input.influxdb',
|
297
295
|
|
298
296
|
:values => {'a' => 2},
|
299
|
-
:tags => {'b' => 1, 'beacon-fluent-source' => 'test-source-name'},
|
297
|
+
:tags => {'b' => '1', 'beacon-fluent-source' => 'test-source-name'},
|
300
298
|
}
|
301
299
|
]
|
302
300
|
]
|
@@ -408,6 +406,68 @@ class BeaconOutputTest < Test::Unit::TestCase
|
|
408
406
|
], driver.instance.points)
|
409
407
|
end
|
410
408
|
|
409
|
+
def test_nested_fields
|
410
|
+
driver = create_driver(CONFIG)
|
411
|
+
|
412
|
+
time = event_time("2020-01-02 13:14:15 UTC")
|
413
|
+
driver.run(default_tag: 'input.influxdb') do
|
414
|
+
driver.feed(time, {'a' => 1, 'b' => []})
|
415
|
+
driver.feed(time, {'a' => 2, 'c' => {'n' => 3}})
|
416
|
+
end
|
417
|
+
|
418
|
+
assert_equal([
|
419
|
+
[
|
420
|
+
[
|
421
|
+
{
|
422
|
+
timestamp: to_ns(time),
|
423
|
+
series: 'input.influxdb',
|
424
|
+
values: {'a' => 1.0},
|
425
|
+
tags: {'beacon-fluent-source' => 'test-source-name'},
|
426
|
+
},
|
427
|
+
{
|
428
|
+
timestamp: to_ns(time),
|
429
|
+
series: 'input.influxdb',
|
430
|
+
values: {'a' => 2.0},
|
431
|
+
tags: {'beacon-fluent-source' => 'test-source-name'},
|
432
|
+
},
|
433
|
+
]
|
434
|
+
]
|
435
|
+
], driver.instance.points)
|
436
|
+
end
|
437
|
+
|
438
|
+
def test_nested_tags
|
439
|
+
config_with_tags = %Q(
|
440
|
+
#{CONFIG}
|
441
|
+
tag_keys ["b"]
|
442
|
+
)
|
443
|
+
driver = create_driver(config_with_tags)
|
444
|
+
|
445
|
+
time = event_time("2020-01-02 13:14:15 UTC")
|
446
|
+
driver.run(default_tag: 'input.influxdb') do
|
447
|
+
driver.feed(time, {'a' => 1, 'b' => []})
|
448
|
+
driver.feed(time, {'a' => 2, 'b' => {'n' => 3}})
|
449
|
+
end
|
450
|
+
|
451
|
+
assert_equal([
|
452
|
+
[
|
453
|
+
[
|
454
|
+
{
|
455
|
+
timestamp: to_ns(time),
|
456
|
+
series: 'input.influxdb',
|
457
|
+
values: {'a' => 1.0},
|
458
|
+
tags: {'beacon-fluent-source' => 'test-source-name', 'b' => '[]'},
|
459
|
+
},
|
460
|
+
{
|
461
|
+
timestamp: to_ns(time),
|
462
|
+
series: 'input.influxdb',
|
463
|
+
values: {'a' => 2.0},
|
464
|
+
tags: {'beacon-fluent-source' => 'test-source-name', 'b' => '{"n"=>3}'},
|
465
|
+
},
|
466
|
+
]
|
467
|
+
]
|
468
|
+
], driver.instance.points)
|
469
|
+
end
|
470
|
+
|
411
471
|
def to_ns(time)
|
412
472
|
time * 1000000000
|
413
473
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-f5-beacon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Davey
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -54,44 +54,44 @@ dependencies:
|
|
54
54
|
name: rake
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
|
-
- - "
|
57
|
+
- - "~>"
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: '
|
59
|
+
version: '13'
|
60
60
|
type: :development
|
61
61
|
prerelease: false
|
62
62
|
version_requirements: !ruby/object:Gem::Requirement
|
63
63
|
requirements:
|
64
|
-
- - "
|
64
|
+
- - "~>"
|
65
65
|
- !ruby/object:Gem::Version
|
66
|
-
version: '
|
66
|
+
version: '13'
|
67
67
|
- !ruby/object:Gem::Dependency
|
68
68
|
name: pry
|
69
69
|
requirement: !ruby/object:Gem::Requirement
|
70
70
|
requirements:
|
71
|
-
- - "
|
71
|
+
- - "~>"
|
72
72
|
- !ruby/object:Gem::Version
|
73
73
|
version: '0'
|
74
74
|
type: :development
|
75
75
|
prerelease: false
|
76
76
|
version_requirements: !ruby/object:Gem::Requirement
|
77
77
|
requirements:
|
78
|
-
- - "
|
78
|
+
- - "~>"
|
79
79
|
- !ruby/object:Gem::Version
|
80
80
|
version: '0'
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
name: test-unit
|
83
83
|
requirement: !ruby/object:Gem::Requirement
|
84
84
|
requirements:
|
85
|
-
- - "
|
85
|
+
- - "~>"
|
86
86
|
- !ruby/object:Gem::Version
|
87
|
-
version: '
|
87
|
+
version: '3'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
90
|
version_requirements: !ruby/object:Gem::Requirement
|
91
91
|
requirements:
|
92
|
-
- - "
|
92
|
+
- - "~>"
|
93
93
|
- !ruby/object:Gem::Version
|
94
|
-
version: '
|
94
|
+
version: '3'
|
95
95
|
description: F5 Beacon output plugin for Fluentd
|
96
96
|
email:
|
97
97
|
- m.davey@f5.com
|
@@ -99,6 +99,8 @@ executables: []
|
|
99
99
|
extensions: []
|
100
100
|
extra_rdoc_files: []
|
101
101
|
files:
|
102
|
+
- ".github/dependabot.yml"
|
103
|
+
- ".github/workflows/ruby.yml"
|
102
104
|
- ".gitignore"
|
103
105
|
- Gemfile
|
104
106
|
- LICENSE
|