Filebeat stops shipping logs after registry file corrupts following abrupt host shutdown
Environment
Filebeat 7.17 installed on multiple Ubuntu 20.04 servers; shipping logs to Elasticsearch 7.17. Filebeat registry located at /var/lib/filebeat/registry. One host experienced abrupt power loss during heavy log write.
Symptoms
After the unclean shutdown, Filebeat reports harvesting files but Elasticsearch shows no new documents. Rebooted host and Filebeat starts but some log files are not being processed (older log rotations appear to be skipped). No obvious Filebeat crashes; service stays up.
Observations
Filebeat logs (journalctl -u filebeat) show 'Start harvester for new file' entries but subsequent 'file already finished' or 'current offset greater than file size' warnings for some rotated files. Inspecting /var/lib/filebeat/registry reveals entries referencing offsets larger than the file sizes, and duplicate entries for the same inode/path with different offsets. Removing the registry file and restarting Filebeat causes re-harvest of older files but risks duplicates in Elasticsearch and loss of exactly-once semantics. File permissions are intact.
Already attempted
Restarted Filebeat service (no change). Backed up and removed registry file to force full re-harvest — this successfully shipped the missing logs but created duplicates for recent entries in Elasticsearch. Tried setting clean_inactive and close_removed settings lower, and ran filebeat -e -d '*' to get debug output. Considered manually editing registry but worried about corrupting offsets and causing duplicates or gaps.
Question
What is the safest recovery path to restore continuous log shipping without creating duplicates or missing events? How can the registry be repaired or reconciled, and what preventive configuration changes reduce the risk of registry corruption after abrupt shutdowns?
Verified community troubleshooting
No answers yet..
Incident analysis
Most likely causes
Summary
Suggested Fixes
Continue troubleshooting
Related troubles
Matched from the title, description and tags