History cleanup not triggered

Hi I have below configuration in process xml

<?xml version="1.0" encoding="UTF-8"?>
<process-application xmlns="http://www.camunda.org/schema/1.0/ProcessApplication">
  <process-archive tenantId="maestro" name="Uplift Process Application">
    <process-engine>default</process-engine>
    <properties>
      <property name="isDeleteUponUndeploy">false</property>
      <property name="isScanForProcessDefinitions">true</property>
      <property name="isDeployChangedOnly">true</property>
      <property name="historyCleanupBatchWindowStartTime">01:00</property>
      <property name="historyCleanupBatchWindowEndTime">03:00</property>
      <property name="historyCleanupStrategy">endTimeBased</property>
    </properties>
  </process-archive>
</process-application>

And I have cleable data as well
select count(*) from ACT_HI_PROCINST where END_TIME_ < sysdate and REMOVAL_TIME_ < sysdate;
return me 9 rows.

622198,622198,Ekant test cleanup,BWSContractContentOnboarding,BWSContractContentOnboarding:2:621590,2023-07-18 11:57:53.765000,2023-07-18 11:57:56.066000,2023-07-19 11:57:56.066000,2301,admin,Event_1epfw93,MaestroProcessEndEvent,,622198,,,,oce,COMPLETED
622216,622216,Ekant test cleanup,CCOBWS,CCOBWS:2:621829,2023-07-18 11:57:53.811000,2023-07-18 11:57:55.986000,2023-07-19 11:57:56.066000,2175,admin,Event_0d9sp0e,Event_0ko6316,622198,622198,,,,maestro,COMPLETED
622235,622235,Ekant test cleanup,MapperExecutor,MapperExecutor:3:621815,2023-07-18 11:57:54.089000,2023-07-18 11:57:55.747000,2023-07-19 11:57:56.066000,1658,,Event_0gtbxlk,Event_1btl21a,622216,622198,,,,maestro,COMPLETED
622276,622276,Ekant test cleanup,CCO,CCO:2:621831,2023-07-18 11:57:55.794000,2023-07-18 11:57:55.854000,2023-07-19 11:57:56.066000,60,,Event_0o8nloo,,622216,622198,,,Cancel scope activity Activity(Event_1jljqap) executed.,maestro,INTERNALLY_TERMINATED
622566,622566,Ekant test cleanup,MapperExecutor,MapperExecutor:3:621815,2023-07-18 11:58:09.674000,2023-07-18 11:58:09.870000,2023-07-19 11:58:10.508000,196,,Event_0gtbxlk,Event_1btl21a,622536,622519,,,,maestro,COMPLETED
622626,622626,Ekant test cleanup,GetInstallBase,GetInstallBase:3:621693,2023-07-18 11:58:09.919000,2023-07-18 11:58:10.404000,2023-07-19 11:58:10.508000,485,,Event_080fajy,,622536,622519,,,Cancel scope activity Activity(Event_1ryvx6k) executed.,maestro,INTERNALLY_TERMINATED
622651,622651,Ekant test cleanup,InterfaceExecutor,InterfaceExecutor:3:621782,2023-07-18 11:58:09.924000,2023-07-18 11:58:10.400000,2023-07-19 11:58:10.508000,476,,Event_06h1uta,,622626,622519,,,Cancel scope activity Activity(Event_1ryvx6k) executed.,maestro,INTERNALLY_TERMINATED
622519,622519,Ekant test cleanup,EnsureBaseContractSigning,EnsureBaseContractSigning:2:621592,2023-07-18 11:58:09.434000,2023-07-18 11:58:10.508000,2023-07-19 11:58:10.508000,1074,admin,StartEvent_1,MaestroProcessEndEvent,,622519,,,,oce,COMPLETED
622536,622536,Ekant test cleanup,EnsureBaseContractSigningMaestro,EnsureBaseContractSigningMaestro:2:621687,2023-07-18 11:58:09.443000,2023-07-18 11:58:10.435000,2023-07-19 11:58:10.508000,992,admin,StartEvent_1,Event_1636kvr,622519,622519,,,,maestro,COMPLETED

Hello @Ekant_Sharma ,

why do you use endTimeBased as removal strategy?

Did you configure a history time to live for the processes?

Jonathan

Hi @jonathan.lukas I want to delete instances when they are in completed or Terminated status.
I expect it to be deleted after End time + Time to live configured .
Yes I configured time to live. I think that’s why we see removal time set in the query result.

Hello @Ekant_Sharma ,

i can recommend to use removalTimeBased (which is default) .

Jonathan

@jonathan.lukas After removing historyCleanupStrategy still not triggered. :frowning:

Hello @Ekant_Sharma ,

the history cleanup schedule is not configured to the process-application rather than the process-engine.

Jonathan

@jonathan.lukas How do we configure the history cleanup schedule for process engine?

Hello @Ekant_Sharma ,

this depends on your distribution.

Which one are you using? Tomcat, Wildfly, Run, Spring Boot?

Jonathan

Hi @jonathan.lukas I am using Spring boot.

Hello @Ekant_Sharma ,

in this case, you will have to set the properties under

camunda.bpm.generic-properties.properties

as described in the docs:

Jonathan

Hi @jonathan.lukas I tried having below props still no luck

camunda:
  bpm:
    generic-properties:
      properties:
      	historyCleanupBatchWindowStartTime: "11:00"
        historyCleanupBatchWindowEndTime: "22:00"
        historyCleanupJobLogTimeToLive: P365D

Hello @Ekant_Sharma ,

did history cleanup batches run and remove nothing?

Or did they not run at all?

Jonathan

Hi @jonathan.lukas Looks like doesn’t trigger at all as I had cleanable process instances.
To make sure I triggered the cleanup manually from camunda admin ui and it cleaned all those instances.

Hello @Ekant_Sharma ,

to review your config, you can hit this endpoint: Camunda Platform REST API

If this configurations seems correct, please check the executed jobs: Camunda Platform REST API

These jobs can then inspected using the job log: Camunda Platform REST API

Here, you have to search for ?jobId={IdOfYourJob}.

Does the job log show something?

Jonathan

Hi @jonathan.lukas I see only one job that I triggered manually nothing else. which is below :

[
    {
        "id": "644652",
        "jobDefinitionId": null,
        "processInstanceId": null,
        "processDefinitionId": null,
        "processDefinitionKey": null,
        "executionId": null,
        "exceptionMessage": null,
        "failedActivityId": null,
        "retries": 3,
        "dueDate": null,
        "suspended": true,
        "priority": 0,
        "tenantId": null,
        "createTime": "2023-08-02T12:29:32.935+0200"
    }
]

I get [] reponse when I get this history job log.

Hello @Ekant_Sharma ,

what do the other endpoints return?

Jonathan

@jonathan.lukas Second one returned empty array with the job id returned with history/job-log?jobId=644652
[]

Hello @Ekant_Sharma ,

the second one should be executed unfiltered. Please execute the queries in the order I listed them and post the results.

Jonathan

hi @jonathan.lukas Thanks for looking into it Below are responses(this job you see in response I triggered manually from camunda admin ui) :

{
    "id": "644652",
    "jobDefinitionId": null,
    "processInstanceId": null,
    "processDefinitionId": null,
    "processDefinitionKey": null,
    "executionId": null,
    "exceptionMessage": null,
    "failedActivityId": null,
    "retries": 3,
    "dueDate": null,
    "suspended": true,
    "priority": 0,
    "tenantId": null,
    "createTime": "2023-08-02T12:29:32.935+0200"
}

[
    {
        "id": "644652",
        "jobDefinitionId": null,
        "processInstanceId": null,
        "processDefinitionId": null,
        "processDefinitionKey": null,
        "executionId": null,
        "exceptionMessage": null,
        "failedActivityId": null,
        "retries": 3,
        "dueDate": null,
        "suspended": true,
        "priority": 0,
        "tenantId": null,
        "createTime": "2023-08-02T12:29:32.935+0200"
    }
]

[]

Hello @Ekant_Sharma ,

what about the first one: /history/cleanup/configuration?

Jonathan