the perfect setup to clean up old process instances from the history is:
- Add the history time to live in the BPMN model. All process instances starting with this model version will have a removal time once they are finished.
- Set the history time to live for older versions in the Cockpit (with Enterprise version, Cleanup View | docs.camunda.org) or with the Rest API. All new process instances started after the change from this version will have a removal time once they are finished.
- Handle process instances that are started before you setup the history time to live. Here the removal time has to be set via batch.
You can check with this REST call, how many process instances will be cleaned in the run: Get Cleanable Process Instance Report Count | docs.camunda.org
And with this REST Api you can check how many process instances have be cleaned up in a given interval. Use history-cleanup-removed-process-instances
as the metrics name: Get Metrics in Interval | docs.camunda.org
Hope this helps, Ingo