syslogstash 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/syslogstash/logstash_writer.rb +3 -0
- data/lib/syslogstash/syslog_reader.rb +7 -7
- data/lib/syslogstash/worker.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57f9a03e8075654fe964cc2fd0da045912296789
|
4
|
+
data.tar.gz: 2e6e1b3264305e47a55d5fd9b275527e4e7b57dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7be74a42eb0f2970cf47872c0d83a2a52fe5ab8d1e739e1951759ec70ce8bf6f5987fb47915691fa172c67f2fd2a5ab93099afe66d62264434a37f9102bad080
|
7
|
+
data.tar.gz: be5027ec85b4e32364a5a5f0101160b41634d76691c0271730f1599b83de6291d1ad747413613a1c2a6ad996865f3fa0f176cd22c1064c09e7788117bc4a9d97
|
@@ -56,6 +56,9 @@ class Syslogstash::LogstashWriter
|
|
56
56
|
# If we got here, we sent successfully, so we don't want
|
57
57
|
# to put the entry back on the queue in the ensure block
|
58
58
|
entry = nil
|
59
|
+
rescue StandardError => ex
|
60
|
+
$stderr.puts "Unhandled exception: #{ex.message} (#{ex.class})"
|
61
|
+
$stderr.puts ex.backtrace.map { |l| " #{l}" }.join("\n")
|
59
62
|
ensure
|
60
63
|
@entries_mutex.synchronize { @entries.unshift if entry }
|
61
64
|
end
|
@@ -19,8 +19,9 @@ class Syslogstash::SyslogReader
|
|
19
19
|
begin
|
20
20
|
socket = Socket.new(Socket::AF_UNIX, Socket::SOCK_DGRAM, 0)
|
21
21
|
socket.bind(Socket.pack_sockaddr_un(@file))
|
22
|
-
rescue Errno::EEXIST
|
23
|
-
|
22
|
+
rescue Errno::EEXIST, Errno::EADDRINUSE
|
23
|
+
log { "socket file #{@file} already exists; deleting"
|
24
|
+
File.unlink(@file) rescue nil
|
24
25
|
retry
|
25
26
|
rescue SystemCallError
|
26
27
|
$stderr.puts "Error while trying to bind to #{@file}"
|
@@ -36,6 +37,7 @@ class Syslogstash::SyslogReader
|
|
36
37
|
end
|
37
38
|
ensure
|
38
39
|
socket.close
|
40
|
+
log { "removing socket file #{@file}"
|
39
41
|
File.unlink(@file) rescue nil
|
40
42
|
end
|
41
43
|
end
|
@@ -74,7 +76,7 @@ class Syslogstash::SyslogReader
|
|
74
76
|
facility: facility,
|
75
77
|
hostname: hostname,
|
76
78
|
program: program,
|
77
|
-
pid: pid,
|
79
|
+
pid: pid.nil? ? nil : pid.to_i,
|
78
80
|
message: message,
|
79
81
|
).to_json
|
80
82
|
|
@@ -89,13 +91,11 @@ class Syslogstash::SyslogReader
|
|
89
91
|
e['@version'] = '1'
|
90
92
|
e['@timestamp'] = Time.now.utc.strftime("%FT%T.%LZ")
|
91
93
|
|
92
|
-
h[
|
93
|
-
h[
|
94
|
+
h[:facility_name] = FACILITIES[h[:facility]]
|
95
|
+
h[:severity_name] = SEVERITIES[h[:severity]]
|
94
96
|
|
95
97
|
e.merge!(h.delete_if { |k,v| v.nil? })
|
96
98
|
|
97
|
-
e[:pid] = e[:pid].to_i if e.has_key?(:pid)
|
98
|
-
|
99
99
|
e.merge!(@tags) if @tags.is_a? Hash
|
100
100
|
|
101
101
|
debug { "Log entry is: #{e.inspect}" }
|
data/lib/syslogstash/worker.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: syslogstash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Palmer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|