Logic App Costs

clouddataquest 91 Reputation points
2023-04-18T12:37:34.7033333+00:00

Hello, i just saw my last Logic App which only moves some files from one path to another got like 35mio total billable executions(sum) in 30 days... The problem: it lists all files in a folder and then it makes the condition which only wants files with the ending .txt for example but it counts every run all the files listet, as an execution. But there will always be the same files which i dont care in the folder and they will always be count as billable executions... to you have an idea how to avoid this thank you

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
2,996 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Andrew Blumhardt 9,776 Reputation points Microsoft Employee
    2023-04-18T13:46:10.4333333+00:00

    Maybe look at the related API documentation if you are using a connector\activity. The API is usually more capable. There may be another filter option. That or try some other way to isolate those files first.

    0 comments No comments

  2. MayankBargali-MSFT 70,016 Reputation points
    2023-04-19T14:14:43.6366667+00:00

    @clouddataquest Thanks for reaching out. Can you please confirm which connector and action you are using?

    In nutshell if you are only interested in the newly files added/modified then most of the connector would have the option to trigger your logic app only for the new files so changing the trigger should help you in case if the this is supported by the connector and feasible for you.

    In case if you cannot use the trigger only for the new file created and assuming you are using File System connector. To avoid this issue assuming file connector, you can modify your Logic App to only list the files that have been added or modified since the last time the Logic App ran. You can use the "List files (properties only)" action in the "File System" connector to retrieve the properties of the files in the folder, including the "Last Modified" timestamp. You can then store the timestamp of the most recently modified file in a variable or in a storage account.

    The next time the Logic App runs, you can retrieve the timestamp of the most recently modified file from the variable or storage account and use it as a filter in the "List files (properties only)" action. This will ensure that the Logic App only lists the files that have been added or modified since the last time it ran. By doing this, you can reduce the number of billable executions and optimize the performance of your Logic App. Let me know if you have any queries or concerns.

    0 comments No comments

  3. Sonny Gillissen 3,351 Reputation points
    2023-04-23T20:13:04.6066667+00:00

    Hi clouddataquest Thank you for reaching out on Microsoft Q&A! If I understand you correctly you want to trigger only on txt-files, am I correct? When this indeed is the case you could use the “Conditions” section of your trigger making your trigger fire depending on the type of input. You could check, for example, if the file ends with .txt using the code below: endsWith(triggerBody()['{FileName}'],'.txt') Please click “Accept answer” if you find this helpful. Feel free to drop additional queries in the comments below.

    0 comments No comments