logstash_rails 0.0.9 → 0.0.10
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/Gemfile +1 -0
- data/README.md +2 -2
- data/Rakefile +1 -1
- data/lib/logstash_rails/configuration_base.rb +25 -11
- data/lib/logstash_rails/version.rb +1 -1
- metadata +5 -5
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -32,7 +32,7 @@ and provide an initializer for configuration.
|
|
32
32
|
|
33
33
|
* __transport__
|
34
34
|
|
35
|
-
redis
|
35
|
+
redis, logstash-udp and logstash-tcp are available atm
|
36
36
|
|
37
37
|
* __logger__
|
38
38
|
|
@@ -64,7 +64,7 @@ A more complete example looks like:
|
|
64
64
|
```ruby
|
65
65
|
if Rails.env.production?
|
66
66
|
LogstashRails.config(
|
67
|
-
transport: redis,
|
67
|
+
transport: :redis,
|
68
68
|
host: '1.2.3.4',
|
69
69
|
port: 12345,
|
70
70
|
redis_key: 'my_key',
|
data/Rakefile
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
module LogstashRails
|
2
|
+
|
3
|
+
# base class for all transports
|
4
|
+
#
|
2
5
|
class ConfigurationBase
|
3
6
|
|
7
|
+
# @param options [Hash]
|
8
|
+
#
|
9
|
+
# @option options [Array] :events The list of events to subscribe
|
10
|
+
# @option options [Logger] :logger The logger for exceptions
|
11
|
+
#
|
4
12
|
def initialize(options)
|
5
13
|
@events = options[:events] || [/.*/]
|
6
14
|
@logger = options[:logger]
|
@@ -12,6 +20,10 @@ module LogstashRails
|
|
12
20
|
subscribe
|
13
21
|
end
|
14
22
|
|
23
|
+
# destroy
|
24
|
+
#
|
25
|
+
# unsubscribe from ActiveSupport::Notifications
|
26
|
+
#
|
15
27
|
def destroy
|
16
28
|
return unless @subscriptions
|
17
29
|
|
@@ -24,21 +36,23 @@ module LogstashRails
|
|
24
36
|
|
25
37
|
def subscribe
|
26
38
|
@subscriptions = @events.map do |event|
|
27
|
-
ActiveSupport::Notifications.subscribe(event)
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
39
|
+
ActiveSupport::Notifications.subscribe(event, method(:event_handler))
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def event_handler(*args)
|
44
|
+
json_event = Formatter.format(*args)
|
45
|
+
|
46
|
+
begin
|
47
|
+
push(json_event)
|
48
|
+
rescue
|
49
|
+
log($!)
|
36
50
|
end
|
37
51
|
end
|
38
52
|
|
39
53
|
def log(exception)
|
40
|
-
|
41
|
-
@logger.error(
|
54
|
+
return unless @logger
|
55
|
+
@logger.error(exception.message + "\n " + exception.backtrace.join("\n "))
|
42
56
|
end
|
43
57
|
|
44
58
|
end
|
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.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-06-
|
12
|
+
date: 2013-06-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: logstash-event
|
@@ -103,7 +103,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
103
103
|
version: '0'
|
104
104
|
segments:
|
105
105
|
- 0
|
106
|
-
hash:
|
106
|
+
hash: -1863269077052874356
|
107
107
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
108
|
none: false
|
109
109
|
requirements:
|
@@ -112,10 +112,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
112
|
version: '0'
|
113
113
|
segments:
|
114
114
|
- 0
|
115
|
-
hash:
|
115
|
+
hash: -1863269077052874356
|
116
116
|
requirements: []
|
117
117
|
rubyforge_project:
|
118
|
-
rubygems_version: 1.8.
|
118
|
+
rubygems_version: 1.8.24
|
119
119
|
signing_key:
|
120
120
|
specification_version: 3
|
121
121
|
summary: Send events from Rails to Logstash without logger foo.
|