podlogs

package
v2.0.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2026 License: Apache-2.0, Apache-2.0 Imports: 7 Imported by: 0

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

View Source
const DefaultBatchSize = 100

DefaultBatchSize is the default number of log lines sent per batch.

Variables

This section is empty.

Functions

func ParseLine

func ParseLine(line string) *dataplane.LogLine

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL