Skip to content

fix(loki.source.file): Make sure position is recorded when component exit#5412

Merged
kalleep merged 2 commits intomainfrom
kalleep/fix-start-position
Feb 2, 2026
Merged

fix(loki.source.file): Make sure position is recorded when component exit#5412
kalleep merged 2 commits intomainfrom
kalleep/fix-start-position

Conversation

@kalleep
Copy link
Contributor

@kalleep kalleep commented Feb 2, 2026

Pull Request Details

We only update position for a file after some time have passed and when tailer exist. But then we stopped position file before we stopped all tailers so if a file was ingested fast we never stored last read offset.

To fix this we need to stop position after all trailers have been stopped and we need to set lastUpdatedPosition to the start position.

Issue(s) fixed by this Pull Request

Notes to the Reviewer

PR Checklist

  • Documentation added
  • Tests updated
  • Config converters updated

@kalleep kalleep requested a review from a team as a code owner February 2, 2026 09:42
@kalleep kalleep changed the title fix(loki.source.file): make sure position is recorded when component exit fix(loki.source.file): Make sure position is recorded when component exit Feb 2, 2026
@kalleep kalleep added the backport/v1.13 Backport to release/v1.13 label Feb 2, 2026
@kalleep kalleep merged commit 79e138d into main Feb 2, 2026
67 of 70 checks passed
@kalleep kalleep deleted the kalleep/fix-start-position branch February 2, 2026 10:37
@grafana-alloybot grafana-alloybot bot mentioned this pull request Feb 2, 2026
@grafana-alloybot
Copy link
Contributor

⚠️ Automatic backport to release/v1.13 failed

The automatic backport for this PR failed, likely due to merge conflicts. Perform the backport manually:

git fetch origin main release/v1.13
git checkout release/v1.13
git pull
git checkout -b backport/pr-5412-to-v1.13
git cherry-pick -x 79e138d24dccbea6fe87a44bf98360812eb54962
# If conflicts exist, fix them, then:
git add .
git commit
# If no [more] conflicts, then:
git push -u origin backport/pr-5412-to-v1.13

Then create a PR from backport/pr-5412-to-v1.13 to release/v1.13 with the title:

fix(loki.source.file): Make sure position is recorded when component exit [backport]

@kalleep kalleep added backport/v1.13 Backport to release/v1.13 and removed backport/v1.13 Backport to release/v1.13 labels Feb 2, 2026
@grafana-alloybot
Copy link
Contributor

⚠️ Automatic backport to release/v1.13 failed

The automatic backport for this PR failed, likely due to merge conflicts. Perform the backport manually:

git fetch origin main release/v1.13
git checkout release/v1.13
git pull
git checkout -b backport/pr-5412-to-v1.13
git cherry-pick -x 79e138d24dccbea6fe87a44bf98360812eb54962
# If conflicts exist, fix them, then:
git add .
git commit
# If no [more] conflicts, then:
git push -u origin backport/pr-5412-to-v1.13

Then create a PR from backport/pr-5412-to-v1.13 to release/v1.13 with the title:

fix(loki.source.file): Make sure position is recorded when component exit [backport]

kalleep added a commit that referenced this pull request Feb 2, 2026
…exit (#5412)

We only update position for a file after some time have passed and when
tailer exist. But then we stopped position file before we stopped all
tailers so if a file was ingested fast we never stored last read offset.

To fix this we need to stop position after all trailers have been
stopped and we need to set lastUpdatedPosition to the start position.

<!-- Add any relevant notes for the reviewers and testers of this PR.
-->

<!-- Remove items that do not apply. For completed items, change [ ] to
[x]. -->

- [ ] Documentation added
- [ ] Tests updated
- [ ] Config converters updated

(cherry picked from commit 79e138d)
kalleep added a commit that referenced this pull request Feb 2, 2026
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

backport/v1.13 Backport to release/v1.13 frozen-due-to-age

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants