Skip to content

fix(loki.source.docker): Preserve positions for stopped containers - #7040

Open
al1re3a wants to merge 1 commit into
grafana:mainfrom
al1re3a:fix/docker-preserve-stopped-positions
Open

fix(loki.source.docker): Preserve positions for stopped containers#7040
al1re3a wants to merge 1 commit into
grafana:mainfrom
al1re3a:fix/docker-preserve-stopped-positions

Conversation

@al1re3a

@al1re3a al1re3a commented Sep 4, 2026

Copy link
Copy Markdown

Brief description of Pull Request

Preserve Docker log positions when a container stops but still exists, so restarting the container resumes from the stored cursor instead of replaying retained logs.

Pull Request Details

loki.source.docker now inspects a target after its tailer stops. It removes the stored position only when Docker reports that the container is not found; stopped containers and transient inspection failures keep their positions. Tests cover stopped, removed, inspection-error, and component-shutdown paths.

Issue(s) fixed by this Pull Request

Fixes #7036

Notes to the Reviewer

PR Checklist

  • Documentation added
  • Tests updated
  • Config converters updated
  • This pull request was substantially generated with AI assistance (see the GenAI policy)

@al1re3a
al1re3a requested a review from a team as a code owner September 4, 2026 21:33
@cla-assistant

cla-assistant Bot commented Sep 4, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@kalleep

kalleep commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

This would break some behavior we have right now, if a target is removed then we would keep the position with this pr.

@kalleep kalleep self-assigned this Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

loki.source.docker: stopping a container deletes its read position, causing a full log re-read on next start

2 participants