nathanaelle / syslog5424

log.Logger-friendly RFC-5424 syslog library
BSD 2-Clause "Simplified" License
6 stars 1 forks source link
go golang log logging rfc-3164 rfc-5424 rfc-5425 syslog

Syslog5424

License Go Doc Build Status Go Report Card

Example

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 } )
}

Features

Generic Features

RFC 5424

Networking / Communication

Transport Encoding

Structured Data

Structured Data Type

Source : IANA syslog Structured Data ID Values

License

2-Clause BSD

Questions

What is Syslog5424 ?

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.

What is Structured Data ?

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.

What there is no support of UDP (RFC 5426) ?

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.

Why remove parts of code about TLS ?

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 :

  1. Verify the certificate validity
  2. verify the chain of trust to the root
  3. Verify OSCP staple if provided
  4. Check the OSCP's response from the CA
  5. Verify the SCT with the OSCP's SCT information and/or SCT extra TLS header

so, you can :

  1. Write your own code with the golang TLS stack (everything is provided through interfaces)
  2. Wait for my implementation with the golang TLS stack wich will provide OCSP and Public Key verification

Todo