Skip to content

Accept single-record Filebeat registries during cleanup - #1168

Merged
mmguero merged 1 commit into
cisagov:sylvesterkaczmarek-mergesfrom
sylvesterkaczmarek:fix/filebeat-single-record-registry-20261006
Oct 7, 2026
Merged

mmguero merged 1 commit into
cisagov:sylvesterkaczmarek-mergesfrom
sylvesterkaczmarek:fix/filebeat-single-record-registry-20261006

Conversation

@sylvesterkaczmarek

Copy link
Copy Markdown
Contributor

Summary

Fixes #1165.

Normalize a parsed registry object to one record before iterating. A valid single-entry file previously produced a dictionary, whose keys were passed to deep_get and aborted the cleanup run.

JSON arrays, NDJSON, device/inode conversion and protection of registered files retain existing behavior. The general JSON loader, retention rules and corrupt-input policies are unchanged. This is separate from #1160's lock correction.

Testing

python -m pytest -q filebeat/tests/test_single_record_registry.py

17 focused tests passed; ten fail on unchanged source. Coverage includes compact/pretty/single-line objects, numeric and string identities, arrays, NDJSON, multiple registries, incomplete records and empty/missing files.

The full prune_files path runs against temporary plaintext logs recognized by real libmagic. It preserves the registered file and removes only an isolated expired unregistered fixture; fuser is mocked. No production log, registry, Filebeat process or external service was accessed. Combined validation with #1160 also passes.

Tested on macOS with Python 3.12. New-test formatting, syntax checks, scoped lint with the Python 3.12 target, and git diff --check pass. Full Malcolm deployment testing was not run. No workflow or dependency changes.

Signed-off-by: Sylvester Kaczmarek <16242628+sylvesterkaczmarek@users.noreply.github.com>
@mmguero mmguero self-assigned this Oct 7, 2026
@mmguero mmguero added build For issues related to compilation/building bug Something isn't working labels Oct 7, 2026
@mmguero mmguero added this to Malcolm Oct 7, 2026
@mmguero mmguero added this to the v26.10.0 milestone Oct 7, 2026
@mmguero
mmguero changed the base branch from main to sylvesterkaczmarek-merges October 7, 2026 15:01
@mmguero
mmguero merged commit 67f91b3 into cisagov:sylvesterkaczmarek-merges Oct 7, 2026
@mmguero mmguero moved this from Done to Released in Malcolm Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working build For issues related to compilation/building

Projects

Status: Released

Development

Successfully merging this pull request may close these issues.

A single-object Filebeat registry aborts log cleanup

2 participants