We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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 }
The text was updated successfully, but these errors were encountered:
The logger command send messages in RFC3164. Therefore, that format needs to be set.
logger
RFC3164
Sorry, something went wrong.
No branches or pull requests
Is it possible to set generic format? as opposed to being specific.
Code:
Sending a message:
Received:
The text was updated successfully, but these errors were encountered: