Documentation ¶
Index ¶
- Constants
- func GetEarliest(ev1, ev2 LogEvent) bool
- type FormatParser
- type Iterator
- type LogEvent
- type LogEventIterator
- func (lei *LogEventIterator) CurrentPos() records.IteratorPos
- func (lei *LogEventIterator) Get(ctx context.Context) (LogEvent, tag.Line, error)
- func (lei *LogEventIterator) Next(ctx context.Context)
- func (lei *LogEventIterator) Release()
- func (lei *LogEventIterator) SetBackward(bkwd bool)
- func (lei *LogEventIterator) Wrap(tags tag.Line, it records.Iterator) *LogEventIterator
- type Mixer
- type SelectF
- type TestLogEventsWrapper
- func (tle *TestLogEventsWrapper) CurrentPos() records.IteratorPos
- func (tle *TestLogEventsWrapper) Get(ctx context.Context) (records.Record, error)
- func (tle *TestLogEventsWrapper) Next(ctx context.Context)
- func (tle *TestLogEventsWrapper) Release()
- func (tle *TestLogEventsWrapper) SetBackward(bkwd bool)
- type TimeRange
Constants ¶
const ( // MinTimestamp contains the minimum nanoseconds value MinTimestamp = int64(-6795364578871345152) MaxTimestamp = math.MaxInt64 )
Variables ¶
This section is empty.
Functions ¶
func GetEarliest ¶
GetEarliest returns whether ev1 has lowest timestamp rather than ev2
Types ¶
type FormatParser ¶
type FormatParser struct {
// contains filtered or unexported fields
}
FormatParser struct provides simple LogEvent's formatting functionality. The FormatParser could be used for formatting log-events in lql.
func NewFormatParser ¶
func NewFormatParser(fstr string) (*FormatParser, error)
NewFormatParser returns FormatParser for the format string provided or returns an error if any.
The following conventions is applied for the format string fstr: Special constructions like LogEvent's field names, tags and time-stamp format should be placed into curly braces '{', '}': {msg.<json()> - LogEvent message (raw or json escaped) {ts} - LogEvent timestamp in RFC3339 format {vars} - All known tags and fields associated with the LogEvent source {ts.<format(<ts fmt>)>} - LogEvent timestamp in the format provided {vars:<tag or field name>} - Value of the tag or filed name provided
Example:
"app:{vars:name}\t{ts.format(15:04:05.000)}: {msg}" - will print app name associated with the tag "name", then timestamp and the log message "{msg.json()}" - will print the log message body only (json escaped) "{vars} - {msg}" - will print all tags and fields associated with the source and the message body
type Iterator ¶
type Iterator interface { // Next switches to the next event, if any Next(ctx context.Context) // Get returns current LogEvent, the TagsCond for the event or an error if any. It returns io.EOF when end of the collection is reached Get(ctx context.Context) (LogEvent, tag.Line, error) // Release allows to free underlying resources if they were used for the iteration. // This method doesn't affect the iterator position, so subsequent calls to Next() or Get() will // get the same result if the Release was not invoked Release() // SetBackward allows to change direction to backward (true) or forward (false) SetBackward(bool) // CurrentPos returns the current iterator position CurrentPos() records.IteratorPos }
Iterator interface provides methods for iterating over a collection of LogEvents
type LogEvent ¶
type LogEvent struct { // Timestamp of the message. It is filled by collector and can contain either collection timestamp or the // message timestamp Timestamp int64 // Msg - the message iteself. Usually it is a slice of bytes that refer to a temporary buffer Msg records.Record // Fields contains fields associated with the log event Fields field.Fields }
LogEvent struct is used for storing one log-event record in a partition.
func (*LogEvent) MakeItSafe ¶
func (le *LogEvent) MakeItSafe()
func (*LogEvent) Release ¶
func (le *LogEvent) Release()
Release drops references to the buffers if the logEvent has ones
func (*LogEvent) Unmarshal ¶
Unmarshal reads the log event data from the buffer. It returns number of bytes read or an error if any
func (*LogEvent) WritableSize ¶
WritableSize returns the number of bytes required to marshal the LogEvent
type LogEventIterator ¶
type LogEventIterator struct {
// contains filtered or unexported fields
}
LogEventIterator struct wraps a records.Iterator and provides LogEvent Iterator interface over it.
func (*LogEventIterator) CurrentPos ¶
func (lei *LogEventIterator) CurrentPos() records.IteratorPos
func (*LogEventIterator) Next ¶
func (lei *LogEventIterator) Next(ctx context.Context)
Next switches to the next LogEvent record
func (*LogEventIterator) Release ¶
func (lei *LogEventIterator) Release()
func (*LogEventIterator) SetBackward ¶
func (lei *LogEventIterator) SetBackward(bkwd bool)
func (*LogEventIterator) Wrap ¶
func (lei *LogEventIterator) Wrap(tags tag.Line, it records.Iterator) *LogEventIterator
Wrap sets the underlying records.Iterator it
type Mixer ¶
type Mixer struct {
// contains filtered or unexported fields
}
Mixer allows to mix 2 Iterators to one. Mixer provides the Iterator interface
func (*Mixer) CurrentPos ¶
func (mr *Mixer) CurrentPos() records.IteratorPos
func (*Mixer) SetBackward ¶
type SelectF ¶
SelectF decides which one should be selected, it returns true if ev1 must be selected instead of ev2. If ev2 should be used then it returns false
type TestLogEventsWrapper ¶ added in v0.1.0
type TestLogEventsWrapper struct {
// contains filtered or unexported fields
}
func NewTestLogEventsWrapper ¶ added in v0.1.0
func NewTestLogEventsWrapper(les []LogEvent) *TestLogEventsWrapper
func (*TestLogEventsWrapper) CurrentPos ¶ added in v0.1.0
func (tle *TestLogEventsWrapper) CurrentPos() records.IteratorPos
func (*TestLogEventsWrapper) Next ¶ added in v0.1.0
func (tle *TestLogEventsWrapper) Next(ctx context.Context)
func (*TestLogEventsWrapper) Release ¶ added in v0.1.0
func (tle *TestLogEventsWrapper) Release()
func (*TestLogEventsWrapper) SetBackward ¶ added in v0.1.0
func (tle *TestLogEventsWrapper) SetBackward(bkwd bool)