diff --git a/.travis.yml b/.travis.yml index c54b89a..32b421f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,13 @@ go: - 1.6 - tip +install: + - rm -rf $GOPATH/src/gopkg.in/mcuadros + - mkdir -p $GOPATH/src/gopkg.in/mcuadros + - ln -s $PWD $GOPATH/src/gopkg.in/mcuadros/go-syslog.v2 + - cd $GOPATH/src/gopkg.in/mcuadros/go-syslog.v2 && go get -v -t ./... + script: - - go test -v ./... + - cd $GOPATH/src/gopkg.in/mcuadros/go-syslog.v2 && go test -v ./... sudo: false diff --git a/README.md b/README.md index 52ec75b..69cfb76 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -go-syslog [![Build Status](https://travis-ci.org/mcuadros/go-syslog.png?branch=master)](https://travis-ci.org/mcuadros/go-syslog) [![GoDoc](http://godoc.org/github.com/mcuadros/go-syslog?status.png)](http://godoc.org/github.com/mcuadros/go-syslog) [![GitHub release](https://img.shields.io/github/release/mcuadros/go-syslog.svg)](https://github.com/mcuadros/go-syslog/releases) +go-syslog [![Build Status](https://travis-ci.org/mcuadros/go-syslog.png?branch=master)](https://travis-ci.org/mcuadros/go-syslog) [![GoDoc](http://godoc.org/github.com/mcuadros/go-syslog?status.png)](hhttps://godoc.org/gopkg.in/mcuadros/go-syslog.v2) [![GitHub release](https://img.shields.io/github/release/mcuadros/go-syslog.svg)](https://github.com/mcuadros/go-syslog/releases) ============================== Syslog server library for go, build easy your custom syslog server over UDP, TCP or Unix sockets using RFC3164, RFC6587 or RFC5424 diff --git a/doc.go b/doc.go index d566ca1..9ab6466 100644 --- a/doc.go +++ b/doc.go @@ -1,5 +1,5 @@ /* Syslog server library for go, build easy your custom syslog server -over UDP, TCP or Unix sockets using RFC3164 or RFC5424 +over UDP, TCP or Unix sockets using RFC3164, RFC5424 and RFC6587 */ -package syslog +package syslog // import "gopkg.in/mcuadros/go-syslog.v2" diff --git a/format/automatic.go b/format/automatic.go index 8fdb3e2..5a395a2 100644 --- a/format/automatic.go +++ b/format/automatic.go @@ -6,9 +6,9 @@ import ( "errors" "strconv" - "github.com/Xiol/syslogparser" - "github.com/Xiol/syslogparser/rfc3164" - "github.com/Xiol/syslogparser/rfc5424" + "gopkg.in/mcuadros/go-syslog.v2/internal/syslogparser" + "gopkg.in/mcuadros/go-syslog.v2/internal/syslogparser/rfc3164" + "gopkg.in/mcuadros/go-syslog.v2/internal/syslogparser/rfc5424" ) /* Selecting an 'Automatic' format detects incoming format (i.e. RFC3164 vs RFC5424) and Framing diff --git a/format/format.go b/format/format.go index afea9b6..5f40547 100644 --- a/format/format.go +++ b/format/format.go @@ -3,7 +3,7 @@ package format import ( "bufio" - "github.com/Xiol/syslogparser" + "gopkg.in/mcuadros/go-syslog.v2/internal/syslogparser" ) type Format interface { diff --git a/format/rfc3164.go b/format/rfc3164.go index 70c03b3..c8ac4b9 100644 --- a/format/rfc3164.go +++ b/format/rfc3164.go @@ -3,8 +3,8 @@ package format import ( "bufio" - "github.com/Xiol/syslogparser" - "github.com/Xiol/syslogparser/rfc3164" + "gopkg.in/mcuadros/go-syslog.v2/internal/syslogparser" + "gopkg.in/mcuadros/go-syslog.v2/internal/syslogparser/rfc3164" ) type RFC3164 struct{} diff --git a/format/rfc5424.go b/format/rfc5424.go index e853089..0c1a268 100644 --- a/format/rfc5424.go +++ b/format/rfc5424.go @@ -3,8 +3,8 @@ package format import ( "bufio" - "github.com/Xiol/syslogparser" - "github.com/Xiol/syslogparser/rfc5424" + "gopkg.in/mcuadros/go-syslog.v2/internal/syslogparser" + "gopkg.in/mcuadros/go-syslog.v2/internal/syslogparser/rfc5424" ) type RFC5424 struct{} diff --git a/format/rfc6587.go b/format/rfc6587.go index c8f5809..846dc56 100644 --- a/format/rfc6587.go +++ b/format/rfc6587.go @@ -5,8 +5,8 @@ import ( "bytes" "strconv" - "github.com/Xiol/syslogparser" - "github.com/Xiol/syslogparser/rfc5424" + "gopkg.in/mcuadros/go-syslog.v2/internal/syslogparser" + "gopkg.in/mcuadros/go-syslog.v2/internal/syslogparser/rfc5424" ) type RFC6587 struct{} diff --git a/handler.go b/handler.go index 14b263d..f0ed73a 100644 --- a/handler.go +++ b/handler.go @@ -1,7 +1,7 @@ package syslog import ( - "github.com/Xiol/syslogparser" + "gopkg.in/mcuadros/go-syslog.v2/internal/syslogparser" ) //The handler receive every syslog entry at Handle method diff --git a/handler_test.go b/handler_test.go index dcd1cf2..f0b3179 100644 --- a/handler_test.go +++ b/handler_test.go @@ -1,8 +1,8 @@ package syslog import ( - "github.com/Xiol/syslogparser" . "gopkg.in/check.v1" + "gopkg.in/mcuadros/go-syslog.v2/internal/syslogparser" ) type HandlerSuite struct{} diff --git a/internal/syslogparser/.gitignore b/internal/syslogparser/.gitignore deleted file mode 100644 index 9ed3b07..0000000 --- a/internal/syslogparser/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.test diff --git a/internal/syslogparser/Makefile b/internal/syslogparser/Makefile deleted file mode 100644 index 3a6e8e4..0000000 --- a/internal/syslogparser/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -SUBPACKAGES=. rfc3164 rfc5424 -help: - @echo "Available targets:" - @echo "- tests: run tests" - @echo "- installdependencies: installs dependencies declared in dependencies.txt" - @echo "- clean: cleans directory" - @echo "- benchmarks: run benchmarks" - -installdependencies: - @cat dependencies.txt | xargs go get - -tests: installdependencies - @for pkg in $(SUBPACKAGES); do cd $$pkg && go test -i && go test ; cd -;done - -clean: - find . -type 'f' -name '*.test' -print | xargs rm -f - -benchmarks: - @for pkg in $(SUBPACKAGES); do cd $$pkg && go test -gocheck.b ; cd -;done diff --git a/internal/syslogparser/README b/internal/syslogparser/README deleted file mode 100644 index b1ec267..0000000 --- a/internal/syslogparser/README +++ /dev/null @@ -1,93 +0,0 @@ -Syslogparser -============ - -This is a syslog parser for the Go programming language. - - -Installing ----------- - -go get github.com/jeromer/syslogparser - - -Supported RFCs --------------- - -RFC 3164 : https://tools.ietf.org/html/rfc3164 -RFC 5424 : https://tools.ietf.org/html/rfc5424 - -Not all features described in RFCs above are supported but only the most part of -it. For exaple SDIDs are not supported in RFC5424 and STRUCTURED-DATA are -parsed as a whole string. - -This parser should solve 80% of use cases. If your use cases are in the 20% -remaining ones I would recommend you to fully test what you want to achieve and -provide a patch if you want. - -Parsing an RFC 3164 syslog message ----------------------------------- - - b := "<34>Oct 11 22:14:15 mymachine su: 'su root' failed for lonvick on /dev/pts/8" - buff := []byte(b) - - p := rfc3164.NewParser(buff) - err := p.Parse() - if err != nil { - panic(err) - } - - for k, v := range p.Dump() { - fmt.Println(k, ":", v) - } - -You should see - - timestamp : 2013-10-11 22:14:15 +0000 UTC - hostname : mymachine - tag : su - content : 'su root' failed for lonvick on /dev/pts/8 - priority : 34 - facility : 4 - severity : 2 - -Parsing an RFC 5424 syslog message ----------------------------------- - - b := `<165>1 2003-10-11T22:14:15.003Z mymachine.example.com evntslog - ID47 [exampleSDID@32473 iut="3" eventSource="Application" eventID="1011"] An application event log entry...` - buff := []byte(b) - - p := rfc5424.NewParser(buff) - err := p.Parse() - if err != nil { - panic(err) - } - - for k, v := range p.Dump() { - fmt.Println(k, ":", v) - } - -You should see - - version : 1 - timestamp : 2003-10-11 22:14:15.003 +0000 UTC - app_name : evntslog - msg_id : ID47 - message : An application event log entry... - priority : 165 - facility : 20 - severity : 5 - hostname : mymachine.example.com - proc_id : - - structured_data : [exampleSDID@32473 iut="3" eventSource="Application" eventID="1011"] - - -Running tests -------------- - -make tests - - -Running benchmarks ------------------- - -make benchmarks diff --git a/internal/syslogparser/README.md b/internal/syslogparser/README.md new file mode 100644 index 0000000..ce59d37 --- /dev/null +++ b/internal/syslogparser/README.md @@ -0,0 +1,4 @@ +Syslogparser +============ + +This is a fork for [github.com/jeromer/syslogparser](https://github.com/jeromer/syslogparser), since this library is intensively used by `go-syslog`, now is integrated as a `internal` package. diff --git a/internal/syslogparser/dependencies.txt b/internal/syslogparser/dependencies.txt deleted file mode 100644 index 5e35e09..0000000 --- a/internal/syslogparser/dependencies.txt +++ /dev/null @@ -1 +0,0 @@ -launchpad.net/gocheck diff --git a/internal/syslogparser/rfc3164/example_test.go b/internal/syslogparser/rfc3164/example_test.go index c249d2e..04ba2fe 100644 --- a/internal/syslogparser/rfc3164/example_test.go +++ b/internal/syslogparser/rfc3164/example_test.go @@ -2,7 +2,8 @@ package rfc3164_test import ( "fmt" - "github.com/Xiol/syslogparser/rfc3164" + + "gopkg.in/mcuadros/go-syslog.v2/internal/syslogparser/rfc3164" ) func ExampleNewParser() { diff --git a/internal/syslogparser/rfc3164/rfc3164.go b/internal/syslogparser/rfc3164/rfc3164.go index 94f22de..db652dd 100644 --- a/internal/syslogparser/rfc3164/rfc3164.go +++ b/internal/syslogparser/rfc3164/rfc3164.go @@ -4,7 +4,7 @@ import ( "bytes" "time" - "github.com/Xiol/syslogparser" + "gopkg.in/mcuadros/go-syslog.v2/internal/syslogparser" ) type Parser struct { diff --git a/internal/syslogparser/rfc3164/rfc3164_test.go b/internal/syslogparser/rfc3164/rfc3164_test.go index 0a99bf9..98ff389 100644 --- a/internal/syslogparser/rfc3164/rfc3164_test.go +++ b/internal/syslogparser/rfc3164/rfc3164_test.go @@ -5,8 +5,8 @@ import ( "testing" "time" - "github.com/Xiol/syslogparser" . "gopkg.in/check.v1" + "gopkg.in/mcuadros/go-syslog.v2/internal/syslogparser" ) // Hooks up gocheck into the gotest runner. diff --git a/internal/syslogparser/rfc5424/example_test.go b/internal/syslogparser/rfc5424/example_test.go index 896d38d..0023bd7 100644 --- a/internal/syslogparser/rfc5424/example_test.go +++ b/internal/syslogparser/rfc5424/example_test.go @@ -2,7 +2,8 @@ package rfc5424_test import ( "fmt" - "github.com/Xiol/syslogparser/rfc5424" + + "gopkg.in/mcuadros/go-syslog.v2/internal/syslogparser/rfc5424" ) func ExampleNewParser() { diff --git a/internal/syslogparser/rfc5424/rfc5424.go b/internal/syslogparser/rfc5424/rfc5424.go index a5f8cbf..743811d 100644 --- a/internal/syslogparser/rfc5424/rfc5424.go +++ b/internal/syslogparser/rfc5424/rfc5424.go @@ -5,10 +5,11 @@ package rfc5424 import ( "fmt" - "github.com/Xiol/syslogparser" "math" "strconv" "time" + + "gopkg.in/mcuadros/go-syslog.v2/internal/syslogparser" ) const ( diff --git a/internal/syslogparser/rfc5424/rfc5424_test.go b/internal/syslogparser/rfc5424/rfc5424_test.go index 09b006e..afc1e17 100644 --- a/internal/syslogparser/rfc5424/rfc5424_test.go +++ b/internal/syslogparser/rfc5424/rfc5424_test.go @@ -2,10 +2,11 @@ package rfc5424 import ( "fmt" - "github.com/Xiol/syslogparser" - . "gopkg.in/check.v1" "testing" "time" + + . "gopkg.in/check.v1" + "gopkg.in/mcuadros/go-syslog.v2/internal/syslogparser" ) // Hooks up gocheck into the gotest runner. diff --git a/internal/syslogparser/syslogparser_test.go b/internal/syslogparser/syslogparser_test.go index d76d76f..552edbc 100644 --- a/internal/syslogparser/syslogparser_test.go +++ b/internal/syslogparser/syslogparser_test.go @@ -1,8 +1,9 @@ package syslogparser import ( - . "gopkg.in/check.v1" "testing" + + . "gopkg.in/check.v1" ) // Hooks up gocheck into the gotest runner. diff --git a/server.go b/server.go index bf34254..d9df98f 100644 --- a/server.go +++ b/server.go @@ -9,7 +9,7 @@ import ( "sync" "time" - "github.com/Xiol/go-syslog/format" + "gopkg.in/mcuadros/go-syslog.v2/format" ) var ( diff --git a/server_test.go b/server_test.go index 2a8969f..a8346d4 100644 --- a/server_test.go +++ b/server_test.go @@ -7,8 +7,8 @@ import ( "testing" "time" - "github.com/Xiol/syslogparser" . "gopkg.in/check.v1" + "gopkg.in/mcuadros/go-syslog.v2/internal/syslogparser" ) func Test(t *testing.T) { TestingT(t) }