Skip to content

[-] fix log parser to not re-read non-truncated files, fixes #1089#1168

Merged
pashagolub merged 5 commits intomasterfrom
fix-log-parser
Feb 3, 2026
Merged

[-] fix log parser to not re-read non-truncated files, fixes #1089#1168
pashagolub merged 5 commits intomasterfrom
fix-log-parser

Conversation

@0xgouda
Copy link
Copy Markdown
Collaborator

@0xgouda 0xgouda commented Feb 3, 2026

  • Use a map[string]uint64 to track the last read offset for the file if log_truncate_on_rotation = "off"
  • Set maxTrackedFiles = 2500 to avoid unbounded growth for the map tracking offsets

Closes #1089

@0xgouda 0xgouda self-assigned this Feb 3, 2026
@0xgouda 0xgouda added bug Something isn't working refactoring Something done as it should've been done from the start labels Feb 3, 2026
@0xgouda 0xgouda requested a review from pashagolub February 3, 2026 08:13
@coveralls
Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 21622321915

Details

  • 27 of 45 (60.0%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.2%) to 75.446%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/reaper/logparser_local.go 6 13 46.15%
internal/reaper/logparser_remote.go 3 14 21.43%
Totals Coverage Status
Change from base Build 21595375453: -0.2%
Covered Lines: 4062
Relevant Lines: 5384

💛 - Coveralls

@0xgouda 0xgouda changed the title [-] fix log parser to not re-read non-truncated files [-] fix log parser to not re-read non-truncated files, fixes #1089 Feb 3, 2026
Copy link
Copy Markdown
Collaborator

@pashagolub pashagolub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks

@pashagolub pashagolub merged commit 2ac5bb5 into master Feb 3, 2026
9 checks passed
@pashagolub pashagolub deleted the fix-log-parser branch February 3, 2026 10:13
Hamza-Azeem pushed a commit to Hamza-Azeem/pgwatch that referenced this pull request Feb 3, 2026
…-postgresql#1089 (cybertec-postgresql#1168)

* fix: don't re-read from start of the file if log truncation is off

* Update tests to use new `tryDetermineLogsettings()`

Also update mocks to expect the updated query

* Set `maxTrackedFiles` to 2500

* Fix operators precedence

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

Labels

bug Something isn't working refactoring Something done as it should've been done from the start

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Problem in log parser logic

3 participants