Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetFieldSet ¶
GetFieldSet returns the read FieldSet associated with the log. It returns an error when the FieldSet wasn't found on the log.
func MustGetFieldSet ¶
MustGetFieldSet returns the read FieldSet associated with the log. It will go panic when the FieldSet was not found on the log.
Types ¶
type CommonFieldSet ¶
type CommonFieldSet struct {
// Timestamp is the timestamp of the log happens.
Timestamp time.Time
}
CommonFieldSet is an abstract FieldSet struct type to get fields commonly defined in logs.
type FieldSet ¶
type FieldSet interface {
// FieldSetKind identifies the set of fields. It must be same if the result type has same fields.
Kind() string
}
FieldSet represents set of log fields read from a log. FieldSet implementations defines how to read these actual fields from a log for parsers to read without using explicit path of field.
type FieldSetReader ¶
type FieldSetReader interface {
// Read attempts to read the log fields into its field.
Read(reader *structured.NodeReader) (FieldSet, error)
// FieldSetKind identifies the set of fields. It must be same if the result type has same fields.
FieldSetKind() string
}
type Log ¶
type Log struct {
*structured.NodeReader
ID string
// contains filtered or unexported fields
}
Log represents a log handled in KHI. It provides direct access to its fields and abstracted cached access via FieldSet interface.
func NewLog ¶
func NewLog(reader *structured.NodeReader) *Log
NewLog returns a log instance from NodeReader instance.
func NewLogFromYAMLString ¶
NewLogFromYAMLString instantiates a new Log from the given YAML string.
func NewLogWithFieldSetsForTest ¶
NewLogWithFieldSetsForTest generates an empty Log with given FieldSet. This is for testing purposes to instantiate a log already parsed.
func (*Log) SetFieldSetReader ¶
func (l *Log) SetFieldSetReader(reader FieldSetReader) error
SetFieldSetReader reads set of fields with the FieldSetReader and keep it in the log.