Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LogStream ¶
type LogStream struct {
// contains filtered or unexported fields
}
A LogStream is used to parse a log given a StreamConfig.
func NewLogStream ¶
func NewLogStream(rd io.RuneReader, config *StreamConfig) (*LogStream, error)
NewLogStream returns a new instance of LogStream.
func (*LogStream) Read ¶
func (s *LogStream) Read() (*PushRequestStream, error)
Read returns the next log entry wrapped in a PushRequestStream so that it can retain the labels.
type PushRequest ¶
type PushRequest struct {
Streams []*PushRequestStream `json:"streams"`
}
PushRequest is a message that can be sent to /loki/api/v1/push.
This is documented at https://github.com/grafana/loki/blob/master/docs/api.md#post-lokiapiv1push
func NewPushRequest ¶
func NewPushRequest(streams []*PushRequestStream) *PushRequest
NewPushRequest returns a PushRequest given a list of PushRequestStream objects. This groups the streams by their labels so that the final payload is smaller.
type PushRequestStream ¶
type PushRequestStream struct { Stream map[string]string `json:"stream"` Values []*PushRequestStreamEntry `json:"values"` }
A PushRequestStream is a stream of timestamp/log line values in ascending timestamp order, plus stream labels in key/value pair format.
func (*PushRequestStream) String ¶
func (s *PushRequestStream) String() string
type PushRequestStreamEntry ¶
A PushRequestStreamEntry is a timestamp/log line value pair.
func (*PushRequestStreamEntry) MarshalJSON ¶
func (e *PushRequestStreamEntry) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding of the PushRequestStreamEntry.
func (*PushRequestStreamEntry) String ¶
func (e *PushRequestStreamEntry) String() string
type StreamConfig ¶
type StreamConfig struct { Path string `json:"path"` Labels map[string]string `json:"labels"` RegexpString string `json:"regexp"` TimestampLayout string `json:"timestamp_layout"` }
StreamConfig represents an entry for one stream.
type Tail ¶
type Tail struct {
// contains filtered or unexported fields
}
Tail is a ReadCloser
func NewTail ¶
NewTail opens a file at the specified offset and provides an io.Reader interface to the file, tail(1)-style: if the file is moved and recreated (maybe due to a log rotation), this transparently reopens the file and keeps the stream open.
This means that the calls to Read() will never return EOF, unless Stop() is called.