Giter VIP home page Giter VIP logo

go-syslog's Introduction

go-syslog Build Status GoDoc GitHub release

Syslog server library for go, build easy your custom syslog server over UDP, TCP or Unix sockets using RFC3164, RFC6587 or RFC5424

Installation

The recommended way to install go-syslog

go get gopkg.in/mcuadros/go-syslog.v2

Examples

How import the package

import "gopkg.in/mcuadros/go-syslog.v2"

Example of a basic syslog UDP server:

channel := make(syslog.LogPartsChannel)
handler := syslog.NewChannelHandler(channel)

server := syslog.NewServer()
server.SetFormat(syslog.RFC5424)
server.SetHandler(handler)
server.ListenUDP("0.0.0.0:514")
server.Boot()

go func(channel syslog.LogPartsChannel) {
    for logParts := range channel {
        fmt.Println(logParts)
    }
}(channel)

server.Wait()

License

MIT, see LICENSE

go-syslog's People

Contributors

abligh avatar arnecls avatar boyska avatar catinello avatar cezarsa avatar emmanuel avatar glicht avatar ianic avatar jeromer avatar libc avatar mcuadros avatar niltonkummer avatar scorptec68 avatar shyx0rmz avatar sqs avatar vixns avatar xiol avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-syslog's Issues

Process ID is not read (when available) in RFC 3164 parser

Example message:

  <148>Sep  5 12:53:32 vapp-172-24-41-63 asterisk[8865]: chan_sip.c:4077 in retrans_pkt: Retransmission timeout reached on transmission 14                                                              

When the message is received by go-syslog, the PID in the square brackets is not parsed - parseTag skips over the contents of the process id.

why remove func SetTcpBufferSize in the new vwesion

hello, I update my package to 2.3.0 and find the func SetTcpBufferSize and params tcpBufferSize are removed from the code,but I could not found the commit message or resaon in the history of file server.go. Would you tell me the change of this?Thanks!

No messages inside syslog server

Hi. Running your example server.

When I try to log something from other go code or python script, I get empty log message like

map[hostname: tag: content: facility:0 severity:0 client:127.0.0.1:60172 tls_peer: timestamp:0001-01-01 00:00:00 +0000 UTC priority:0]

Python script is very simple

import logging
import logging.handlers

my_logger = logging.getLogger('MyLogger')
my_logger.setLevel(logging.DEBUG)

handler = logging.handlers.SysLogHandler(address = ('localhost',514), facility=19)

my_logger.addHandler(handler)

my_logger.debug('this is debug')

Simple as Go one

package main

import (
    "log/syslog"
)

func main() {
    connectionAddress := "localhost:514"

    syslogWriter, _ := syslog.Dial("udp", connectionAddress, syslog.LOG_ERR, "INFO logger")

    syslogWriter.Warning("wrn")

}

Did I forget something?

Thanks in advance.

Add a NoFormat option (just forwarding log line)

I created this myself, but it could be added to the library. For logs that do not conform to standards.

// --- Dummy format that just puts the whole log line in logParts["content"] ---

// Actually, the syslog.RFC3164 format also puts the unparsed "content" field,
// but wastes times trying to parse lines that have a custom format.

var noFormat = &NoFormat{}

type NoFormat struct{}

func (f NoFormat) GetParser(line []byte) format.LogParser {
	return &noFormatParser{string(line)}
}

func (f NoFormat) GetSplitFunc() bufio.SplitFunc {
	return nil // not used
}

type noFormatParser struct {
	line string
}

func (c noFormatParser) Dump() format.LogParts {
	return format.LogParts{
		"content": string(c.line),
	}
}

func (c noFormatParser) Parse() error {
	return nil // doesn't parse anything
}

func (c noFormatParser) Location(location *time.Location) {
	// not used
}

syslog forwardign to another syslog server

Hello,
I am using this library without any problem. Thank you.
I have to forward also syslog messages to another syslog server and using another syslog library. Maybe future releases can do this with transparently.
B.R.

RFC 3164 parser failed to parse UTC time

Hi, I think that both of following time strings are valid RFC3339 time format. However, RFC3164 parser is not able to parse the second type of timestamp (i.e. 2019-11-06T08:12:25Z) due to the expected parsing length of RFC3339 is limited to 25. Thank you.

2019-11-06T08:12:25+08:00 // length: 25
2019-11-06T08:12:25Z // UTC time, length: 20

It's not possible to implement custom Format since syslogparser was integrated

Although there is a Format interface, the signature of GetParser is using an internal package:

type Format interface {
    GetParser([]byte) syslogparser.LogParser
    GetSplitFunc() bufio.SplitFunc
}

This way it's not possible to write a custom Format because it's impossible to import the internal package syslogparser.LogParser.

My suggestion is that GetParser should return Parser interface with methods Parse() and Dump().

I can work on a PR later if this change is something you're okay with.

Graceful shutdown

Looking through the code, it doesn't seem there's a facility for graceful shutdown. Is this accurate? Not sure if it's a requirement for me or not, but assuming it is, will fork and send a PR.

Generic SetFormat

Is it possible to set generic format? as opposed to being specific.

    server.SetFormat(syslog.RFC3164)
    //server.SetFormat(syslog.RFC5424)
    //server.SetFormat(syslog.RFC6587)

Code:

import (
    //"fmt"
    "github.com/davecgh/go-spew/spew"
    syslog "github.com/mcuadros/go-syslog"
)

func startSyslogReceiver(r *Receiver, ctx *mgmtContext) {
    channel := make(syslog.LogPartsChannel)
    handler := syslog.NewChannelHandler(channel)

    server := syslog.NewServer()
    server.SetFormat(syslog.RFC5424)
    server.SetHandler(handler)
    server.ListenUDP("0.0.0.0:10514")
    server.Boot()

    go func(channel syslog.LogPartsChannel, ctx *mgmtContext) {
        for logParts := range channel {
            spew.Dump(logParts)
            m := Message{}
            // send the message to shared message bus
            ctx.MessageBus[1] <- m
        }
    }(channel, ctx)

    server.Wait()
}

Sending a message:

logger --server 127.0.0.1 --udp --port 10514 -p 6 -- test UDP syslog from console `date`

Received:

(format.LogParts) (len=13) {
 (string) (len=7) "message": (string) "",
 (string) (len=6) "client": (string) (len=15) "127.0.0.1:40626",
 (string) (len=7) "version": (int) 0,
 (string) (len=8) "app_name": (string) "",
 (string) (len=7) "proc_id": (string) "",
 (string) (len=6) "msg_id": (string) "",
 (string) (len=8) "hostname": (string) "",
 (string) (len=15) "structured_data": (string) "",
 (string) (len=8) "tls_peer": (string) "",
 (string) (len=8) "priority": (int) 0,
 (string) (len=8) "facility": (int) 0,
 (string) (len=8) "severity": (int) 0,
 (string) (len=9) "timestamp": (time.Time) 0001-01-01 00:00:00 +0000 UTC
}

RFC3164 parsing fails after the first message

See the enclosed test program (copied almost verbatim from your examples directory). When running the test program and the enclosed perl to generate syslog compliant with RFC3164, the output for the first run of the perl is correct, i.e.:

map[severity:6 timestamp:2015-06-30 20:17:25 +0000 UTC hostname:logger: tag:This content:is a test from me priority:6 facility:0]

but the output for the second and subsequent runs of the perl is:

map[hostname: tag: content: priority:0 facility:0 severity:0 timestamp:0001-01-01 00:00:00 +0000 UTC]

i.e. parsing is failing. Restarting the golang code fixes it.

Introducing an (unnecessary) \n into the perl log does not fix it.

Test code as follows.

package main

/* Perl test program logger.pl

#!/usr/bin/perl

use strict;
use warnings;
use Sys::Syslog qw(:standard :macros setlogsock);

setlogsock({type=>"udp", port=>10514});
openlog("logger", "ndelay", LOG_LOCAL0);    # don't forget this
syslog(LOG_INFO, "This is a test from %s", "me");
closelog();

*/

import (
    "fmt"
    "gopkg.in/mcuadros/go-syslog.v2"
)

func main() {
    // something here
    channel := make(syslog.LogPartsChannel)
    handler := syslog.NewChannelHandler(channel)

    server := syslog.NewServer()
    server.SetFormat(syslog.RFC3164)
    server.SetHandler(handler)
    server.ListenUDP("0.0.0.0:10514")
    server.Boot()

    go func(channel syslog.LogPartsChannel) {
        for logParts := range channel {
            fmt.Println(logParts)
        }
    }(channel)

    server.Wait()
}

Set SO_REUSEADDR socket option?

Thanks for your work on this! I'm in the process of learning Go and am using this library for log ingestion. During development I keep having to reboot. If the application exits before the UDP socket is closed, the socket is left in TIME_WAIT and the application can't bind to it when I restart it.

Would it be possible to set the SO_REUSEADDR socket option?

RFC: Automatically detect syslog format

I believe it would be possible to automatically detect which of the framing formats an incoming syslog message uses, would would enable us to implement a sort of 'superformat' called (say) automatic.

This is because:

  • RFC3164 syslog frames all begin with a pattern matching '^<[0-9]{1,3}>[a-zA-Z]' (i.e. have no space after the close angle bracket - single quotes for presentation only)
  • RFC5424 syslog frames all begin with a pattern matching '^<[0-9]{1,3}> ' (i.e have a space after the close angle bracket - single quotes for presentation only)
  • RFC6587 (see note below) syslog frames all begin with a pattern matching '^[0-9]+ ' (i.e. have an octet count - single quotes for presentation only)

Does this seem a useful idea in practice? I think 'automatic' should be an option (as it's possible the message should be rejected or parsed with excess tolerance rather than misparsed - I can imagine an RFC3164 implementation incorrectly putting a space before the date for instance). This is a request for comments. I'm happy to look at implementing it if useful.


NB: RFC6587 is probably the wrong description as RFC6587 describes both the octet counting variant (at 3.4.1) that go-syslog implements in rfc6587.go and the non-transparent-framing (at 3.4.2) that go-syslog mostly implements in rfc3164.go as applied to non-UDP syslog. I say 'mostly implements' as per 3.4.2 of the RFC some implementations frame with terminating \0 rather than \n.

func scan() does not close connection when scan finishes

will run out of file descriptor eventually.
I made this patch:

func (server *Server) Boot() error {

    if server.Out == nil {
        return errors.New("need a valid out channel.")
    }

    for _, listener := range server.listeners {
        server.goAcceptConnection(listener)
    }

    for _, connection := range server.connections {
        server.goScanConnection(connection, false)
    }

    return nil
}

func (server *Server) goAcceptConnection(listener *net.TCPListener) {
    server.wait.Add(1)
    go func(listener *net.TCPListener) {
        for {
            connection, err := listener.Accept()
            if err != nil {
                continue
            }

            server.goScanConnection(connection, true)
        }

        server.wait.Done()
    }(listener)
}

type Closer interface {
    Close() error
}

type ScanCloser struct {
    *bufio.Scanner
    closer Closer
}

func (server *Server) goScanConnection(connection net.Conn, needClose bool) {
    scanner := bufio.NewScanner(connection)

    var scanCloser *ScanCloser
    if needClose {
        scanCloser = &ScanCloser{scanner, connection}
    } else {
        scanCloser = &ScanCloser{scanner, nil}
    }

    server.wait.Add(1)
    go server.scan(scanCloser)
}

func (server *Server) scan(scanCloser *ScanCloser) {
    for scanCloser.Scan() {
        server.Out <- scanCloser.Text()
    }

    if scanCloser.closer != nil {
        scanCloser.closer.Close()
    }
    server.wait.Done()
}

error detection and concurrency

server.go parse looks something like this...

func (s *Server) parser(line []byte, client string, tlsPeer string) {
    parser := s.format.GetParser(line)
    err := parser.Parse()
    if err != nil {
        s.lastError = err
    }

    logParts := parser.Dump()
    logParts["client"] = client
    logParts["tls_peer"] = tlsPeer

    s.handler.Handle(logParts, int64(len(line)), err)
}

as a consumer of logparts there is no obvious way to tell if there was an error or if the last error is in fact the error caused by the logpart I am processing.

scenario:

  1. message "A" arrives and generates an error say "GENERIC_ERROR_A"
  2. server.go parse
    2.1. copies "GENERIC_ERROR_A" to last error
    2.2. Dumps the logParts (zeroed structs?) and passes it to s.handler
  3. s.handler is (my) channel handler, writing to (my) channel which my code is consuming on a separate go routine.
  4. message "B" arrives and generates an error say "GENERIC_ERROR_B"
  5. server.go parse
    5.1. copies "GENERIC_ERROR_B" to last error
    5.2. Dumps the logParts (zeroed structs?) and passes it to s.handler

now say steps 4, 5 and 5.1 execute before I process the logparts for message a...

There is no clear way to distinguish if parsing a given message generated a specific error.

I have no way to get the error associated with message A as it has been overwritten.

I would propose that an parse_error or error field be added to the Logparts inorder to communicate specific error occurrences back to the the called.

Alternately a second handler method to handles errors could be added. In this case messages which generated an error should result in the error handler being called and NOT the LogParts handler.

It would also be nice for troubleshooting purposes to have a reference to the original message that generated the error.

Converting format.LogParts to type string

I'm very new to Go (can't you tell 😜 and I've been trying out your library - I have an issue where I need the syslog message converted to a string - but I have no idea how to do it.

I've tried a few things, but cannot work it out - do you have any hints?

I get errors such as:

cannot convert logParts (type format.LogParts) to type string`

   go func(channel syslog.LogPartsChannel) {
        for logParts := range channel {
            x := string(logParts)
        }
    }(channel)

This is needed because a method upstream requires a String type.

Autodetect syslog Version/RFC

I would like to recieve from multiple systems with different syslog-daemon.
It would be cool, to detect on the fly for every recieved log entry.

Example closes immediately

When running the example under examples/basic_udp.go the program immediately closes.

Any ideas? Should I be doing something extra to add something to the waitgroup?

System: Mac 10.13.1
Go version: 1.9.1

Unable to handle logs larger than 64k

bufio scanner maxTokenSize 4k~64k message size>64k ,It will cause you to be unable to handle it.

I tried to modify it.

	var scanCloser *ScanCloser
	scanCloser = &ScanCloser{scanner, connection}
	_**buf := make([]byte, bufio.MaxScanTokenSize*10)
	scanCloser.Buffer(buf, bufio.MaxScanTokenSize*10)**_

Test failure with Golang 1.13

Go 1.13 on Fedora Rawhide:

Testing    in: /builddir/build/BUILD/go-syslog-a127d826d6c27489d377b3c080bd256d8f8093a6/_build/src
         PATH: /builddir/build/BUILD/go-syslog-a127d826d6c27489d377b3c080bd256d8f8093a6/_build/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin
       GOPATH: /builddir/build/BUILD/go-syslog-a127d826d6c27489d377b3c080bd256d8f8093a6/_build:/usr/share/gocode
  GO111MODULE: off
      command: go test -buildmode pie -compiler gc -ldflags "-X gopkg.in/mcuadros/go-syslog.v2/version=2.2.1 -X gopkg.in/mcuadros/go-syslog.v2/version.commit=a127d826d6c27489d377b3c080bd256d8f8093a6 -extldflags '-Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld '"
      testing: gopkg.in/mcuadros/go-syslog.v2
gopkg.in/mcuadros/go-syslog.v2
----------------------------------------------------------------------
FAIL: servertls_test.go:57: ServerSuite.TestTLS
servertls_test.go:80:
    c.Check(handler.LastLogParts["hostname"], Equals, "hostname")
... obtained = nil
... expected string = "hostname"
... runtime error: invalid memory address or nil pointer dereference
servertls_test.go:81:
    c.Check(handler.LastLogParts["tag"], Equals, "tag")
... obtained = nil
... expected string = "tag"
... runtime error: invalid memory address or nil pointer dereference
servertls_test.go:82:
    c.Check(handler.LastLogParts["content"], Equals, "content")
... obtained = nil
... expected string = "content"
... runtime error: invalid memory address or nil pointer dereference
servertls_test.go:83:
    c.Check(handler.LastLogParts["tls_peer"], Equals, "dummycert1")
... obtained = nil
... expected string = "dummycert1"
... runtime error: invalid memory address or nil pointer dereference
servertls_test.go:84:
    c.Check(handler.LastMessageLength, Equals, int64(len(exampleSyslog)))
... obtained int64 = 0
... expected int64 = 46
OOPS: 14 passed, 1 FAILED
--- FAIL: Test (2.40s)
FAIL
exit status 1
FAIL	gopkg.in/mcuadros/go-syslog.v2	2.406s

Tests fail in servertls_test.go

Problem with certs:

panic: x509: certificate relies on legacy Common Name field, use SANs instead

goroutine 36 [running]:
gopkg.in/mcuadros/go-syslog%2ev2.(*ServerSuite).TestTLS.func1(0x0)
        /-S/vendor/gopkg.in/mcuadros/go-syslog.v2/servertls_test.go:69 +0x148
created by gopkg.in/mcuadros/go-syslog%2ev2.(*ServerSuite).TestTLS
        /-S/vendor/gopkg.in/mcuadros/go-syslog.v2/servertls_test.go:65 +0x13c

Problem with server being killed too soon:

/-S/vendor/gopkg.in/mcuadros/go-syslog.v2/servertls_test.go:80:
... obtained = nil
... expected string = "hostname"
/-S/vendor/gopkg.in/mcuadros/go-syslog.v2/servertls_test.go:81:
... obtained = nil
... expected string = "tag"
/-S/vendor/gopkg.in/mcuadros/go-syslog.v2/servertls_test.go:82:
... obtained = nil
... expected string = "content"
/-S/vendor/gopkg.in/mcuadros/go-syslog.v2/servertls_test.go:83:
... obtained = nil
... expected string = "dummycert1"
/-S/vendor/gopkg.in/mcuadros/go-syslog.v2/servertls_test.go:84:
... obtained int64 = 0
... expected int64 = 46

I added 2 commits here, to fix it: https://github.com/fmaylinch/go-syslog

RFC 3164 parser assumes timestamp in UTC

Hi,

What are your thoughts on changing the syslog parser to either accept a timezone parameter or defaulting timezone to Local? Right now the RFC 3164 parser's timezone is hardcoded to UTC, and that will break for syslog clients that are not in the UTC zone. RFC 3164 suggests using the local timezone of the syslog client.

If the originally formed message has a TIMESTAMP in the HEADER
part, then it SHOULD be the local time of the device within its
timezone.

Thanks!

Can't get it running

I tried the example:
go-syslog/example/basic_udp.go

machine$ go run basic_udp.go
machine$

and it immediately stops without any error, tried on mac and linux machine

what could be the problem?

Parsing timestamp

Hi

For syslog message:

<28>1 2019-03-08T20:52:54.230969489Z a.b.org an-app 119 MsgID1  - msgSyslogPefClient

Result

map[client:172.17.0.3:35224 hostname: app_name: msg_id: structured_data: timestamp:0001-01-01 00:00:00 +0000 UTC proc_id: message: tls_peer: priority:0 facility:0 severity:0 version:0]

It is having problems parsing the timestamp.
Is there a way to config the time formatting?

I dont know why but when running in Mac it works but doing it on linux not.
In mac I get this message. It looks that in mac there 2 digits less of precision in the timestamp.

<28>1 2019-03-08T21:04:18.262132Z a.b.org an-app 119 msg1 - a message

Thanks in advanced

Failing to parse syslog sent from Go stdlib

I took the example from stdlib to send a message to go-syslog.

Line is incorrectly parsed:

hostname:
priority:28
facility:3
severity:4
client:127.0.0.1:65519
timestamp:2018-01-12 16:10:14 +0100 CET
content:2018-01-12T16:10:14+01:00 Callisto.local demotag[40516]: This is a daemon warning with demotag.

should be:

timestamp:2018-01-12 16:11:36 +0100 +0100
hostname:Callisto.local
content:This is a daemon warning with demotag.
priority:28
facility:3
tag:demotag
severity:4
client:127.0.0.1:61861

The problem is that stdlib is sending timestamp in time.RFC339 and go-syslog is expecting time in time.Stamp format.

It seams that go-syslog is following rfc, but it is strange that Go lib is not parsing syslog generated by standard library.

From rfc:

The TIMESTAMP field is the local time and is in the format of "Mmm dd hh:mm:ss" (without the quote marks)

ListenUnixgram runtime error

I'm trying to receive logs from nginx using unix sockets, but when nginx sends the first message, nothing happens, on the second message, the program crashes.

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x28 pc=0x473ce6]

goroutine 6 [running]:
gopkg.in/mcuadros/go-syslog%2ev2.(*Server).goReceiveDatagrams.func1(0xc82008c090, 0x7feea6e0a448, 0xc82002e030)
    /home/jonnathan/go/src/gopkg.in/mcuadros/go-syslog.v2/server.go:275 +0x116
created by gopkg.in/mcuadros/go-syslog%2ev2.(*Server).goReceiveDatagrams
    /home/jonnathan/go/src/gopkg.in/mcuadros/go-syslog.v2/server.go:288 +0x11e

goroutine 1 [semacquire]:
sync.runtime_Semacquire(0xc82008c0cc)
    /usr/lib/go/src/runtime/sema.go:43 +0x26
sync.(*WaitGroup).Wait(0xc82008c0c0)
    /usr/lib/go/src/sync/waitgroup.go:126 +0xb4
gopkg.in/mcuadros/go-syslog%2ev2.(*Server).Wait(0xc82008c090)
    /home/jonnathan/go/src/gopkg.in/mcuadros/go-syslog.v2/server.go:241 +0x2d
main.main()
    /home/jonnathan/go/src/github.com/jonnsl/ssd/ssd.go:35 +0x311

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
    /usr/lib/go/src/runtime/asm_amd64.s:1721 +0x1

goroutine 5 [chan receive]:
gopkg.in/mcuadros/go-syslog%2ev2.(*Server).goParseDatagrams.func1(0xc82008c090)
    /home/jonnathan/go/src/gopkg.in/mcuadros/go-syslog.v2/server.go:299 +0xc5
created by gopkg.in/mcuadros/go-syslog%2ev2.(*Server).goParseDatagrams
    /home/jonnathan/go/src/gopkg.in/mcuadros/go-syslog.v2/server.go:312 +0x92

goroutine 7 [chan receive]:
main.main.func1(0xc820014180)
    /home/jonnathan/go/src/github.com/jonnsl/ssd/ssd.go:30 +0x5d
created by main.main
    /home/jonnathan/go/src/github.com/jonnsl/ssd/ssd.go:33 +0x303

Here is my code:

    package main

    import (
        "fmt"
        "gopkg.in/mcuadros/go-syslog.v2"
        "log"
        "os"
    )

    const socket_path = "/var/run/ssd/ssd.sock"

    func main() {
        channel := make(syslog.LogPartsChannel)
        handler := syslog.NewChannelHandler(channel)

        removeSocket()
        defer removeSocket()

        server := syslog.NewServer()
        server.SetFormat(syslog.Automatic)
        server.SetHandler(handler)
        server.ListenUnixgram(socket_path)
        server.Boot()

        if err := os.Chmod(socket_path, 0222); err != nil {
            log.Fatal(err)
        }

        go func(channel syslog.LogPartsChannel) {
            for logParts := range channel {
                fmt.Println(logParts)
            }
        }(channel)

        server.Wait()
    }

    func removeSocket() {
        os.Remove(socket_path)
    }

ListenUDP works though

broken pipe issue

There is a problem that the syslog server sometimes send TCP "RST" package to the client when the client send data to the server, and it raises a "broken pipe" error when the client send another data to the server using the same connection

Can't log into example

Hey there,

thanks for your example but for me it does not work as expected. Maybe I use it wrong.

I build the example script within a container:

$ docker run -ti --rm --privileged -v $(pwd):/data/ qnib/cos7-build /bin/bash
[root@71ac0bd6ad23 /]# export GOPATH=/tmp/
[root@71ac0bd6ad23 /]# cd /data/
[root@71ac0bd6ad23 data]# go get -d
[root@71ac0bd6ad23 data]# sed -i -e 's/514/1514/' basic_udp.go
[root@71ac0bd6ad23 data]# go build

I start the server, get into the container and issue a log...

[root@71ac0bd6ad23 data]# ./data
# separat bash
$ docker exec -ti insane_cori bash
[root@2d27e5e06154 /]# logger -n 127.0.0.1 -P 1514 -d TestLog

Sadly I can not see a log on the other side? What am I doing wrong?

Cheers
Christian

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.