For Logic Apps Standard, you need to configure these two values:
1. In App Settings: Workflows.RuntimeConfiguration.RetentionInDays
This value is an Integer, I set it to 5 days here so the runs that are older than 5 days old will be deleted.
Based on your scenario you should select a value that matches your requirements.
2. In host.json: "Runtime.FlowMaintenanceJob.RetentionCooldownInterval": "1.00:00:00"
The internal cleanup job will run once every day. //Cleanup job iteration - here it will run once daily
How it works? We check if there is any old artifacts to delete every once in n days (configurable by above value). So, if we check for retention at time t, we will check for what to delete again at time t + n days. We do the retention through our maintenance job which runs every once a day. You can configure the cool down period for retention using the above configuration.
The value is in timestamp as above. I used 1 day, which means the Retention Job will run once every day.
You should also set the FlowRunTimeout value to be less than the RetentionInDays value, which means that the run can only last for 1 whole day, which is rarely used, but if you have really long running workflows you might need to set this to more than 1 day.
There is a parameter FlowRetentionThreshold, the docs mention it is required so I kept it for testing purposes but I don’t think it is needed. You can test without it and see if it works.