logglier 0.2.13 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +18 -0
- data/lib/logglier/client.rb +6 -4
- data/lib/logglier/client/syslog.rb +2 -1
- data/lib/logglier/version.rb +1 -1
- data/spec/client_spec.rb +12 -8
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c076d61e02f5315d0d32d884c88182f91a2d8530
|
4
|
+
data.tar.gz: 32f4d8efc429ecf94044bd44196e7017e100687f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f0cf90945e35b9842247b32e77c624338ae94b78a18e6e8ac942a49cbdb8e85d78b11846fa81e7ea629b67f3874336311318241361f2e76e34e9ad0856c31ef
|
7
|
+
data.tar.gz: 3e4ce0f615faf8c7b4b2e18c896bc39c1c1c1b551de3d0cdcba6f80ac4df98026702f55bb57573a20eb920d7944771ade59e8d4ecff76e9738b5ccbd342a84dd
|
data/README.md
CHANGED
@@ -112,6 +112,24 @@ Will produce the following log message in Loggly:
|
|
112
112
|
Will produce the following log message in Loggly:
|
113
113
|
|
114
114
|
"<Date> severity=WARN, boom=box, bar=soap"
|
115
|
+
|
116
|
+
### Logging Fast
|
117
|
+
If speed is a concern, then you should pick a fast transport protocol. Here is their speed ranking from fastest to slowest:
|
118
|
+
<ol>
|
119
|
+
<li>Syslog UDP</li>
|
120
|
+
<li>Syslog TCP</li>
|
121
|
+
<li>Threaded HTTP</li>
|
122
|
+
<li>Threaded HTTPS</li>
|
123
|
+
<li>Blocking HTTP</li>
|
124
|
+
<li>Blocking HTTPS</li>
|
125
|
+
</ol>
|
126
|
+
Syslog is the fastest because it's the most efficient protocol and the syslog daemon runs asynchronously with it's own queuing system (and optionally TLS encryption).
|
127
|
+
|
128
|
+
UDP uses a simple connectionless transmission model with a minimum of protocol mechanism. There is no guarantee of delivery, ordering, or duplicate protection.
|
129
|
+
|
130
|
+
Threaded won't block your app but it can use up more memory and stack space. Blocking is the slowest because your app will wait for the data to be received by Loggly.
|
131
|
+
|
132
|
+
HTTPS is slower than HTTP because it requires an extra round trip to setup the secure connection.
|
115
133
|
|
116
134
|
Bugs
|
117
135
|
-----
|
data/lib/logglier/client.rb
CHANGED
@@ -59,20 +59,22 @@ module Logglier
|
|
59
59
|
|
60
60
|
def formatter
|
61
61
|
proc do |severity, datetime, progname, msg|
|
62
|
+
processid=Process.pid
|
62
63
|
if @format == :json && msg.is_a?(Hash)
|
63
64
|
MultiJson.dump(msg.merge({ :severity => severity,
|
64
65
|
:datetime => datetime,
|
65
|
-
:progname => progname
|
66
|
+
:progname => progname,
|
67
|
+
:pid => processid }))
|
66
68
|
else
|
67
69
|
message = "#{datetime} "
|
68
|
-
message << massage_message(msg, severity)
|
70
|
+
message << massage_message(msg, severity, processid)
|
69
71
|
end
|
70
72
|
end
|
71
73
|
end
|
72
74
|
|
73
|
-
def massage_message(incoming_message, severity)
|
75
|
+
def massage_message(incoming_message, severity, processid)
|
74
76
|
outgoing_message = ""
|
75
|
-
outgoing_message << "severity=#{severity}, "
|
77
|
+
outgoing_message << "pid=#{processid}, severity=#{severity}, "
|
76
78
|
case incoming_message
|
77
79
|
when Hash
|
78
80
|
outgoing_message << masher(incoming_message)
|
@@ -79,13 +79,14 @@ module Logglier
|
|
79
79
|
# See RFC3164 4.1.1 - 4.1.3
|
80
80
|
def formatter
|
81
81
|
proc do |severity, datetime, progname, msg|
|
82
|
+
processid=Process.pid
|
82
83
|
message = "<#{pri(severity)}>#{datetime.strftime(datetime_format)} #{@hostname} "
|
83
84
|
if progname
|
84
85
|
message << "#{progname}: "
|
85
86
|
else
|
86
87
|
message << "#{$0}: "
|
87
88
|
end
|
88
|
-
message << massage_message(msg,severity)
|
89
|
+
message << massage_message(msg,severity,processid)
|
89
90
|
if @input_uri.scheme == 'tcp'
|
90
91
|
message << "\r\n"
|
91
92
|
end
|
data/lib/logglier/version.rb
CHANGED
data/spec/client_spec.rb
CHANGED
@@ -74,29 +74,33 @@ describe Logglier::Client do
|
|
74
74
|
subject { Logglier::Client.new('https://localhost') }
|
75
75
|
|
76
76
|
it "should mash out hashes" do
|
77
|
-
message = subject.massage_message({:foo => :bar},"WARN")
|
78
|
-
message.should =~ /^
|
77
|
+
message = subject.massage_message({:foo => :bar},"WARN", "1024")
|
78
|
+
message.should =~ /^pid=1024,/
|
79
|
+
message.should =~ /severity=WARN,/
|
79
80
|
message.should =~ /foo=bar/
|
80
81
|
end
|
81
82
|
|
82
83
|
it "should mash out nested hashes" do
|
83
|
-
message = subject.massage_message({:foo => :bar, :bazzle => { :bom => :bastic } }, "WARN")
|
84
|
-
message.should =~ /^
|
84
|
+
message = subject.massage_message({:foo => :bar, :bazzle => { :bom => :bastic } }, "WARN", "1025")
|
85
|
+
message.should =~ /^pid=1025,/
|
86
|
+
message.should =~ /severity=WARN,/
|
85
87
|
message.should =~ /foo=bar/
|
86
88
|
message.should =~ /bazzle\.bom=bastic/
|
87
89
|
end
|
88
90
|
|
89
91
|
it "should mash out deeply nested hashes" do
|
90
|
-
message = subject.massage_message({:foo => :bar, :bazzle => { :bom => :bastic, :totally => { :freaking => :funny } } }, "WARN")
|
91
|
-
message.should =~ /^
|
92
|
+
message = subject.massage_message({:foo => :bar, :bazzle => { :bom => :bastic, :totally => { :freaking => :funny } } }, "WARN", "1026")
|
93
|
+
message.should =~ /^pid=1026,/
|
94
|
+
message.should =~ /severity=WARN,/
|
92
95
|
message.should =~ /foo=bar/
|
93
96
|
message.should =~ /bazzle\.bom=bastic/
|
94
97
|
message.should =~ /bazzle\.totally\.freaking=funny/
|
95
98
|
end
|
96
99
|
|
97
100
|
it "should mash out deeply nested hashes, with an array" do
|
98
|
-
message = subject.massage_message({:foo => :bar, :taste => ["this","sauce"], :bazzle => { :bom => :bastic, :totally => { :freaking => :funny } } }, "WARN")
|
99
|
-
message.should =~ /^
|
101
|
+
message = subject.massage_message({:foo => :bar, :taste => ["this","sauce"], :bazzle => { :bom => :bastic, :totally => { :freaking => :funny } } }, "WARN", "1027")
|
102
|
+
message.should =~ /^pid=1027,/
|
103
|
+
message.should =~ /severity=WARN,/
|
100
104
|
message.should =~ /foo=bar/
|
101
105
|
message.should =~ /taste=\["this", "sauce"\]/
|
102
106
|
message.should =~ /bazzle\.bom=bastic/
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logglier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Edward Muller (aka freeformz)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -102,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
102
|
version: 1.3.6
|
103
103
|
requirements: []
|
104
104
|
rubyforge_project: logglier
|
105
|
-
rubygems_version: 2.
|
105
|
+
rubygems_version: 2.4.5.1
|
106
106
|
signing_key:
|
107
107
|
specification_version: 4
|
108
108
|
summary: Loggly "plugin" for Logger
|
@@ -113,3 +113,4 @@ test_files:
|
|
113
113
|
- spec/logglier_spec.rb
|
114
114
|
- spec/spec_helper.rb
|
115
115
|
- spec/threaded_spec.rb
|
116
|
+
has_rdoc:
|