Documentation ¶
Overview ¶
Package logparser parses logs.
Index ¶
Constants ¶
View Source
const ISO8601Millis = "2006-01-02T15:04:05.000Z0700"
ISO8601Millis time format with millisecond precision.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GenericJSONParser ¶
type GenericJSONParser struct{}
GenericJSONParser can parse generic json into Line.
func (GenericJSONParser) Detect ¶
func (GenericJSONParser) Detect(line string) bool
Detect if line is parsable by this parser.
func (GenericJSONParser) Parse ¶
func (GenericJSONParser) Parse(data []byte) (*Line, error)
Parse generic json into Line.
func (GenericJSONParser) String ¶
func (GenericJSONParser) String() string
type Line ¶
type Line struct { Timestamp otelstorage.Timestamp `json:"timestamp"` TraceID otelstorage.TraceID `json:"trace_id"` SpanID otelstorage.SpanID `json:"span_id"` Attrs otelstorage.Attrs `json:"attrs"` SeverityNumber plog.SeverityNumber `json:"severity_number"` SeverityText string `json:"severity_text"` Body string `json:"body"` }
Line represents single parsed line that can be converted to [logstorage.Record].
type LogFmtParser ¶
type LogFmtParser struct{}
LogFmtParser parses logfmt lines.
func (LogFmtParser) Detect ¶
func (LogFmtParser) Detect(line string) bool
Detect if line is parsable by this parser.
func (LogFmtParser) String ¶
func (LogFmtParser) String() string
type Parser ¶
type Parser interface { // Parse parses data and returns a line. // // TODO: refactor to `Parse(data []byte, target *logstorage.Record) error` Parse(data []byte) (*Line, error) // Detect whether data is parsable. // // TODO: refactor to `Detect(data []byte) bool` Detect(line string) bool String() string }
Parser parses logs.
type ZapDevelopmentParser ¶ added in v0.4.0
type ZapDevelopmentParser struct{}
ZapDevelopmentParser parses zap's development mode lines.
func (ZapDevelopmentParser) Detect ¶ added in v0.4.0
func (ZapDevelopmentParser) Detect(line string) bool
Detect if line is parsable by this parser.
func (ZapDevelopmentParser) Parse ¶ added in v0.4.0
func (ZapDevelopmentParser) Parse(data []byte) (*Line, error)
Parse line.
func (ZapDevelopmentParser) String ¶ added in v0.4.0
func (ZapDevelopmentParser) String() string
Click to show internal directories.
Click to hide internal directories.