graylog2_exceptions 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/graylog2_exceptions.gemspec +49 -0
- data/lib/graylog2_exceptions.rb +4 -1
- data/test/test_graylog2_exceptions.rb +6 -2
- metadata +5 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.2.0
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{graylog2_exceptions}
|
8
|
+
s.version = "1.2.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Lennart Koopmann"]
|
12
|
+
s.date = %q{2011-02-23}
|
13
|
+
s.description = %q{A Rack middleware that sends every Exception as GELF message to your Graylog2 server}
|
14
|
+
s.email = %q{lennart@socketfeed.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"README"
|
17
|
+
]
|
18
|
+
s.files = [
|
19
|
+
"README",
|
20
|
+
"Rakefile",
|
21
|
+
"VERSION",
|
22
|
+
"graylog2_exceptions.gemspec",
|
23
|
+
"lib/graylog2_exceptions.rb",
|
24
|
+
"test/helper.rb",
|
25
|
+
"test/test_graylog2_exceptions.rb"
|
26
|
+
]
|
27
|
+
s.homepage = %q{http://www.graylog2.org/}
|
28
|
+
s.require_paths = ["lib"]
|
29
|
+
s.rubygems_version = %q{1.3.7}
|
30
|
+
s.summary = %q{Graylog2 exception notifier}
|
31
|
+
s.test_files = [
|
32
|
+
"test/helper.rb",
|
33
|
+
"test/test_graylog2_exceptions.rb"
|
34
|
+
]
|
35
|
+
|
36
|
+
if s.respond_to? :specification_version then
|
37
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
38
|
+
s.specification_version = 3
|
39
|
+
|
40
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
41
|
+
s.add_runtime_dependency(%q<gelf>, ["= 1.1.3"])
|
42
|
+
else
|
43
|
+
s.add_dependency(%q<gelf>, ["= 1.1.3"])
|
44
|
+
end
|
45
|
+
else
|
46
|
+
s.add_dependency(%q<gelf>, ["= 1.1.3"])
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
data/lib/graylog2_exceptions.rb
CHANGED
@@ -10,6 +10,8 @@ class Graylog2Exceptions
|
|
10
10
|
:hostname => "localhost",
|
11
11
|
:port => 12201,
|
12
12
|
:local_app_name => Socket::gethostname,
|
13
|
+
:facility => 'graylog2_exceptions',
|
14
|
+
:max_chunk_size => 'LAN',
|
13
15
|
:level => 3
|
14
16
|
}
|
15
17
|
|
@@ -37,10 +39,11 @@ class Graylog2Exceptions
|
|
37
39
|
|
38
40
|
def send_to_graylog2 err
|
39
41
|
begin
|
40
|
-
notifier = GELF::Notifier.new(@args[:hostname], @args[:port])
|
42
|
+
notifier = GELF::Notifier.new(@args[:hostname], @args[:port], @args[:max_chunk_size])
|
41
43
|
notifier.notify!(
|
42
44
|
:short_message => err.message,
|
43
45
|
:full_message => err.backtrace.join("\n"),
|
46
|
+
:facility => @args[:facility],
|
44
47
|
:level => @args[:level],
|
45
48
|
:host => @args[:local_app_name],
|
46
49
|
:file => err.backtrace[0].split(":")[0],
|
@@ -14,11 +14,12 @@ class TestGraylog2Exceptions < Test::Unit::TestCase
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def test_correct_parameters_when_custom_set
|
17
|
-
c = Graylog2Exceptions.new(nil, {:host => "localhost", :port => 1337, :local_app_name => "yomama", :level => 1})
|
17
|
+
c = Graylog2Exceptions.new(nil, {:host => "localhost", :port => 1337, :max_chunk_size => 'WAN', :local_app_name => "yomama", :level => 1})
|
18
18
|
|
19
19
|
assert_equal "yomama", c.args[:local_app_name]
|
20
20
|
assert_equal "localhost", c.args[:hostname]
|
21
21
|
assert_equal 1337, c.args[:port]
|
22
|
+
assert_equal 'WAN', c.args[:max_chunk_size]
|
22
23
|
assert_equal 1, c.args[:level]
|
23
24
|
end
|
24
25
|
|
@@ -28,6 +29,7 @@ class TestGraylog2Exceptions < Test::Unit::TestCase
|
|
28
29
|
assert_equal Socket.gethostname, c.args[:local_app_name]
|
29
30
|
assert_equal "localhost", c.args[:hostname]
|
30
31
|
assert_equal 12201, c.args[:port]
|
32
|
+
assert_equal 'LAN', c.args[:max_chunk_size]
|
31
33
|
assert_equal 3, c.args[:level]
|
32
34
|
end
|
33
35
|
|
@@ -39,6 +41,7 @@ class TestGraylog2Exceptions < Test::Unit::TestCase
|
|
39
41
|
|
40
42
|
assert json["short_message"].include?('undefined method `klopfer!')
|
41
43
|
assert json["full_message"].include?('in `build_exception')
|
44
|
+
assert_equal 'graylog2_exceptions', json["facility"]
|
42
45
|
assert_equal 4, json["level"]
|
43
46
|
assert_equal Socket.gethostname, json["host"]
|
44
47
|
assert_equal ex.backtrace[0].split(":")[1], json["line"]
|
@@ -48,12 +51,13 @@ class TestGraylog2Exceptions < Test::Unit::TestCase
|
|
48
51
|
def test_send_exception_to_graylog2_with_custom_parameters
|
49
52
|
ex = build_exception
|
50
53
|
|
51
|
-
c = Graylog2Exceptions.new(nil, {:local_app_name => "machinexx", :level => 4})
|
54
|
+
c = Graylog2Exceptions.new(nil, {:local_app_name => "machinexx", :level => 4, :facility => 'myfacility'})
|
52
55
|
sent = Zlib::Inflate.inflate(c.send_to_graylog2(ex).join)
|
53
56
|
json = JSON.parse(sent)
|
54
57
|
|
55
58
|
assert json["short_message"].include?('undefined method `klopfer!')
|
56
59
|
assert json["full_message"].include?('in `build_exception')
|
60
|
+
assert_equal 'myfacility', json["facility"]
|
57
61
|
assert_equal 3, json["level"]
|
58
62
|
assert_equal "machinexx", json["host"]
|
59
63
|
assert_equal ex.backtrace[0].split(":")[1], json["line"]
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 1
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 1.
|
7
|
+
- 2
|
8
|
+
- 0
|
9
|
+
version: 1.2.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Lennart Koopmann
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-
|
17
|
+
date: 2011-02-23 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -44,6 +44,7 @@ files:
|
|
44
44
|
- README
|
45
45
|
- Rakefile
|
46
46
|
- VERSION
|
47
|
+
- graylog2_exceptions.gemspec
|
47
48
|
- lib/graylog2_exceptions.rb
|
48
49
|
- test/helper.rb
|
49
50
|
- test/test_graylog2_exceptions.rb
|