gelfd 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Rakefile +7 -0
- data/gelfd.gemspec +1 -1
- data/lib/gelfd/chunked_parser.rb +2 -0
- data/lib/gelfd/version.rb +1 -1
- data/test/fixtures/chunked_10_37.chunk +0 -0
- data/test/fixtures/chunked_11_37.chunk +0 -0
- data/test/fixtures/chunked_12_37.chunk +0 -0
- data/test/fixtures/chunked_13_37.chunk +0 -0
- data/test/fixtures/chunked_14_37.chunk +0 -0
- data/test/fixtures/chunked_15_37.chunk +0 -0
- data/test/fixtures/chunked_16_37.chunk +0 -0
- data/test/fixtures/chunked_17_37.chunk +0 -0
- data/test/fixtures/chunked_18_37.chunk +0 -0
- data/test/fixtures/chunked_19_37.chunk +0 -0
- data/test/fixtures/chunked_1_37.chunk +0 -0
- data/test/fixtures/chunked_20_37.chunk +0 -0
- data/test/fixtures/chunked_21_37.chunk +0 -0
- data/test/fixtures/chunked_22_37.chunk +0 -0
- data/test/fixtures/chunked_23_37.chunk +0 -0
- data/test/fixtures/chunked_24_37.chunk +0 -0
- data/test/fixtures/chunked_25_37.chunk +0 -0
- data/test/fixtures/chunked_26_37.chunk +0 -0
- data/test/fixtures/chunked_27_37.chunk +0 -0
- data/test/fixtures/chunked_28_37.chunk +0 -0
- data/test/fixtures/chunked_29_37.chunk +0 -0
- data/test/fixtures/chunked_2_37.chunk +0 -0
- data/test/fixtures/chunked_30_37.chunk +0 -0
- data/test/fixtures/chunked_31_37.chunk +0 -0
- data/test/fixtures/chunked_32_37.chunk +0 -0
- data/test/fixtures/chunked_33_37.chunk +0 -0
- data/test/fixtures/chunked_34_37.chunk +0 -0
- data/test/fixtures/chunked_35_37.chunk +0 -0
- data/test/fixtures/chunked_36_37.chunk +0 -0
- data/test/fixtures/chunked_37_37.chunk +0 -0
- data/test/fixtures/chunked_3_37.chunk +0 -0
- data/test/fixtures/chunked_4_37.chunk +0 -0
- data/test/fixtures/chunked_5_37.chunk +0 -0
- data/test/fixtures/chunked_6_37.chunk +0 -0
- data/test/fixtures/chunked_7_37.chunk +0 -0
- data/test/fixtures/chunked_8_37.chunk +0 -0
- data/test/fixtures/chunked_9_37.chunk +0 -0
- data/test/tc_chunked.rb +17 -0
- data/test/tc_unchunked.rb +14 -0
- data/test/ts_all.rb +4 -0
- metadata +54 -4
data/.gitignore
CHANGED
data/Rakefile
CHANGED
data/gelfd.gemspec
CHANGED
data/lib/gelfd/chunked_parser.rb
CHANGED
@@ -22,6 +22,7 @@ module Gelfd
|
|
22
22
|
# This has a chance for an DoS
|
23
23
|
# you can send a chunked message as a chunked message
|
24
24
|
t = Parser.parse(buff.clone)
|
25
|
+
@@chunk_map.delete(msg_id)
|
25
26
|
t
|
26
27
|
rescue Exception => e
|
27
28
|
"Exception: #{e.message}"
|
@@ -42,5 +43,6 @@ module Gelfd
|
|
42
43
|
msg_id
|
43
44
|
end
|
44
45
|
end
|
46
|
+
|
45
47
|
end
|
46
48
|
end
|
data/lib/gelfd/version.rb
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/test/tc_chunked.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), "..", "lib")))
|
2
|
+
require 'gelfd'
|
3
|
+
require 'json'
|
4
|
+
require 'test/unit'
|
5
|
+
|
6
|
+
class TestChhunkedGelf < Test::Unit::TestCase
|
7
|
+
JSON_MESSAGE = '{"version":"1.0","host":"somehost","level":"debug","facility":"myapp","short_message":"boom","full_message":"something failed horribly","file":"myapp.rb","timestamp":1315539095.041,"line":105}'
|
8
|
+
FIXTURE_PATH = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures'))
|
9
|
+
def test_chunked_message
|
10
|
+
files = Dir.glob("#{FIXTURE_PATH}/*.chunk")
|
11
|
+
files.each do |file|
|
12
|
+
data = File.open("#{file}", "rb") {|f| f.read}
|
13
|
+
@t = Gelfd::Parser.parse(data)
|
14
|
+
end
|
15
|
+
assert_equal(JSON_MESSAGE, @t)
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), "..", "lib")))
|
2
|
+
require 'gelfd'
|
3
|
+
require 'json'
|
4
|
+
require 'test/unit'
|
5
|
+
|
6
|
+
class TestUnchunkedGelf < Test::Unit::TestCase
|
7
|
+
FIXTURE_PATH = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures'))
|
8
|
+
|
9
|
+
def test_unchunked_message
|
10
|
+
data = File.open("#{FIXTURE_PATH}/unchunked.zl", "rb") {|f| f.read}
|
11
|
+
t = Gelfd::Parser.parse(data)
|
12
|
+
assert_equal('{"this":"is","my":"boomstick"}', t)
|
13
|
+
end
|
14
|
+
end
|
data/test/ts_all.rb
ADDED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: gelfd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0
|
5
|
+
version: 0.1.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- John E. Vincent
|
@@ -10,9 +10,19 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-09-
|
14
|
-
dependencies:
|
15
|
-
|
13
|
+
date: 2011-09-10 00:00:00 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rake
|
17
|
+
prerelease: false
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ~>
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.9.2
|
24
|
+
type: :development
|
25
|
+
version_requirements: *id001
|
16
26
|
description: Standalone implementation of the Graylog Extended Log Format
|
17
27
|
email:
|
18
28
|
- lusis.org+github.com@gmail.com
|
@@ -36,7 +46,47 @@ files:
|
|
36
46
|
- lib/gelfd/parser.rb
|
37
47
|
- lib/gelfd/version.rb
|
38
48
|
- lib/gelfd/zlib_parser.rb
|
49
|
+
- test/fixtures/chunked_10_37.chunk
|
50
|
+
- test/fixtures/chunked_11_37.chunk
|
51
|
+
- test/fixtures/chunked_12_37.chunk
|
52
|
+
- test/fixtures/chunked_13_37.chunk
|
53
|
+
- test/fixtures/chunked_14_37.chunk
|
54
|
+
- test/fixtures/chunked_15_37.chunk
|
55
|
+
- test/fixtures/chunked_16_37.chunk
|
56
|
+
- test/fixtures/chunked_17_37.chunk
|
57
|
+
- test/fixtures/chunked_18_37.chunk
|
58
|
+
- test/fixtures/chunked_19_37.chunk
|
59
|
+
- test/fixtures/chunked_1_37.chunk
|
60
|
+
- test/fixtures/chunked_20_37.chunk
|
61
|
+
- test/fixtures/chunked_21_37.chunk
|
62
|
+
- test/fixtures/chunked_22_37.chunk
|
63
|
+
- test/fixtures/chunked_23_37.chunk
|
64
|
+
- test/fixtures/chunked_24_37.chunk
|
65
|
+
- test/fixtures/chunked_25_37.chunk
|
66
|
+
- test/fixtures/chunked_26_37.chunk
|
67
|
+
- test/fixtures/chunked_27_37.chunk
|
68
|
+
- test/fixtures/chunked_28_37.chunk
|
69
|
+
- test/fixtures/chunked_29_37.chunk
|
70
|
+
- test/fixtures/chunked_2_37.chunk
|
71
|
+
- test/fixtures/chunked_30_37.chunk
|
72
|
+
- test/fixtures/chunked_31_37.chunk
|
73
|
+
- test/fixtures/chunked_32_37.chunk
|
74
|
+
- test/fixtures/chunked_33_37.chunk
|
75
|
+
- test/fixtures/chunked_34_37.chunk
|
76
|
+
- test/fixtures/chunked_35_37.chunk
|
77
|
+
- test/fixtures/chunked_36_37.chunk
|
78
|
+
- test/fixtures/chunked_37_37.chunk
|
79
|
+
- test/fixtures/chunked_3_37.chunk
|
80
|
+
- test/fixtures/chunked_4_37.chunk
|
81
|
+
- test/fixtures/chunked_5_37.chunk
|
82
|
+
- test/fixtures/chunked_6_37.chunk
|
83
|
+
- test/fixtures/chunked_7_37.chunk
|
84
|
+
- test/fixtures/chunked_8_37.chunk
|
85
|
+
- test/fixtures/chunked_9_37.chunk
|
39
86
|
- test/fixtures/unchunked.zl
|
87
|
+
- test/tc_chunked.rb
|
88
|
+
- test/tc_unchunked.rb
|
89
|
+
- test/ts_all.rb
|
40
90
|
homepage: ""
|
41
91
|
licenses: []
|
42
92
|
|