Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultOptions = func() *HandlerOptions { opts := &HandlerOptions{ TimeFields: []string{"time", "ts", "@timestamp", "timestamp", "Timestamp"}, MessageFields: []string{"message", "msg", "Body"}, LevelFields: []string{"level", "lvl", "loglevel", "severity", "SeverityText"}, timeNow: time.Now, } return opts }
View Source
var TimeFormats = []string{ "2006-01-02 15:04:05.999999999 -0700 MST", "2006-01-02 15:04:05", "2006-01-02T15:04:05-0700", time.RFC3339, time.RFC3339Nano, time.RFC822, time.RFC822Z, time.RFC850, time.RFC1123, time.RFC1123Z, time.UnixDate, time.RubyDate, time.ANSIC, time.Kitchen, time.Stamp, time.StampMilli, time.StampMicro, time.StampNano, "2006/01/02 15:04:05", "2006/01/02 15:04:05.999999999", }
Functions ¶
Types ¶
type Handler ¶
type Handler interface { CanHandle(line []byte) bool Prettify(skipUnchanged bool) []byte logfmt.Handler }
Handler can recognize it's log lines, parse them and prettify them.
type HandlerOptions ¶
type HandlerOptions struct { TimeFields []string MessageFields []string LevelFields []string // contains filtered or unexported fields }
func HandlerOptionsFrom ¶
func HandlerOptionsFrom(cfg config.Config) *HandlerOptions
type JSONHandler ¶
type JSONHandler struct { Opts *HandlerOptions Level string Time time.Time Message string Fields map[string]string }
JSONHandler can handle logs emitted by logrus.TextFormatter loggers.
func (*JSONHandler) TryHandle ¶
func (h *JSONHandler) TryHandle(d []byte, out *typesv1.StructuredLogEvent) bool
TryHandle tells if this line was handled by this handler.
func (*JSONHandler) UnmarshalJSON ¶
func (h *JSONHandler) UnmarshalJSON(data []byte) bool
UnmarshalJSON sets the fields of the handler.
type LogfmtHandler ¶
type LogfmtHandler struct { Opts *HandlerOptions Level string Time time.Time Message string Fields map[string]string }
LogfmtHandler can handle logs emmited by logrus.TextFormatter loggers.
func (*LogfmtHandler) TryHandle ¶
func (h *LogfmtHandler) TryHandle(d []byte, out *typesv1.StructuredLogEvent) bool
CanHandle tells if this line can be handled by this handler.
func (*LogfmtHandler) UnmarshalLogfmt ¶
func (h *LogfmtHandler) UnmarshalLogfmt(data []byte) bool
HandleLogfmt sets the fields of the handler.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.