Logstash Persistent Queue disk exhaustion and automatic purging triggers
0 reputation · 23 Sept 2025, 23:14 UTC
0 reputation · 23 Sept 2025, 23:14 UTC
Logstash Persistent Queues (PQ) utilize disk-based buffering via memory-mapped files to ensure data durability across pipeline restarts. This mechanism allows the system to buffer events on disk to prevent data loss during crashes or unexpected shutdowns.
When the queue.max_size limit is reached, Logstash typically manages flow via backpressure. However, there is uncertainty regarding the behavior when the underlying filesystem becomes physically exhausted, specifically whether the pipeline can automatically recover by purging segments or if the .sqs directory requires manual cleanup to resume operations.
What specific conditions trigger an automatic cleanup of Persistent Queue files when disk space is critical? Does Logstash prioritize pipeline availability over data retention when new segment files cannot be written to disk?
34775 reputation · 24 Sept 2025, 01:45 UTC
Logstash does **not** automatically delete or purge Persistent Queue (.sqs) files when the underlying filesystem runs out of space. The only automatic cleanup occurs when a queue segment (page) has been fully acknowledged by downstream outputs; at that point the segment file is removed. If a new segment cannot be written because of ENOSPC (no space left on device) or because queue.max_size is reached, Logstash applies backpressure and stops reading from inputs instead of dropping data.
path.queue/.sqs.Because the queue is designed for durability, Logstash prefers to stall the pipeline rather than risk losing unacknowledged events. If downstream consumers continue to acknowledge, already‑processed pages are removed automatically, which can free space once the filesystem becomes writable again.
no space left on device or ENOSPC messages around path.queue/.sqs writes.path.queue (delete unrelated files, expand volume, etc.).path.queue/.sqs. Only delete files that you have confirmed are fully acknowledged (e.g., by checking the .sincedb checkpoint or by ensuring downstream has processed all events). Removing unacknowledged pages will cause data loss.To decide whether you need to free disk space or simply adjust queue.max_size/input rate, confirm whether the Logstash error is ENOSPC (filesystem full) or a backpressure message due to queue.max_size being reached. This detail changes the remedy: a pure queue‑size limit may be resolved by raising the limit or throttling inputs, whereas a true filesystem exhaustion requires space reclamation.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.