Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultOptions = func() *HandlerOptions { opts := &HandlerOptions{ TimeFields: []string{"time", "ts", "@timestamp", "timestamp", "Timestamp", "asctime", "stageTimestamp", "requestReceivedTimestamp", }, MessageFields: []string{"message", "msg", "Body"}, LevelFields: []string{"level", "lvl", "loglevel", "severity", "SeverityText"}, timeNow: time.Now, newULID: func() *typesv1.ULID { u := ulid.Make() return typesv1.ULIDFromBytes(nil, u) }, } 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", "2006-01-02T15:04:05.999-0700", "2006-01-02T15:04:05.999999Z07:00", 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", "06-01-02 15:04:05,999", "2006-01-02T15: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
DetectTimestamp bool
DetectDuration bool
// contains filtered or unexported fields
}
func HandlerOptionsFrom ¶
func HandlerOptionsFrom(cfg *typesv1.ParseConfig) *HandlerOptions
type JSONHandler ¶
type JSONHandler struct {
Opts *HandlerOptions
Level string
Time time.Time
Message string
Fields []*typesv1.KV
}
JSONHandler can handle logs emitted by logrus.TextFormatter loggers.
func (*JSONHandler) TryHandle ¶
func (h *JSONHandler) TryHandle(d []byte, out *typesv1.Log) 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 []*typesv1.KV
}
LogfmtHandler can handle logs emmited by logrus.TextFormatter loggers.
func (*LogfmtHandler) TryHandle ¶
func (h *LogfmtHandler) TryHandle(d []byte, out *typesv1.Log) 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.