graylog2-client 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,32 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ graylog2-client (0.0.3)
5
+ httparty
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ diff-lcs (1.1.3)
11
+ fakeweb (1.3.0)
12
+ httparty (0.8.3)
13
+ multi_json (~> 1.0)
14
+ multi_xml
15
+ multi_json (1.3.6)
16
+ multi_xml (0.5.1)
17
+ rspec (2.11.0)
18
+ rspec-core (~> 2.11.0)
19
+ rspec-expectations (~> 2.11.0)
20
+ rspec-mocks (~> 2.11.0)
21
+ rspec-core (2.11.0)
22
+ rspec-expectations (2.11.1)
23
+ diff-lcs (~> 1.1.3)
24
+ rspec-mocks (2.11.1)
25
+
26
+ PLATFORMS
27
+ ruby
28
+
29
+ DEPENDENCIES
30
+ fakeweb
31
+ graylog2-client!
32
+ rspec
@@ -1,5 +1,6 @@
1
1
  # -*- coding: UTF-8 -*-
2
2
  require "json"
3
+ require "httparty"
3
4
 
4
5
  module Graylog2Client
5
6
  class Parser
@@ -1,4 +1,4 @@
1
1
  # -*- coding: UTF-8 -*-
2
2
  module Graylog2Client
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
@@ -0,0 +1,95 @@
1
+ {
2
+ "hits" : {
3
+ "hits" : [
4
+ {
5
+ "_source" : {
6
+ "file" : null,
7
+ "full_message" : null,
8
+ "facility" : "User",
9
+ "host" : "hm3560",
10
+ "message" : "NotWorking",
11
+ "level" : 6,
12
+ "created_at" : 1342118632.66665,
13
+ "_amqp_queue" : "graylog2",
14
+ "streams" : [
15
+ "4f0612acca6e011713000002"
16
+ ],
17
+ "line" : -1
18
+ },
19
+ "_score" : 4.0699506,
20
+ "_index" : "graylog2",
21
+ "_id" : "RRsn3BPbS5GnmvY2Jj8KmQ",
22
+ "_type" : "message"
23
+ },
24
+ {
25
+ "_source" : {
26
+ "file" : null,
27
+ "full_message" : null,
28
+ "facility" : "User",
29
+ "host" : "hm3560",
30
+ "message" : "Shutting down",
31
+ "level" : 6,
32
+ "created_at" : 1342118627.82796,
33
+ "_amqp_queue" : "graylog2",
34
+ "streams" : [
35
+ "4f0612acca6e011713000002"
36
+ ],
37
+ "line" : -1
38
+ },
39
+ "_score" : 4.0642123,
40
+ "_index" : "graylog2",
41
+ "_id" : "W_Chv79ORdmF8rJoOxAvVQ",
42
+ "_type" : "message"
43
+ },
44
+ {
45
+ "_source" : {
46
+ "file" : null,
47
+ "full_message" : null,
48
+ "facility" : "User",
49
+ "host" : "hm3560",
50
+ "message" : "Rebooting",
51
+ "level" : 6,
52
+ "created_at" : 1342119043.03872,
53
+ "_amqp_queue" : "graylog2",
54
+ "streams" : [
55
+ "4f0612acca6e011713000002"
56
+ ],
57
+ "line" : -1
58
+ },
59
+ "_score" : 4.059801,
60
+ "_index" : "graylog2",
61
+ "_id" : "982KwNXFRLucygZLpE5X5w",
62
+ "_type" : "message"
63
+ },
64
+ {
65
+ "_source" : {
66
+ "file" : null,
67
+ "full_message" : null,
68
+ "facility" : "User",
69
+ "host" : "hm3560",
70
+ "message" : "Working",
71
+ "level" : 6,
72
+ "created_at" : 1342117893.78322,
73
+ "_amqp_queue" : "graylog2",
74
+ "streams" : [
75
+ "4f0612acca6e011713000002"
76
+ ],
77
+ "line" : -1
78
+ },
79
+ "_score" : 3.4885292,
80
+ "_index" : "graylog2",
81
+ "_id" : "1z5h1tuFRxCxi73J2MY0Ng",
82
+ "_type" : "message"
83
+ }
84
+ ],
85
+ "max_score" : 4.0699506,
86
+ "total" : 61
87
+ },
88
+ "timed_out" : false,
89
+ "_shards" : {
90
+ "failed" : 0,
91
+ "successful" : 5,
92
+ "total" : 5
93
+ },
94
+ "took" : 18
95
+ }
@@ -0,0 +1,22 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe Graylog2Client::Parser do
4
+ before do
5
+ url = "http://elasticsearch.company.com/graylog2/_search"
6
+
7
+ resp = File.read(File.expand_path(File.dirname(__FILE__) + '/fixtures/four_results.json'))
8
+ HTTParty.stub(:get).and_return(JSON.parse(resp))
9
+
10
+ @graylog = Graylog2Client::Parser.new(:url => url)
11
+ end
12
+
13
+ context "when sorting" do
14
+ it "Should not return the same order from elasticsearch" do
15
+ @graylog.messages_for("anything").first.should_not match(/NotWorking/)
16
+ end
17
+
18
+ it "Should return results sorted by date" do
19
+ @graylog.messages_for("anything").first.should match(/Working/)
20
+ end
21
+ end
22
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graylog2-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -54,7 +54,9 @@ extra_rdoc_files: []
54
54
  files:
55
55
  - ./graylog2-client.gemspec
56
56
  - ./spec/spec_helper.rb
57
- - ./spec/graylog2-client.rb
57
+ - ./spec/graylog2_client_spec.rb
58
+ - ./spec/fixtures/four_results.json
59
+ - ./Gemfile.lock
58
60
  - ./Rakefile
59
61
  - ./Gemfile
60
62
  - ./README.md
@@ -1 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')