Documentation
¶
Index ¶
Constants ¶
View Source
const ( // DefaultHostname will be used if hostname could not be determined DefaultHostname string = "unknown" // DefaultIP will be used if ip could not be determined DefaultIP string = "" )
View Source
const ( Rfc3164 = 1024 Rfc5424 = 2048 Unlimited = 0 )
Variables ¶
View Source
var TooManyBytesSentErr = errors.New("too many bytes sent")
TooManyBytesSentErr will be returned, if a message could not be sent because of a hard limit of bytes to be send.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Hostname string // Hostname of the system IP string // IP of the system Rfc3339 bool // use rfc3339 instead of stamp for time format MaxLength int // max syslog length NoPrio bool // do not add <prio> Prefix HostnameOnly bool // Only use hostname in syslog header instead of hostname ip combination // contains filtered or unexported fields }
Client holds a connection to a specified address
func NewClient ¶
func NewClient(connectionType ConnectionType, address string, tlsconfig *tls.Config) (*Client, error)
NewClient initializes a new server connection. Examples:
- NewClient(ConnectionUDP, "172.0.0.1:514")
- NewClient(ConnectionTCP, ":514")
- NewClient(ConnectionTLS, "172.0.0.1:514")
func (*Client) Send ¶
Send sends a syslog message with a specified priority. Examples:
- Send("foo", LOG_LOCAL0|LOG_NOTICE)
- Send("bar", LOG_DAEMON|LOG_DEBUG)
func (*Client) SendRaw ¶
SendRaw sends a syslog message without adding syslog header. Examples:
- SendRaw("foo")
- SendRaw("bar")
func (*Client) SetMaxBytes ¶
SetMaxBytes sets the maximum bytes that will be sent to rsyslog (approximately)
type ConnectionType ¶
type ConnectionType string
ConnectionType defines wheather to connect via UDP or TCP (or TLS)
const ( // ConnectionUDP connects via UDP ConnectionUDP ConnectionType = "udp" // ConnectionTCP connects via TCP ConnectionTCP ConnectionType = "tcp" // ConnectionTLS connects via TLS ConnectionTLS ConnectionType = "tls" )
Click to show internal directories.
Click to hide internal directories.