Difference between revisions of "Syslog"
Jump to navigation
Jump to search
Line 2: | Line 2: | ||
echo "<3>Oct 11 22:14:15 wjd1-busku foo2testing" | nc -v -u -w 0 log.example.com 514 | echo "<3>Oct 11 22:14:15 wjd1-busku foo2testing" | nc -v -u -w 0 log.example.com 514 | ||
+ | |||
+ | https://askubuntu.com/questions/1091659/how-to-send-tls-syslog-message-via-logger-command | ||
logger --udp --port 9514 -n 127.0.0.1 "Test message" | logger --udp --port 9514 -n 127.0.0.1 "Test message" |
Latest revision as of 01:15, 20 January 2022
echo "test" | nc -v -u -w 0 127.0.0.1 9514
echo "<3>Oct 11 22:14:15 wjd1-busku foo2testing" | nc -v -u -w 0 log.example.com 514
https://askubuntu.com/questions/1091659/how-to-send-tls-syslog-message-via-logger-command
logger --udp --port 9514 -n 127.0.0.1 "Test message"
https://github.com/jeremybusk/go-syslog
go mod init a go get gopkg.in/mcuadros/go-syslog.v2
log.go
package main import ( "fmt" "gopkg.in/mcuadros/go-syslog.v2" ) func main() { channel := make(syslog.LogPartsChannel) handler := syslog.NewChannelHandler(channel) server := syslog.NewServer() server.SetFormat(syslog.RFC5424) server.SetHandler(handler) server.ListenUDP("0.0.0.0:9514") server.ListenTCP("0.0.0.0:9514") server.Boot() go func(channel syslog.LogPartsChannel) { for logParts := range channel { fmt.Println(logParts) } }(channel) server.Wait() }
go build log