logstash_rails 0.0.12 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +30 -6
- data/lib/logstash_rails/transport/logfile.rb +1 -1
- data/lib/logstash_rails/transport/logstash_tcp.rb +2 -2
- data/lib/logstash_rails/transport/logstash_udp.rb +2 -2
- data/lib/logstash_rails/version.rb +1 -1
- data/spec/lib/logstash_rails/transport/logstash_tcp_spec.rb +5 -0
- metadata +3 -3
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# LogstashRails
|
1
|
+
# LogstashRails
|
2
2
|
[](http://badge.fury.io/rb/logstash_rails)
|
3
3
|
[](http://travis-ci.org/cmertz/logstash_rails)
|
4
4
|
[](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
|
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.
|
@@ -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)
|
@@ -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.
|
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: -
|
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: -
|
117
|
+
hash: -1388131657381094432
|
118
118
|
requirements: []
|
119
119
|
rubyforge_project:
|
120
120
|
rubygems_version: 1.8.24
|