Documentation ¶
Index ¶
- Constants
- func ExponentialDuration(attempt int) time.Duration
- func NewHTTPSWriter(binding *URLBinding, netConf NetworkTimeoutConfig, skipCertVerify bool, ...) egress.WriteCloser
- func NewTCPWriter(binding *URLBinding, netConf NetworkTimeoutConfig, skipCertVerify bool, ...) egress.WriteCloser
- func NewTLSWriter(binding *URLBinding, netConf NetworkTimeoutConfig, skipCertVerify bool, ...) egress.WriteCloser
- func ToRFC5424(env *loggregator_v2.Envelope, hostname, appID string) ([][]byte, error)
- type Binding
- type ConnectorOption
- type DialFunc
- type HTTPSWriter
- type LogClient
- type NetworkTimeoutConfig
- type RetryDuration
- type RetryWriter
- type SyslogConnector
- type TCPWriter
- type TLSWriter
- type URLBinding
- type WriterConstructor
- type WriterFactory
Constants ¶
const RFC5424TimeOffsetNum = "2006-01-02T15:04:05.999999-07:00"
Variables ¶
This section is empty.
Functions ¶
func ExponentialDuration ¶
ExponentialDuration returns a duration that grows exponentially with each attempt. It is maxed out at 15 seconds.
func NewHTTPSWriter ¶
func NewHTTPSWriter( binding *URLBinding, netConf NetworkTimeoutConfig, skipCertVerify bool, egressMetric metrics.Counter, ) egress.WriteCloser
func NewTCPWriter ¶
func NewTCPWriter( binding *URLBinding, netConf NetworkTimeoutConfig, skipCertVerify bool, egressMetric metrics.Counter, ) egress.WriteCloser
NewTCPWriter creates a new TCP syslog writer.
func NewTLSWriter ¶
func NewTLSWriter( binding *URLBinding, netConf NetworkTimeoutConfig, skipCertVerify bool, egressMetric metrics.Counter, ) egress.WriteCloser
Types ¶
type ConnectorOption ¶
type ConnectorOption func(*SyslogConnector)
ConnectorOption allows a syslog connector to be customized.
func WithLogClient ¶
func WithLogClient(logClient LogClient, sourceIndex string) ConnectorOption
WithLogClient returns a ConnectorOption that will set up logging for any information about a binding.
type HTTPSWriter ¶
type HTTPSWriter struct {
// contains filtered or unexported fields
}
func (*HTTPSWriter) Close ¶
func (*HTTPSWriter) Close() error
func (*HTTPSWriter) Write ¶
func (w *HTTPSWriter) Write(env *loggregator_v2.Envelope) error
type LogClient ¶
type LogClient interface {
EmitLog(message string, opts ...loggregator.EmitLogOption)
}
LogClient is used to emit logs.
type NetworkTimeoutConfig ¶
type NetworkTimeoutConfig struct { Keepalive time.Duration DialTimeout time.Duration WriteTimeout time.Duration }
NetworkTimeoutConfig stores various timeout values.
type RetryDuration ¶
RetryDuration calculates a duration based on the number of write attempts.
type RetryWriter ¶
type RetryWriter struct {
// contains filtered or unexported fields
}
RetryWriter wraps a WriteCloser and will retry writes if the first fails.
func (*RetryWriter) Close ¶
func (r *RetryWriter) Close() error
Close delegates to the syslog writer.
func (*RetryWriter) Write ¶
func (r *RetryWriter) Write(e *loggregator_v2.Envelope) error
Write will retry writes unitl maxRetries has been reached.
type SyslogConnector ¶
type SyslogConnector struct {
// contains filtered or unexported fields
}
SyslogConnector creates the various egress syslog writers.
func NewSyslogConnector ¶
func NewSyslogConnector( netConf NetworkTimeoutConfig, skipCertVerify bool, wg egress.WaitGroup, f writerFactory, m metricClient, opts ...ConnectorOption, ) *SyslogConnector
NewSyslogConnector configures and returns a new SyslogConnector.
type TCPWriter ¶
type TCPWriter struct {
// contains filtered or unexported fields
}
TCPWriter represents a syslog writer that connects over unencrypted TCP. This writer is not meant to be used from multiple goroutines. The same goroutine that calls `.Write()` should be the one that calls `.Close()`.
type TLSWriter ¶
type TLSWriter struct {
TCPWriter
}
TLSWriter represents a syslog writer that connects over unencrypted TCP.
type URLBinding ¶
application is identified by AppID and Hostname. The syslog URL is identified by URL.
func (*URLBinding) Scheme ¶
func (u *URLBinding) Scheme() string
Scheme is a convenience wrapper around the *url.URL Scheme field
type WriterConstructor ¶
type WriterConstructor func( binding *URLBinding, netConf NetworkTimeoutConfig, skipCertVerify bool, egressMetric func(uint64), ) egress.WriteCloser
WriterConstructor creates syslog connections to https, syslog, and syslog-tls drains
func RetryWrapper ¶
func RetryWrapper( wc WriterConstructor, r RetryDuration, maxRetries int, logClient LogClient, sourceIndex string, ) WriterConstructor
RetryWrapper wraps a WriterConstructer, allowing it to retry writes.
type WriterFactory ¶
type WriterFactory struct {
// contains filtered or unexported fields
}
func NewWriterFactory ¶
func NewWriterFactory(m metricClient) WriterFactory
func (WriterFactory) NewWriter ¶
func (f WriterFactory) NewWriter( urlBinding *URLBinding, netConf NetworkTimeoutConfig, skipCertVerify bool, ) (egress.WriteCloser, error)