fluent-plugin-beats 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +13 -0
- data/Rakefile +3 -2
- data/VERSION +1 -1
- data/fluent-plugin-beats.gemspec +1 -1
- data/test/helper.rb +8 -0
- data/test/plugin/test_in_beats.rb +87 -0
- metadata +17 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: '092ac019d242807f0de4fb50f8f79947057b2084de286c1e57bfd38d5e9149c0'
|
4
|
+
data.tar.gz: ff608d2612acf8e3d0f23c6d8aa798d0ae301e94b3394faa630075d9841a90b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc87c07cdcf60433a5b11fed9259b63e215045514f6c23e3e57a10cd49be1d36d9abb6749149bea1a739fc3d25724d51675c7ae72d13a8f813d9d5ce0f2528a2
|
7
|
+
data.tar.gz: f53064e29c5ddb2663b1ee0f64d8c1641fbf0c83670b6e5485bc5312b48c48d55c57eeb49b5fc731ed862755fc6494295c447a22774030a991b25f09085b7984
|
data/.travis.yml
ADDED
data/Rakefile
CHANGED
@@ -6,8 +6,9 @@ require 'rake/testtask'
|
|
6
6
|
|
7
7
|
Rake::TestTask.new(:test) do |test|
|
8
8
|
test.libs << 'lib' << 'test'
|
9
|
-
test.test_files = FileList['test/test_*.rb']
|
10
|
-
test.verbose =
|
9
|
+
test.test_files = FileList['test/plugin/test_*.rb']
|
10
|
+
test.verbose = false
|
11
|
+
test.warning = false
|
11
12
|
end
|
12
13
|
|
13
14
|
task :default => [:build]
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
data/fluent-plugin-beats.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.require_paths = ['lib']
|
19
19
|
|
20
20
|
gem.add_dependency "fluentd", [">= 0.10.58", "< 2"]
|
21
|
-
gem.add_dependency "concurrent-ruby", "
|
21
|
+
gem.add_dependency "concurrent-ruby", [">= 0.9.2", "< 2"]
|
22
22
|
gem.add_development_dependency "rake", ">= 0.9.2"
|
23
23
|
gem.add_development_dependency "test-unit", ">= 3.0.8"
|
24
24
|
gem.add_development_dependency "test-unit-rr", ">= 1.0.3"
|
data/test/helper.rb
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
require 'fluent/test'
|
2
|
+
require 'fluent/plugin/in_beats'
|
3
|
+
require 'lumberjack/beats/client'
|
4
|
+
require 'helper'
|
5
|
+
|
6
|
+
class BeatsInputTest < Test::Unit::TestCase
|
7
|
+
|
8
|
+
def setup
|
9
|
+
Fluent::Test.setup
|
10
|
+
end
|
11
|
+
|
12
|
+
PORT = find_available_port
|
13
|
+
|
14
|
+
CONFIG = %[
|
15
|
+
port #{PORT}
|
16
|
+
bind 127.0.0.1
|
17
|
+
tag test.beats
|
18
|
+
]
|
19
|
+
|
20
|
+
def create_driver(conf=CONFIG)
|
21
|
+
Fluent::Test::InputTestDriver.new(Fluent::BeatsInput).configure(conf)
|
22
|
+
end
|
23
|
+
|
24
|
+
def create_client
|
25
|
+
Lumberjack::Beats::Client.new({
|
26
|
+
:port => PORT,
|
27
|
+
:addresses => ['127.0.0.1'],
|
28
|
+
:json => true,
|
29
|
+
:ssl => false
|
30
|
+
})
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_configure
|
34
|
+
d = create_driver
|
35
|
+
assert_equal PORT, d.instance.port
|
36
|
+
assert_equal '127.0.0.1', d.instance.bind
|
37
|
+
assert_equal 'test.beats', d.instance.tag
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_send_beat
|
41
|
+
d = create_driver
|
42
|
+
|
43
|
+
timestamp = '2018-01-01T12:30:00.000Z'
|
44
|
+
payload = {
|
45
|
+
'@metadata' => {'beat' => 'heartbeat'},
|
46
|
+
'@timestamp' => timestamp,
|
47
|
+
'foo' => 'bar'
|
48
|
+
}
|
49
|
+
|
50
|
+
d.run do
|
51
|
+
client = create_client
|
52
|
+
client.write(payload)
|
53
|
+
end
|
54
|
+
|
55
|
+
tag, es = d.emit_streams[0]
|
56
|
+
assert_equal tag, 'test.beats'
|
57
|
+
assert_equal es.length, 1
|
58
|
+
|
59
|
+
time, record = es[0]
|
60
|
+
assert_equal time.to_i, Time.parse(timestamp).to_i
|
61
|
+
assert_equal record, payload
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_metadata_as_tag
|
65
|
+
d = create_driver(CONFIG + 'metadata_as_tag')
|
66
|
+
|
67
|
+
timestamp = '2018-01-01T12:30:00.000Z'
|
68
|
+
payload = {
|
69
|
+
'@metadata' => {'beat' => 'heartbeat'},
|
70
|
+
'@timestamp' => timestamp,
|
71
|
+
'foo' => 'bar'
|
72
|
+
}
|
73
|
+
|
74
|
+
d.run do
|
75
|
+
client = create_client
|
76
|
+
client.write(payload)
|
77
|
+
end
|
78
|
+
|
79
|
+
tag, es = d.emit_streams[0]
|
80
|
+
assert_equal tag, 'heartbeat'
|
81
|
+
assert_equal es.length, 1
|
82
|
+
|
83
|
+
time, record = es[0]
|
84
|
+
assert_equal time.to_i, Time.parse(timestamp).to_i
|
85
|
+
assert_equal record, payload
|
86
|
+
end
|
87
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-beats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masahiro Nakagawa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -34,16 +34,22 @@ dependencies:
|
|
34
34
|
name: concurrent-ruby
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - "
|
37
|
+
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: 0.9.2
|
40
|
+
- - "<"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '2'
|
40
43
|
type: :runtime
|
41
44
|
prerelease: false
|
42
45
|
version_requirements: !ruby/object:Gem::Requirement
|
43
46
|
requirements:
|
44
|
-
- - "
|
47
|
+
- - ">="
|
45
48
|
- !ruby/object:Gem::Version
|
46
49
|
version: 0.9.2
|
50
|
+
- - "<"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '2'
|
47
53
|
- !ruby/object:Gem::Dependency
|
48
54
|
name: rake
|
49
55
|
requirement: !ruby/object:Gem::Requirement
|
@@ -93,6 +99,7 @@ extensions: []
|
|
93
99
|
extra_rdoc_files: []
|
94
100
|
files:
|
95
101
|
- ".gitignore"
|
102
|
+
- ".travis.yml"
|
96
103
|
- Gemfile
|
97
104
|
- LICENSE
|
98
105
|
- README.md
|
@@ -103,6 +110,8 @@ files:
|
|
103
110
|
- lib/lumberjack/beats.rb
|
104
111
|
- lib/lumberjack/beats/client.rb
|
105
112
|
- lib/lumberjack/beats/server.rb
|
113
|
+
- test/helper.rb
|
114
|
+
- test/plugin/test_in_beats.rb
|
106
115
|
homepage: https://github.com/repeatedly/fluent-plugin-beats
|
107
116
|
licenses:
|
108
117
|
- Apache-2.0
|
@@ -123,8 +132,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
132
|
version: '0'
|
124
133
|
requirements: []
|
125
134
|
rubyforge_project:
|
126
|
-
rubygems_version: 2.6
|
135
|
+
rubygems_version: 2.7.6
|
127
136
|
signing_key:
|
128
137
|
specification_version: 4
|
129
138
|
summary: Elastic beats plugin for Fluentd event collector
|
130
|
-
test_files:
|
139
|
+
test_files:
|
140
|
+
- test/helper.rb
|
141
|
+
- test/plugin/test_in_beats.rb
|