Storge Account - Life Cycle Management

Santhi Dhanuskodi 325 Reputation points
2024-10-01T06:57:06.77+00:00

Hi,

I want to add a rule to remove blobs which are more than 30 days old in a storage container.

My files are present in <cotnainername>/Backup/<Datetime>/files.csv......

I want to remove only files under this backup folder. I dont want to delete anything other than this backup folder.

How I can create a rule? How do I check if a rule has been run and its logs?

I saw event subscription, but it is asking to add the event logs into someother azure resources.

Should I then purchase any of these services and manage them? Is there an inbuilt logs within storage account that we can see? If there is a failure of rule, how do we go about it?

User's image

Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
3,220 questions
{count} votes

Accepted answer
  1. Sumarigo-MSFT 47,021 Reputation points Microsoft Employee
    2024-10-01T11:20:11.83+00:00

    @Santhi Dhanuskodi Welcome to Microsoft Q&A Forum, Thank you for posting your query here!

    As I assume you need to you have apply policy only for "Backup" folder which is under container and policies should not scan/apply for other folder inside backup folder i.e Datetime am I correct?

    <cotnainername>/Backup/<Datetime>/files.csv......
    User's image

    Note : We do not have features to exclude few folders that are inside backup fokder

    I want to remove only files under this backup folder. I dont want to delete anything other than this backup folder. This option isn't possible for now.

    Configure a lifecycle management policy

    Question: How I can create a rule? How do I check if a rule has been run and its logs?
    Azure Blob Storage frequently asked questions : This article provides a list of frequently asked questions (FAQ) for Azure Blob Storage |Lifecycle management policies

    To check if a blob lifecycle management policy has been applied, navigate to your Azure storage account in the portal, go to "Data management" then "Lifecycle Management", where you can view the list of configured rules and their status; you can also monitor policy execution by checking the storage account's metrics and logs to see if blobs are being transitioned or deleted according to the policy rules.

    There is a similar thread discussion : How to check Life Cycle management rules actions : https://learn.microsoft.com/en-us/answers/questions/1299568/how-to-check-life-cycle-management-rules-actions
    User's image

    Question : I saw event subscription, but it is asking to add the event logs into someother azure resources.
    The LifecyclePolicyCompleted event is generated when the actions defined by a lifecycle management policy are performed. Refer - Optimize costs by automatically managing the data lifecycle - Azure Blob Storage | Microsoft Learn

    •  This article shares steps to subscribe to these events and help you track how much data moved, deleted or archived. 
    • How to view deleted files of Azure Storage Lifecycle management? : https://stackoverflow.com/questions/68541332/how-to-view-deleted-files-of-azure-storage-lifecycle-management
    • The blog talks about how you can leverage the existing metrics and diagnostic logging to monitor or track the execution of lifecycle management policies.  Monitoring Life Cycle Management Policy Runs
    • You don't necessarily need to purchase additional services to manage logs. Azure Blob Storage has inbuilt logging capabilities. You can enable diagnostic settings for your storage account and save the logs to the Log Analytics Workspaces on Azure. The logs are saved in a blob container named $logs in your storage account.
      Enable and manage Azure Storage Analytics logs (classic)
    • You don't necessarily need to purchase additional services to manage logs. Azure Blob Storage has inbuilt logging capabilities. You can enable diagnostic settings for your storage account and save the logs to the Log Analytics Workspaces on Azure. The logs are saved in a blob container named$logsin your storage account, Refer to more information here
    • If a rule fails, you can review the Azure Blob Storage logs and check for any error messages. Ensure that the lifecycle rule is properly applied to the storage account and that the storage account has the necessary permissions to perform the specified actions. Subscribe to Azure Storage Blob Lifecycle Policy Events
    • To know how many files are deleted and their names, you can subscribe to the LifecyclePolicyCompleted event, which provides details about the data moved, deleted, or archived
    • By default, you can log to Azure diagnostics by enabling the diagnostic setting for your storage account and saving the logs to the Log Analytics Workspaces

    Additional information :

    Rule actions: Actions are applied to the filtered blobs when the run condition is met. Lifecycle management supports tiering and deletion of current versions, previous versions, and blob snapshots. Define at least one action for each rule.

    Note: If you define more than one action on the same blob, lifecycle management applies the least expensive action to the blob. For example, action delete is cheaper than action tierToArchive. Action tierToArchive is cheaper than action tierToCool.
    Lifecycle policy runs: When you configure or edit a lifecycle policy., it can take up to 24 hours for changes to go into effect and for the first execution to start. The time taken for policy actions to complete depends on the number of blobs evaluated and operated on. For more information refer to this article.

    Is there a way to identify the time at which the policy will be executing?

    Unfortunately, there's no way to track the time at which the policy will be executing, as it's a background scheduling process. However, the platform will run the policy once per day.

    Please let us know if you have any further queries. I’m happy to assist you further.   


    Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.