Documentation
¶
Overview ¶
logging tails a log file in real time, sending new lines to a channel with exponential backoff when waiting for new data.
Log entry types and paginated querying. Reads the log file backwards so the most recent entries come first.
Index ¶
- func MarshalLokiBatch(batch LokiBatch) ([]byte, error)
- func SendLokiTestEntry(endpoint, bearerToken, tenantID string) error
- func TailFile(ctx context.Context, path string, lines chan<- string) error
- type LogEntry
- type LogRequest
- type LogTLS
- type LokiBatch
- type LokiBatcher
- type LokiEntry
- type LokiPipeline
- func (p *LokiPipeline) GetPusher() *LokiPusher
- func (p *LokiPipeline) GetStatus() (bool, map[string]SinkStatus)
- func (p *LokiPipeline) GetTailerNames() []string
- func (p *LokiPipeline) IsRunning() bool
- func (p *LokiPipeline) Reconfigure()
- func (p *LokiPipeline) Restart()
- func (p *LokiPipeline) Start()
- func (p *LokiPipeline) Stop()
- type LokiPusher
- type LokiStream
- type LokiTailer
- type PositionStore
- type QueryParams
- type QueryResult
- type SinkResolver
- type SinkStatus
- type TaggedLine
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MarshalLokiBatch ¶ added in v1.5.0
func SendLokiTestEntry ¶ added in v1.5.0
Types ¶
type LogEntry ¶
type LogEntry struct {
Level string `json:"level"`
Ts float64 `json:"ts"`
Logger string `json:"logger"`
Msg string `json:"msg"`
Request *LogRequest `json:"request,omitempty"`
Duration float64 `json:"duration,omitempty"`
Status int `json:"status,omitempty"`
Size int `json:"size,omitempty"`
RespHeaders map[string][]string `json:"resp_headers,omitempty"`
Extra map[string]any `json:"extra,omitempty"`
}
func (*LogEntry) UnmarshalJSON ¶
type LogRequest ¶
type LokiBatch ¶ added in v1.5.0
type LokiBatch struct {
Streams []LokiStream
}
type LokiBatcher ¶ added in v1.5.0
type LokiBatcher struct {
// contains filtered or unexported fields
}
func NewLokiBatcher ¶ added in v1.5.0
func NewLokiBatcher( lines <-chan TaggedLine, batches chan<- LokiBatch, batchSize int, flushInterval time.Duration, staticLabels map[string]string, ) *LokiBatcher
func (*LokiBatcher) Run ¶ added in v1.5.0
func (b *LokiBatcher) Run(ctx context.Context)
type LokiPipeline ¶ added in v1.5.0
type LokiPipeline struct {
// contains filtered or unexported fields
}
func NewLokiPipeline ¶ added in v1.5.0
func NewLokiPipeline(store *config.ConfigStore, positionsPath string, resolveSinks SinkResolver) *LokiPipeline
func (*LokiPipeline) GetPusher ¶ added in v1.5.0
func (p *LokiPipeline) GetPusher() *LokiPusher
func (*LokiPipeline) GetStatus ¶ added in v1.5.0
func (p *LokiPipeline) GetStatus() (bool, map[string]SinkStatus)
func (*LokiPipeline) GetTailerNames ¶ added in v1.6.0
func (p *LokiPipeline) GetTailerNames() []string
func (*LokiPipeline) IsRunning ¶ added in v1.5.0
func (p *LokiPipeline) IsRunning() bool
func (*LokiPipeline) Reconfigure ¶ added in v1.5.0
func (p *LokiPipeline) Reconfigure()
func (*LokiPipeline) Restart ¶ added in v1.5.0
func (p *LokiPipeline) Restart()
func (*LokiPipeline) Start ¶ added in v1.5.0
func (p *LokiPipeline) Start()
func (*LokiPipeline) Stop ¶ added in v1.5.0
func (p *LokiPipeline) Stop()
type LokiPusher ¶ added in v1.5.0
type LokiPusher struct {
// contains filtered or unexported fields
}
func NewLokiPusher ¶ added in v1.5.0
func NewLokiPusher( endpoint, bearerToken, tenantID string, batches <-chan LokiBatch, ) *LokiPusher
func (*LokiPusher) GetStatus ¶ added in v1.5.0
func (p *LokiPusher) GetStatus() map[string]SinkStatus
func (*LokiPusher) Run ¶ added in v1.5.0
func (p *LokiPusher) Run(ctx context.Context)
type LokiStream ¶ added in v1.5.0
type LokiTailer ¶ added in v1.5.0
type LokiTailer struct {
// contains filtered or unexported fields
}
func NewLokiTailer ¶ added in v1.5.0
func NewLokiTailer(sink, path string, pos *PositionStore, lines chan<- TaggedLine) *LokiTailer
func (*LokiTailer) Run ¶ added in v1.5.0
func (t *LokiTailer) Run(ctx context.Context)
type PositionStore ¶ added in v1.5.0
type PositionStore struct {
// contains filtered or unexported fields
}
func NewPositionStore ¶ added in v1.5.0
func NewPositionStore(path string) *PositionStore
func (*PositionStore) Cleanup ¶ added in v1.5.0
func (ps *PositionStore) Cleanup(activePaths map[string]bool)
func (*PositionStore) Get ¶ added in v1.5.0
func (ps *PositionStore) Get(path string) int64
func (*PositionStore) Load ¶ added in v1.5.0
func (ps *PositionStore) Load() error
func (*PositionStore) Remove ¶ added in v1.5.0
func (ps *PositionStore) Remove(path string)
func (*PositionStore) Save ¶ added in v1.5.0
func (ps *PositionStore) Save() error
func (*PositionStore) Set ¶ added in v1.5.0
func (ps *PositionStore) Set(path string, offset int64)
type QueryParams ¶
type QueryResult ¶
func QueryLogs ¶
func QueryLogs(path string, params QueryParams) (*QueryResult, error)
type SinkResolver ¶ added in v1.5.0
type SinkStatus ¶ added in v1.5.0
type TaggedLine ¶ added in v1.5.0
Click to show internal directories.
Click to hide internal directories.