cw

package
v0.0.0-...-540f1c7 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Flatten

func Flatten[T any](seq iter.Seq2[[]T, error]) iter.Seq2[T, error]

Flatten converts an iterator of batches into an iterator of individual items.

func MergeLogEvents

func MergeLogEvents(left, right iter.Seq2[LogEvent, error]) iter.Seq2[LogEvent, error]

MergeLogEvents merge-sorts two ascending iterators by Timestamp. Uses iter.Pull2 internally for two-pointer merge.

func NewCloudWatchLogsClient

func NewCloudWatchLogsClient(ctx context.Context, region aws.Region) (*cloudwatchlogs.Client, error)

func QueryAndTailLogGroup

func QueryAndTailLogGroup(ctx context.Context, cwClient LogsClient, lgi LogGroupInput, start, end time.Time) (iter.Seq2[[]LogEvent, error], error)

QueryAndTailLogGroup queries the log group from the given start time and initiates a Live Tail session. This function also handles the case where the log group does not exist yet.

func QueryAndTailLogGroups

func QueryAndTailLogGroups(ctx context.Context, cwClient LogsClient, start, end time.Time, lgis ...LogGroupInput) (iter.Seq2[[]LogEvent, error], error)

QueryAndTailLogGroups queries and tails multiple log groups concurrently. Events from different groups are interleaved (not merge-sorted).

func QueryLogGroup

func QueryLogGroup(ctx context.Context, cw FilterLogEventsAPIClient, lgi LogGroupInput, start, end time.Time, limit int32) (iter.Seq2[[]LogEvent, error], error)

func QueryLogGroups

func QueryLogGroups(ctx context.Context, cwClient FilterLogEventsAPIClient, start, end time.Time, limit int32, logGroups ...LogGroupInput) (iter.Seq2[LogEvent, error], error)

func TailLogGroup

func TailLogGroup(ctx context.Context, cwClient StartLiveTailAPI, input LogGroupInput) (iter.Seq2[[]LogEvent, error], error)

func TakeFirstN

func TakeFirstN(seq iter.Seq2[LogEvent, error], n int) iter.Seq2[LogEvent, error]

TakeFirstN yields at most n items from the iterator, then stops.

func TakeLastN

func TakeLastN(seq iter.Seq2[LogEvent, error], n int) iter.Seq2[LogEvent, error]

TakeLastN buffers the entire input, then yields the last n items.

Types

type LogEvent

type LogEvent = types.LiveTailSessionLogEvent

type LogGroupInput

type LogGroupInput struct {
	LogGroupARN           string
	LogStreamNames        []string
	LogStreamNamePrefix   string
	LogEventFilterPattern string
}

LogGroupInput is like cloudwatchlogs.StartLiveTailInput but with only one LogGroup and one LogStream prefix.

type LogsClient

type LogsClient interface {
	FilterLogEventsAPIClient
	StartLiveTailAPI
}

type StartLiveTailAPI

type StartLiveTailAPI interface {
	StartLiveTail(ctx context.Context, params *cloudwatchlogs.StartLiveTailInput, optFns ...func(*cloudwatchlogs.Options)) (*cloudwatchlogs.StartLiveTailOutput, error)
}

Jump to

Keyboard shortcuts

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