logstash_rails 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # LogstashRails
1
+ # LogstashRails
2
2
  [![Gem Version](https://badge.fury.io/rb/logstash_rails.png)](http://badge.fury.io/rb/logstash_rails)
3
3
  [![Build Status](https://secure.travis-ci.org/cmertz/logstash_rails.png)](http://travis-ci.org/cmertz/logstash_rails)
4
4
  [![Coverage Status](https://coveralls.io/repos/cmertz/logstash_rails/badge.png)](https://coveralls.io/r/cmertz/logstash_rails)
@@ -36,21 +36,41 @@ and provide an initializer for configuration.
36
36
  `LogstashRails.config` takes an options hash with the following options:
37
37
 
38
38
  * __transport__
39
-
39
+
40
40
  redis, logstash-udp and logstash-tcp are available atm
41
41
 
42
42
  * __logger__
43
-
43
+
44
44
  logger to use in case of exceptions while pushing events to the transport
45
45
 
46
46
  * __events__
47
47
 
48
48
  list of event name patterns to subscribe to. `Regex` and `String` is
49
49
  supported.
50
-
50
+
51
51
  * __transport options__
52
52
 
53
- transport specific options e.g. _host_, _port_ and *redis_key*
53
+ transport specific options that should be self explaining:
54
+
55
+ redis:
56
+
57
+ * __host__
58
+ * __port__
59
+ * __redis_key__
60
+
61
+ logfile:
62
+
63
+ * __logfile__
64
+
65
+ logstash-tcp:
66
+
67
+ * __host__
68
+ * __port__
69
+
70
+ logstash-udp:
71
+
72
+ * __host__
73
+ * __port__
54
74
 
55
75
 
56
76
  ### Examples
@@ -70,7 +90,7 @@ A more complete example looks like:
70
90
  if Rails.env.production?
71
91
  LogstashRails.config(
72
92
  transport: :redis,
73
- host: '1.2.3.4',
93
+ host: '1.2.3.4',
74
94
  port: 12345,
75
95
  redis_key: 'my_key',
76
96
  events: [/action_controller/]
@@ -89,3 +109,7 @@ This will only subscribe to events from `ActionController`.
89
109
  4. Push to the branch (`git push origin my_feature`)
90
110
  5. Open a Pull Request
91
111
  6. Enjoy a refreshing Diet Coke and wait
112
+
113
+ ## License
114
+
115
+ Licensed under the General Public License version 3 (GPLv3). See [LICENSE.txt](/LICENSE.txt) for details.
@@ -17,7 +17,7 @@ module LogstashRails
17
17
  end
18
18
 
19
19
  def push(json_event)
20
- @logger.error(json_event)
20
+ @logger.info(json_event)
21
21
  end
22
22
 
23
23
  end
@@ -3,12 +3,12 @@ module LogstashRails
3
3
  class LogstashTcp < TransportBase
4
4
 
5
5
  def initialize(options)
6
- super
7
-
8
6
  host = options[:host] || 'localhost'
9
7
  port = options.fetch(:port)
10
8
 
11
9
  @socket = TCPSocket.new(host, port)
10
+
11
+ super
12
12
  end
13
13
 
14
14
  def push(json_event)
@@ -3,12 +3,12 @@ module LogstashRails
3
3
  class LogstashUdp < TransportBase
4
4
 
5
5
  def initialize(options = {})
6
- super
7
-
8
6
  host = options[:host] || 'localhost'
9
7
  port = options[:port] || 9999
10
8
 
11
9
  @socket = UDPSocket.new.tap{|s| s.connect(host, port) }
10
+
11
+ super
12
12
  end
13
13
 
14
14
  def push(json_event)
@@ -1,3 +1,3 @@
1
1
  module LogstashRails
2
- VERSION = "0.0.12"
2
+ VERSION = "0.0.13"
3
3
  end
@@ -22,6 +22,11 @@ describe LogstashRails::Transport::LogstashTcp do
22
22
  logstash_tcp.should respond_to :push
23
23
  end
24
24
 
25
+ it 'should close the tcp socket' do
26
+ socket = logstash_tcp.instance_variable_get(:@socket)
27
+ expect{ logstash_tcp.destroy }.to change{ socket.closed? }.from(false).to(true)
28
+ end
29
+
25
30
  it 'sends data over tcp' do
26
31
  logstash_tcp.push 'toto'
27
32
  logstash_tcp.destroy
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -105,7 +105,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
105
105
  version: '0'
106
106
  segments:
107
107
  - 0
108
- hash: -2947384106749656369
108
+ hash: -1388131657381094432
109
109
  required_rubygems_version: !ruby/object:Gem::Requirement
110
110
  none: false
111
111
  requirements:
@@ -114,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
114
114
  version: '0'
115
115
  segments:
116
116
  - 0
117
- hash: -2947384106749656369
117
+ hash: -1388131657381094432
118
118
  requirements: []
119
119
  rubyforge_project:
120
120
  rubygems_version: 1.8.24