logstash-output-gelf 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -0
- data/README.md +4 -4
- data/lib/logstash/outputs/gelf.rb +11 -1
- data/logstash-output-gelf.gemspec +3 -2
- data/spec/outputs/gelf_spec.rb +35 -1
- data/spec/spec_helper.rb +3 -0
- metadata +23 -9
- data/.gitignore +0 -4
- data/Rakefile +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97913240b2713b68541946ee5c49b4140a0db7fe
|
4
|
+
data.tar.gz: 24850ecf29b515fe90beaa101bf51074fe922850
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 676251f9a817873a98dca5cb4bcafc2064e4966911933f9f75da0414a40fdba419cf0d5fbc088d4cddacea116202aacc2427794afcdcc788c522c1c0c186228d
|
7
|
+
data.tar.gz: 9d166ba43b084c3d9cd4bcb079fd5f7f63b9270d6d6cdfa131d49a771dda31f6e0517e0f96d6927405fc3b852e772bfdefd69ae8a029632d2a0d9186d27d9db5
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
# Logstash Plugin
|
2
2
|
|
3
|
-
This is a plugin for [Logstash](https://github.com/
|
3
|
+
This is a plugin for [Logstash](https://github.com/elastic/logstash).
|
4
4
|
|
5
5
|
It is fully free and fully open source. The license is Apache 2.0, meaning you are pretty much free to use it however you want in whatever way.
|
6
6
|
|
7
7
|
## Documentation
|
8
8
|
|
9
|
-
Logstash provides infrastructure to automatically generate documentation for this plugin. We use the asciidoc format to write documentation so any comments in the source code will be first converted into asciidoc and then into html. All plugin documentation are placed under one [central location](http://www.
|
9
|
+
Logstash provides infrastructure to automatically generate documentation for this plugin. We use the asciidoc format to write documentation so any comments in the source code will be first converted into asciidoc and then into html. All plugin documentation are placed under one [central location](http://www.elastic.co/guide/en/logstash/current/).
|
10
10
|
|
11
11
|
- For formatting code or config example, you can use the asciidoc `[source,ruby]` directive
|
12
|
-
- For more asciidoc formatting tips, see the excellent reference here https://github.com/
|
12
|
+
- For more asciidoc formatting tips, see the excellent reference here https://github.com/elastic/docs#asciidoc-guide
|
13
13
|
|
14
14
|
## Need Help?
|
15
15
|
|
@@ -83,4 +83,4 @@ Programming is not a required skill. Whatever you've seen about open source and
|
|
83
83
|
|
84
84
|
It is more important to the community that you are able to contribute.
|
85
85
|
|
86
|
-
For more information about contributing, see the [CONTRIBUTING](https://github.com/
|
86
|
+
For more information about contributing, see the [CONTRIBUTING](https://github.com/elastic/logstash/blob/master/CONTRIBUTING.md) file.
|
@@ -81,12 +81,22 @@ class LogStash::Outputs::Gelf < LogStash::Outputs::Base
|
|
81
81
|
config :short_message, :validate => :string, :default => "short_message"
|
82
82
|
|
83
83
|
public
|
84
|
+
|
85
|
+
def inject_client(gelf)
|
86
|
+
@gelf = gelf
|
87
|
+
self
|
88
|
+
end
|
89
|
+
|
90
|
+
def gelf
|
91
|
+
@gelf
|
92
|
+
end
|
93
|
+
|
84
94
|
def register
|
85
95
|
require "gelf" # rubygem 'gelf'
|
86
96
|
option_hash = Hash.new
|
87
97
|
|
88
98
|
#@gelf = GELF::Notifier.new(@host, @port, @chunksize, option_hash)
|
89
|
-
@gelf
|
99
|
+
@gelf ||= GELF::Notifier.new(@host, @port, @chunksize)
|
90
100
|
|
91
101
|
# This sets the 'log level' of gelf; since we're forwarding messages, we'll
|
92
102
|
# want to forward *all* messages, so set level to 0 so all messages get
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-output-gelf'
|
4
|
-
s.version = '1.
|
4
|
+
s.version = '1.1.0'
|
5
5
|
s.licenses = ['Apache License (2.0)']
|
6
6
|
s.summary = "This output generates messages in GELF format."
|
7
7
|
s.description = "This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program"
|
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.require_paths = ["lib"]
|
12
12
|
|
13
13
|
# Files
|
14
|
-
s.files =
|
14
|
+
s.files = Dir['lib/**/*','spec/**/*','vendor/**/*','*.gemspec','*.md','CONTRIBUTORS','Gemfile','LICENSE','NOTICE.TXT']
|
15
15
|
|
16
16
|
# Tests
|
17
17
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
@@ -23,6 +23,7 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.add_runtime_dependency "logstash-core", '>= 1.4.0', '< 2.0.0'
|
24
24
|
|
25
25
|
s.add_runtime_dependency 'gelf', ['1.3.2']
|
26
|
+
s.add_runtime_dependency 'logstash-codec-plain'
|
26
27
|
|
27
28
|
s.add_development_dependency 'logstash-devutils'
|
28
29
|
end
|
data/spec/outputs/gelf_spec.rb
CHANGED
@@ -1 +1,35 @@
|
|
1
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
require_relative "../spec_helper"
|
3
|
+
require "gelf"
|
4
|
+
|
5
|
+
describe LogStash::Outputs::Gelf do
|
6
|
+
|
7
|
+
let(:host) { "localhost" }
|
8
|
+
let(:port) { rand(1024..65535) }
|
9
|
+
|
10
|
+
it "should register without errors" do
|
11
|
+
plugin = LogStash::Plugin.lookup("output", "gelf").new("host" => host, "port" => port)
|
12
|
+
expect { plugin.register }.to_not raise_error
|
13
|
+
end
|
14
|
+
|
15
|
+
describe "#send" do
|
16
|
+
|
17
|
+
subject { LogStash::Outputs::Gelf.new("host" => host, "port" => port ) }
|
18
|
+
|
19
|
+
let(:properties) { { "message" => "This is a message!"} }
|
20
|
+
let(:event) { LogStash::Event.new(properties) }
|
21
|
+
let(:gelf) { GELF::Notifier.new(host, port, subject.chunksize) }
|
22
|
+
|
23
|
+
before(:each) do
|
24
|
+
subject.inject_client(gelf)
|
25
|
+
subject.register
|
26
|
+
end
|
27
|
+
|
28
|
+
it "sends the generated event to gelf" do
|
29
|
+
expect(subject.gelf).to receive(:notify!).with(hash_including("short_message"=>"This is a message!",
|
30
|
+
"full_message"=>"This is a message!"),
|
31
|
+
hash_including(:timestamp))
|
32
|
+
subject.receive(event)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-output-gelf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logstash-core
|
@@ -44,6 +44,20 @@ dependencies:
|
|
44
44
|
version: 1.3.2
|
45
45
|
prerelease: false
|
46
46
|
type: :runtime
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: logstash-codec-plain
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
requirement: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - '>='
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '0'
|
59
|
+
prerelease: false
|
60
|
+
type: :runtime
|
47
61
|
- !ruby/object:Gem::Dependency
|
48
62
|
name: logstash-devutils
|
49
63
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -64,17 +78,16 @@ executables: []
|
|
64
78
|
extensions: []
|
65
79
|
extra_rdoc_files: []
|
66
80
|
files:
|
67
|
-
- .
|
81
|
+
- lib/logstash/outputs/gelf.rb
|
82
|
+
- spec/spec_helper.rb
|
83
|
+
- spec/outputs/gelf_spec.rb
|
84
|
+
- logstash-output-gelf.gemspec
|
85
|
+
- README.md
|
68
86
|
- CHANGELOG.md
|
69
87
|
- CONTRIBUTORS
|
70
88
|
- Gemfile
|
71
89
|
- LICENSE
|
72
90
|
- NOTICE.TXT
|
73
|
-
- README.md
|
74
|
-
- Rakefile
|
75
|
-
- lib/logstash/outputs/gelf.rb
|
76
|
-
- logstash-output-gelf.gemspec
|
77
|
-
- spec/outputs/gelf_spec.rb
|
78
91
|
homepage: http://www.elastic.co/guide/en/logstash/current/index.html
|
79
92
|
licenses:
|
80
93
|
- Apache License (2.0)
|
@@ -97,9 +110,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
110
|
version: '0'
|
98
111
|
requirements: []
|
99
112
|
rubyforge_project:
|
100
|
-
rubygems_version: 2.
|
113
|
+
rubygems_version: 2.1.9
|
101
114
|
signing_key:
|
102
115
|
specification_version: 4
|
103
116
|
summary: This output generates messages in GELF format.
|
104
117
|
test_files:
|
118
|
+
- spec/spec_helper.rb
|
105
119
|
- spec/outputs/gelf_spec.rb
|
data/.gitignore
DELETED