Documentation ¶
Index ¶
Constants ¶
View Source
const ( BufferFull dropReason = "buffer_full" FailedToWrite dropReason = "failed_to_write" BadFormat dropReason = "bad_format" )
Variables ¶
View Source
var (
TimestampFormat string = defaultTimestampFormat
)
Functions ¶
func NewFormatter ¶
func NewFormatter() (*logstashFormatter, error)
Types ¶
type Hook ¶
type Hook struct {
// contains filtered or unexported fields
}
Hook sends logs to Logstash.
func NewHook ¶
newHook creates a hook to be added to an instance of logger. It connects to Logstash on host via TCP.
type ReconnectingWriter ¶
type ReconnectingWriter struct {
// contains filtered or unexported fields
}
ReconnectingWriter wraps a net.Conn such that it will never fail to write and will attempted to reestablish the connection whenever an error occurs.
func NewReconnectingWriter ¶
func NewReconnectingWriter(dial dialFunc, errLogger logrus.FieldLogger) *ReconnectingWriter
func (*ReconnectingWriter) Write ¶
func (c *ReconnectingWriter) Write(b []byte) (int, error)
Write will run the following retry all of the following in a loop until it manages one successful write: * attempt to re-establish a connection if a connection is not available * attempt to write the given bytes if a connection is available and exit if it succeeds * reset the underlying connection if write fails
Deadline is set for all writes as specified in the flag.
Click to show internal directories.
Click to hide internal directories.