syslog_protocol_ms 0.10.0 → 0.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -0
- data/lib/syslog_protocol_ms.rb +2 -2
- data/lib/syslog_protocol_ms/common.rb +1 -1
- data/lib/syslog_protocol_ms/logger.rb +1 -1
- data/lib/syslog_protocol_ms/packet.rb +1 -1
- data/lib/syslog_protocol_ms/parser.rb +1 -1
- data/syslog_protocol_ms.gemspec +1 -1
- data/test/test_logger.rb +2 -2
- data/test/test_packet.rb +1 -1
- data/test/test_parser.rb +5 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01e0a7382d7b33c31e9653277aa2091cbcf089a0742a0ede8c5b0598f17446d4
|
4
|
+
data.tar.gz: ab8823804f59d72237b7d2289671c43b8d72cd57f35a5a53c484c57c0a956316
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e36f03032c5117be5f5d02b844221b54449b4f8191298e42e852a4b0c7c6d9e1cdd72d274b45123805aa499978c04d11e360595c44fd44e2a75c3af290404a1b
|
7
|
+
data.tar.gz: d21b4dd94f71c1811d9da7c080921e545758e6e1708498bf2a1e27e306342e3e5c73886b2a8e7049b97711dd71fc7de614320b4b4bc8ddd380b7cf01fbf2a7ee
|
data/README.md
CHANGED
@@ -1,7 +1,16 @@
|
|
1
1
|
# Syslog protocol
|
2
2
|
|
3
|
+
Based on https://github.com/eric/syslog_protocol
|
4
|
+
|
3
5
|
roughly conforms to the murky shade of grey known as http://www.faqs.org/rfcs/rfc3164.html
|
4
6
|
|
7
|
+
## Changes
|
8
|
+
|
9
|
+
- Rename to syslog_protocol_ms
|
10
|
+
- lib/syslog_protocol_ms/packet.rb
|
11
|
+
- `time.strftime("%b #{day} %H:%M:%S")` -> `time.strftime("%b #{day} %H:%M:%S.%3N")`
|
12
|
+
|
13
|
+
|
5
14
|
## Examples
|
6
15
|
|
7
16
|
### Manipulate packets manually
|
data/lib/syslog_protocol_ms.rb
CHANGED
data/syslog_protocol_ms.gemspec
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
|
|
13
13
|
## If your rubyforge_project name is different, then edit it and comment out
|
14
14
|
## the sub! line in the Rakefile
|
15
15
|
s.name = 'syslog_protocol_ms'
|
16
|
-
s.version = '0.10.
|
16
|
+
s.version = '0.10.1'
|
17
17
|
s.date = "2021-08-03"
|
18
18
|
# s.rubyforge_project = 'syslog_protocol_ms'
|
19
19
|
|
data/test/test_logger.rb
CHANGED
@@ -3,11 +3,11 @@ require File.expand_path('../helper', __FILE__)
|
|
3
3
|
describe "syslog logger" do
|
4
4
|
|
5
5
|
it "create a new logger with hostname and facility" do
|
6
|
-
lambda {@logger =
|
6
|
+
lambda {@logger = SyslogProtocol::Logger.new("space_station", 'test', "local0")}.should.not.raise
|
7
7
|
end
|
8
8
|
|
9
9
|
it "hostname and facility must conform to the requirements of a Packet" do
|
10
|
-
lambda {
|
10
|
+
lambda {SyslogProtocol::Logger.new("space station", "some shit", 'test test')}.should.raise ArgumentError
|
11
11
|
end
|
12
12
|
|
13
13
|
it "generates packets" do
|
data/test/test_packet.rb
CHANGED
data/test/test_parser.rb
CHANGED
@@ -3,7 +3,7 @@ require File.expand_path('../helper', __FILE__)
|
|
3
3
|
describe "syslog packet parser" do
|
4
4
|
|
5
5
|
it "parse some valid packets" do
|
6
|
-
p =
|
6
|
+
p = SyslogProtocol.parse("<34>Oct 11 22:14:15 mymachine su: 'su root' failed for lonvick on /dev/pts/8")
|
7
7
|
p.facility.should.equal 4
|
8
8
|
p.severity.should.equal 2
|
9
9
|
p.pri.should.equal 34
|
@@ -12,7 +12,7 @@ describe "syslog packet parser" do
|
|
12
12
|
p.content.should.equal "'su root' failed for lonvick on /dev/pts/8"
|
13
13
|
p.time.should.equal Time.parse("Oct 11 22:14:15")
|
14
14
|
|
15
|
-
p =
|
15
|
+
p = SyslogProtocol.parse("<13>Feb 5 17:32:18 10.0.0.99 test: Use the BFG!")
|
16
16
|
p.facility.should.equal 1
|
17
17
|
p.severity.should.equal 5
|
18
18
|
p.pri.should.equal 13
|
@@ -23,7 +23,7 @@ describe "syslog packet parser" do
|
|
23
23
|
end
|
24
24
|
|
25
25
|
it "treat a packet with no valid PRI as all content, setting defaults" do
|
26
|
-
p =
|
26
|
+
p = SyslogProtocol.parse("nomnom")
|
27
27
|
p.facility.should.equal 1
|
28
28
|
p.severity.should.equal 5
|
29
29
|
p.pri.should.equal 13
|
@@ -32,7 +32,7 @@ describe "syslog packet parser" do
|
|
32
32
|
end
|
33
33
|
|
34
34
|
it "PRI with preceding 0's shall be considered invalid" do
|
35
|
-
p =
|
35
|
+
p = SyslogProtocol.parse("<045>Oct 11 22:14:15 space_station my PRI is not valid")
|
36
36
|
p.facility.should.equal 1
|
37
37
|
p.severity.should.equal 5
|
38
38
|
p.pri.should.equal 13
|
@@ -41,7 +41,7 @@ describe "syslog packet parser" do
|
|
41
41
|
end
|
42
42
|
|
43
43
|
it "allow the user to pass an origin to be used as the hostname if packet is invalid" do
|
44
|
-
p =
|
44
|
+
p = SyslogProtocol.parse("<045>Oct 11 22:14:15 space_station my PRI is not valid", '127.0.0.1')
|
45
45
|
p.facility.should.equal 1
|
46
46
|
p.severity.should.equal 5
|
47
47
|
p.pri.should.equal 13
|