cloudflare-log-collector

loki

import "github.com/afreidah/cloudflare-log-collector/internal/loki"

Index

type Client

Client pushes log entries to the Loki HTTP API.

type Client struct {
    // contains filtered or unexported fields
}

func NewClient

func NewClient(endpoint, tenantID string) *Client

NewClient creates a Loki push API client.

func (*Client) Push

func (c *Client) Push(ctx context.Context, labels map[string]string, entries []Entry) error

Push sends a batch of log entries to Loki under the given stream labels. Each entry is a [timestamp_nanos, json_line] pair.

type Entry

Entry is a single log line with a nanosecond-precision timestamp string.

type Entry struct {
    Timestamp string // nanoseconds since epoch as a string
    Line      string // JSON-encoded log line
}

func NewEntry

func NewEntry(t time.Time, line string) Entry

NewEntry creates a log entry from a time and JSON line.

Generated by gomarkdoc