logjam_agent 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
data/lib/logjam_agent.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require "socket"
|
1
2
|
require "logjam_agent/version"
|
2
3
|
require "logjam_agent/amqp_forwarder"
|
3
4
|
require "logjam_agent/forwarders"
|
@@ -18,6 +19,18 @@ module LogjamAgent
|
|
18
19
|
mattr_accessor :environment_name
|
19
20
|
self.environment_name = nil
|
20
21
|
|
22
|
+
def self.get_hostname
|
23
|
+
n = Socket.gethostname
|
24
|
+
if n.split('.').size > 1
|
25
|
+
n
|
26
|
+
else
|
27
|
+
Socket.gethostbyname(n) rescue n
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
mattr_accessor :hostname
|
32
|
+
self.hostname = self.get_hostname
|
33
|
+
|
21
34
|
def self.disable!
|
22
35
|
self.disabled = true
|
23
36
|
end
|
data/lib/logjam_agent/request.rb
CHANGED
@@ -1,17 +1,14 @@
|
|
1
1
|
require "json"
|
2
|
-
require "socket"
|
3
2
|
|
4
3
|
module LogjamAgent
|
5
4
|
class Request
|
6
5
|
attr_reader :fields
|
7
6
|
|
8
|
-
@@hostname = Socket.gethostname.split('.').first
|
9
|
-
|
10
7
|
def initialize(app, env, logger, initial_fields)
|
11
8
|
@logger = logger
|
12
9
|
@forwarder = Forwarders.get(app, env)
|
13
10
|
@lines = []
|
14
|
-
@fields = initial_fields.merge(:host =>
|
11
|
+
@fields = initial_fields.merge(:host => LogjamAgent.hostname, :process_id => Process.pid, :lines => @lines)
|
15
12
|
end
|
16
13
|
|
17
14
|
def add_line(severity, timestamp, message)
|
data/lib/logjam_agent/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logjam_agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 1
|
10
|
+
version: 0.3.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Stefan Kaes
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-10-
|
18
|
+
date: 2011-10-25 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|