import (
"github.com/nathanaelle/syslog5424"
)
type someSD struct{
Message string
Errno int
}
func main() {
// create a connection to a server
sl_conn, _, _ := syslog5424.Dial( "stdio", "stderr:" )
// create a syslog wrapper around the connection
syslog,_ := syslog5424.New( sl_conn, syslog5424.LogDAEMON|syslog5424.LogWARNING, "test-app" )
// create a channel for errors
err_channel := syslog.Channel( syslog5424.LogERR )
// plug the golang log.Logger API to this channel
logger_err := err_channel.Logger( "ERR : " )
// log a message through the log.Logger
logger_err.Print( "doing some stuff" )
// log a message directly with some structured data
err_channel.Log( "another message", someSD{ "some message", 42 } )
}
Source : IANA syslog Structured Data ID Values
2-Clause BSD
Syslog5424 is a library for coping with syslog messages through the log.Logger API. Syslog5424 only produces syslog packets that are compatible with RFC 5424. Those messages are not compatible with RFC 3164.
The main point of the RFC 5424 is structured data. This is a textual serialization of simple struct or map[string]string. This serialization is typed or named and one text message can convey many Structured Data entries. So This is a very pertinent way to mix metrics, keywords and human readable messages.
System logging must be reliable for security audits of the logs. UDP is an unreliable protocol because UDP packets can be dropped, and neither the client nor the server will be informed of the missing data.
TLS is supported because the networking is implemented as interfaces. but my idea of "security" is not compatible with maintaining duplicate code.
The requirements to support TLS are :
so, you can :