G
YouTube TikTok Games
Skip to content

Generate requested line numbers for runtime container log output #304

Open

Description

Problem

Container /log?line_numbers=true responses do not generate line numbers for timestamp-only runtime output. This is a pre-existing V1 limitation also present in the V2 runtime-capture implementation under development in #295; it is being tracked separately to avoid expanding that PR.

Code context

The Docker/Podman capture path requests runtime timestamps and writes the resulting output directly to capture files:

CaptureContainerLogs(..., containers.StreamContainerLogsOptions{
    Follow: true,
    Timestamps: true,
})

The response reader uses:

usvc_io.NewTimestampAwareReader(source, usvc_io.TimestampAwareReaderOptions{
    Timestamps: opts.Timestamps,
    LineNumbers: opts.LineNumbers,
    // ...
})

TimestampAwareReader preserves or removes existing prefixes; it does not generate missing numbering. Relevant code: internal/logs/containerlogs/container_logstreamer.go, internal/docker/cli_orchestrator.go, internal/podman/cli_orchestrator.go, and pkg/io/timestamp_aware_reader.go. V2's analogous implementation is internal/logs/v2containerlogs/container_logstreamer.go in #295.

Reproduction and evidence

A focused streamer probe supplied actual runtime-style input:

2026-10-16T12:00:00.000Z raw-runtime-output

With line_numbers=true and timestamps disabled, the response was raw-runtime-output, rather than 1 raw-runtime-output. This is a controlled reproduction, not a reported production incident. Simulated capture that already includes numbering can mask the defect.

Expected behavior

Honor requested line numbers for runtime stdout/stderr while preserving runtime timestamps and original line positions across tail/skip/limit selections. Keep physical and logical endpoints consistent when consuming the same capture. Existing numbered startup captures must not acquire duplicate prefixes.

Scope and validation

Investigate the existing shared capture/formatting mechanisms before selecting a fix; do not introduce a separate per-source implementation. Cover timestamp-only runtime input, numbering with and without timestamps, and original numbering after tail/skip. This issue does not request changes to runtime lifecycle or watcher dispatch.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions