gelfd 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. data/.gitignore +1 -0
  2. data/Rakefile +7 -0
  3. data/gelfd.gemspec +1 -1
  4. data/lib/gelfd/chunked_parser.rb +2 -0
  5. data/lib/gelfd/version.rb +1 -1
  6. data/test/fixtures/chunked_10_37.chunk +0 -0
  7. data/test/fixtures/chunked_11_37.chunk +0 -0
  8. data/test/fixtures/chunked_12_37.chunk +0 -0
  9. data/test/fixtures/chunked_13_37.chunk +0 -0
  10. data/test/fixtures/chunked_14_37.chunk +0 -0
  11. data/test/fixtures/chunked_15_37.chunk +0 -0
  12. data/test/fixtures/chunked_16_37.chunk +0 -0
  13. data/test/fixtures/chunked_17_37.chunk +0 -0
  14. data/test/fixtures/chunked_18_37.chunk +0 -0
  15. data/test/fixtures/chunked_19_37.chunk +0 -0
  16. data/test/fixtures/chunked_1_37.chunk +0 -0
  17. data/test/fixtures/chunked_20_37.chunk +0 -0
  18. data/test/fixtures/chunked_21_37.chunk +0 -0
  19. data/test/fixtures/chunked_22_37.chunk +0 -0
  20. data/test/fixtures/chunked_23_37.chunk +0 -0
  21. data/test/fixtures/chunked_24_37.chunk +0 -0
  22. data/test/fixtures/chunked_25_37.chunk +0 -0
  23. data/test/fixtures/chunked_26_37.chunk +0 -0
  24. data/test/fixtures/chunked_27_37.chunk +0 -0
  25. data/test/fixtures/chunked_28_37.chunk +0 -0
  26. data/test/fixtures/chunked_29_37.chunk +0 -0
  27. data/test/fixtures/chunked_2_37.chunk +0 -0
  28. data/test/fixtures/chunked_30_37.chunk +0 -0
  29. data/test/fixtures/chunked_31_37.chunk +0 -0
  30. data/test/fixtures/chunked_32_37.chunk +0 -0
  31. data/test/fixtures/chunked_33_37.chunk +0 -0
  32. data/test/fixtures/chunked_34_37.chunk +0 -0
  33. data/test/fixtures/chunked_35_37.chunk +0 -0
  34. data/test/fixtures/chunked_36_37.chunk +0 -0
  35. data/test/fixtures/chunked_37_37.chunk +0 -0
  36. data/test/fixtures/chunked_3_37.chunk +0 -0
  37. data/test/fixtures/chunked_4_37.chunk +0 -0
  38. data/test/fixtures/chunked_5_37.chunk +0 -0
  39. data/test/fixtures/chunked_6_37.chunk +0 -0
  40. data/test/fixtures/chunked_7_37.chunk +0 -0
  41. data/test/fixtures/chunked_8_37.chunk +0 -0
  42. data/test/fixtures/chunked_9_37.chunk +0 -0
  43. data/test/tc_chunked.rb +17 -0
  44. data/test/tc_unchunked.rb +14 -0
  45. data/test/ts_all.rb +4 -0
  46. metadata +54 -4
data/.gitignore CHANGED
@@ -2,3 +2,4 @@
2
2
  .bundle
3
3
  Gemfile.lock
4
4
  pkg/*
5
+ .rvmrc
data/Rakefile CHANGED
@@ -1 +1,8 @@
1
1
  require "bundler/gem_tasks"
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new do |t|
5
+ t.libs << "test"
6
+ t.test_files = FileList['test/ts_*.rb']
7
+ t.verbose = true
8
+ end
data/gelfd.gemspec CHANGED
@@ -19,6 +19,6 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = ["lib"]
20
20
 
21
21
  # specify any dependencies here; for example:
22
- # s.add_development_dependency "rspec"
22
+ s.add_development_dependency "rake", "~> 0.9.2"
23
23
  # s.add_runtime_dependency "rest-client"
24
24
  end
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Gelfd
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
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
@@ -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
@@ -0,0 +1,4 @@
1
+ $:.unshift(File.expand_path(File.join(File.dirname(__FILE__), "..", "test")))
2
+ require 'test/unit'
3
+ require 'tc_unchunked'
4
+ require 'tc_chunked'
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: gelfd
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.1
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-09 00:00:00 Z
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