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 } )
}
- Example of client : example_01-client_test.go
- Example of server : example_02-server_test.go
- Example of custom transport : example_03-custom_test.go
- golang log.Logger compliant
- Handle multiple logging Channels
- Provide /dev/null Channel
- Extendable interfaces
- Encode RFC 5424 Message
- Decode RFC 5424 Message
- Encode Structured Data
- Decode Structured Data
- Dial to a AF_UNIX datagram syslog server
- Dial to a AF_UNIX stream syslog server
- Dial to a TCP remote syslog server
- Accept to a AF_UNIX datagram syslog server
- Accept to a AF_UNIX stream syslog server
- Accept to a TCP remote syslog server
- Unix Datagram Transport
- NULL terminated Transport
- LF terminated Transport
- RFC 5425 Transport
- Encode Structured Data
- Decode Structured Data
- Encode Private Structured Data
- Decode Private Structured Data
- Decode Unknown Structured Data
- Structured Data Interface
- SDID Interface
- SDIDLight Interface for Light Structured Data Support
Source : IANA syslog Structured Data ID Values
- timeQuality (RFC 5424)
- meta (RFC 5424)
- origin (RFC 5424)
- snmp (RFC 5675)
- alarm (RFC 5674)
- ssign (RFC 5848)
- ssign-cert (RFC 5848)
- PCNNode (RFC 6661)
- PCNTerm (RFC 6661)
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 :
- Verify the certificate validity
- verify the chain of trust to the root
- Verify OSCP staple if provided
- Check the OSCP's response from the CA
- Verify the SCT with the OSCP's SCT information and/or SCT extra TLS header
so, you can :
- Write your own code with the golang TLS stack (everything is provided through interfaces)
- Wait for my implementation with the golang TLS stack wich will provide OCSP and Public Key verification
- Write documentation
- Write comments