Current Setup
The purging process is scheduled using the cron literal 0 22 * * SAT
, meaning it should run every Saturday at 22:00 UTC.
Log analysis
Querying the logs via:
https(s)://<host>/medic-sentinel/_all_docs?end_key="purgelog:"&start_key="purgelog:\ufff0"&descending=true
revealed the following details:
- Last failed purge:
"date": "2025-04-06T11:04:20.320Z"
{"id":"purgelog:error:1743937460320","key":"purgelog:error:1743937460320","value":{"rev":"1-af19dfd921471d31a906ff7a64e5fa3d"}}
- Last successful purge:
"date": "2025-05-11T08:27:22.916Z"
{"id":"purgelog:1746952042916","key":"purgelog:1746952042916","value":{"rev":"1-f4cb23014b0f09b458823205c1051e23"}}
Extract of the Last Successful Purge
2025-05-10T22:00:00.002 INFO: Running purging
2025-05-10T22:00:00.138 INFO: Purging: Starting contacts batch: key "", doc id "", batch size 1000
...
2025-05-11T08:27:22.910 INFO: Purging: Starting "targets" purge batch with id "target~2024-10~fe1de9e0-2a34-44bb-96e0-b1d559d4eb00~org.couchdb.user:korkagu"
2025-05-11T08:27:22.916 INFO: Purging completed in 627.38 minutes
Issues & Observations
After adding a new user role, the expected purge operation failed to trigger, preventing access to the related account.
Scheduled Purging Operation for 17/05
2025-05-17T22:00:00.001 INFO: Running purging
2025-05-17T22:00:00.111 INFO: Purging: Starting contacts batch: key "", doc id "", batch size 1000
...
2025-05-18T17:15:55.657 INFO: Purging: Starting contacts batch: key "c50_family", doc id "A3D161AC-16CC-A746-9B19-DC68B7443CA1", batch size 112
2025-05-18T17:17:10.845 ERROR: Error while running purging: FetchError: request to `<server>` failed, reason: socket hang up
2025-05-18T17:17:10.845 INFO: Purging failed after 1157.18 minutes
Despite the failure, the error was not logged in the basic query output, raising concerns about reliability.
Scheduled Purging for 24/05
2025-05-24T22:00:00.000 INFO: Running purging
2025-05-24T22:00:00.150 INFO: Purging: Starting contacts batch: key "", doc id "", batch size 1000
...
2025-05-26T05:29:11.792 INFO: Purging: Starting contacts batch: key "c50_family", doc id "b6db8eda-936b-47d8-b401-114a8a73ae0a", batch size 112
2025-05-26T05:36:38.406 INFO: Purging: Starting contacts batch: key "c50_family", doc id "b87b4158-7c09-43df-8c01-28efc2daf66b", batch size 112
Several logs like these appear, but it’s unclear if they are directly related to purge operations: :
INFO: Task purging started
INFO: Task purging completed
The end of purging operation is not mentionned, we don’t have error mention too.
Further Troubleshooting
To increase the chances of execution, the cron literal was modified to '0 22 * * MON'
. However, the purge did not run on Monday either. Logs showed no indication of execution.
Excepted log entries such as:
INFO: Task purging started
INFO: Task purging completed
But nothing related to actual purge execution.
So here are my questions
- How can we confirm that a purging operation has actually been triggered?
- Is there a way to receive notifications when a purge operation fails?
- How can we manually execute purge operations instead of waiting for a cron job to run after deployment?
- How to restart our purge process to make it properly work?