Blog Post

Azure Integration Services Blog
3 MIN READ

Retention in Logic Apps Standard - Including the retention of Storage Container Logs

Omar_Abu_Arisheh's avatar
Oct 26, 2022

Retention in Logic Apps Standard differs from Logic Apps Consumption.

There are two settings that should be configured for the retention job to work properly, and especially for the logs in the Storage Containers.

 

We create containers dynamically to store large action's inputs and outputs. These will get cleaned up based on run retention setting on the Logic App. Once the run retention time is reached, those containers will be deleted by the platform. You do not need to manually delete them. Limits and configuration reference guide - Azure Logic Apps | Microsoft Docs

 

Default retention period for Single-Tenant (Logic Apps Standard) is 90 days.

 

For the single-tenant service, you can decrease or increase the 90-day default limit. For more information, review Edit host and app settings for logic apps in single-tenant Azure Logic Apps. (This document will be updated to reflect the specific changes for Logic App Standard).

 

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.

 

Host.json

{

  "version": "2.0",

  "extensionBundle": {

    "id": "Microsoft.Azure.Functions.ExtensionBundle.Workflows",

    "version": "[1.*, 2.0.0)"

  },

   "extensions": {

     "workflow": {

        "settings": {

           "Runtime.FlowMaintenanceJob.RetentionCooldownInterval": "01.00:00:00",

           "Runtime.Backend.FlowRetentionThreshold": "05.00:00:00",

           "Runtime.Backend.FlowRunTimeout": "01.00:00:00"

        }

     }

   }

}

 

 

 

You should note that I observed during my testing that the retention job will only work if the Logic App is started, and the job will only process the retention for the workflows that are enabled.

 

Below is what is currently mentioned in the documentation, which will be updated to reflect the above changes.

 

Setting

Where to implement it?

Default value

Description

Doc

Workflows.<workflowName>.RuntimeConfiguration.RetentionInDays

local.settings.json

This can be done in App Settings

Edit runtime and environment settings for Standard logic apps - Azure Logic Apps | Microsoft Docs

None

Sets the operation options for <workflowName>.

Edit runtime and environment settings for Standard logic apps - Azure Logic Apps | Microsoft Docs

Runtime.FlowRetentionThreshold

host.json

This can be done on the host.json file, not on the app settings.

Edit runtime and environment settings for Standard logic apps - Azure Logic Apps | Microsoft Docs

90.00:00:00

(90 days)

Sets the amount of time to keep workflow run history after a run starts.

Edit runtime and environment settings for Standard logic apps - Azure Logic Apps | Microsoft Docs

 

I hope this helps 🙂

 

Published Oct 26, 2022
Version 1.0
No CommentsBe the first to comment