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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bc4ccbeae3cd27b9c5fc849591ee09539eddb5343d0167a1f8fcaa9c0cd00590
4
- data.tar.gz: 6b4f69ae47118e633c65a0aee4a512b941d960668ba092fb1a9203ba093d67ae
3
+ metadata.gz: 01e0a7382d7b33c31e9653277aa2091cbcf089a0742a0ede8c5b0598f17446d4
4
+ data.tar.gz: ab8823804f59d72237b7d2289671c43b8d72cd57f35a5a53c484c57c0a956316
5
5
  SHA512:
6
- metadata.gz: 0bccdc5bd76ef0149c4769368370411dbf640b4b178faedaec0b93f0b8ca986710ff1cfae7a24ba25d5119f30d0ee6a3365c772d555c12dd09c79892c7ff3609
7
- data.tar.gz: 12e4965df86733106d02d0e7ae4c656c2cb5d920c2c0d5ce8beaec555a8c0b305f39e0a0e1e9c22190bdc5936a78f4563241637a7a18fad982b2425015f06824
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
@@ -3,6 +3,6 @@ require 'syslog_protocol_ms/packet'
3
3
  require 'syslog_protocol_ms/logger'
4
4
  require 'syslog_protocol_ms/parser'
5
5
 
6
- module SyslogProtocolMs
7
- VERSION = '0.10.0'
6
+ module SyslogProtocol
7
+ VERSION = '0.10.1'
8
8
  end
@@ -1,4 +1,4 @@
1
- module SyslogProtocolMs
1
+ module SyslogProtocol
2
2
  # These hashes stolen from Syslog.pm
3
3
 
4
4
  FACILITIES = {
@@ -1,4 +1,4 @@
1
- module SyslogProtocolMs
1
+ module SyslogProtocol
2
2
  class Logger
3
3
  def initialize(hostname, tag, facility)
4
4
  @packet = Packet.new
@@ -1,4 +1,4 @@
1
- module SyslogProtocolMs
1
+ module SyslogProtocol
2
2
  class Packet
3
3
  attr_reader :facility, :severity, :hostname, :tag
4
4
  attr_accessor :time, :content
@@ -1,6 +1,6 @@
1
1
  require 'time'
2
2
 
3
- module SyslogProtocolMs
3
+ module SyslogProtocol
4
4
 
5
5
  def self.parse(msg, origin=nil)
6
6
  packet = Packet.new
@@ -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.0'
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 = SyslogProtocolMs::Logger.new("space_station", 'test', "local0")}.should.not.raise
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 {SyslogProtocolMs::Logger.new("space station", "some shit", 'test test')}.should.raise ArgumentError
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
@@ -2,7 +2,7 @@ require File.expand_path('../helper', __FILE__)
2
2
 
3
3
  describe "a syslog packet" do
4
4
 
5
- @p = SyslogProtocolMs::Packet.new
5
+ @p = SyslogProtocol::Packet.new
6
6
 
7
7
  it "should embarrass a person who does not set the fields" do
8
8
  lambda { @p.to_s }.should.raise RuntimeError
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 = SyslogProtocolMs.parse("<34>Oct 11 22:14:15 mymachine su: 'su root' failed for lonvick on /dev/pts/8")
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 = SyslogProtocolMs.parse("<13>Feb 5 17:32:18 10.0.0.99 test: Use the BFG!")
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 = SyslogProtocolMs.parse("nomnom")
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 = SyslogProtocolMs.parse("<045>Oct 11 22:14:15 space_station my PRI is not valid")
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 = SyslogProtocolMs.parse("<045>Oct 11 22:14:15 space_station my PRI is not valid", '127.0.0.1')
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: syslog_protocol_ms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jake Douglas