Documentation
¶
Overview ¶
Package podlogs provides shared helpers for streaming Kubernetes pod logs and parsing the RFC3339-prefixed log lines emitted when Timestamps=true.
Index ¶
Constants ¶
const DefaultBatchSize = 100
DefaultBatchSize is the default number of log lines sent per batch.
Variables ¶
This section is empty.
Functions ¶
func ParseLine ¶
ParseLine splits a K8s log line into timestamp and message. K8s timestamped lines are formatted as: "2006-01-02T15:04:05.999999999Z message". If parsing fails, the full line is returned as the message with no timestamp.
func Stream ¶
func Stream(ctx context.Context, r io.Reader, batchSize int, flush func([]*dataplane.LogLine) error) error
Stream reads lines from r, groups them into batches of up to batchSize, and invokes flush for each batch. Batches are also flushed when the underlying reader has no buffered data available, so clients aren't stuck waiting on a partially-filled batch when the pod is idle.
Returns io.EOF as nil. A non-EOF read error is returned only when ctx has not been cancelled — callers typically treat ctx cancellation as a clean close.
Types ¶
This section is empty.