Azure Logs – How to Automate Sending Logs to Azure Storage Account

azureazure-resource-managerazure-storage

Hi Does anyone know a way to automate sending logs to a storage account, I can send the data to log analytics workspace, but also need to have a policy set that keeps logs for 200 days in a storage account?

Thanks in advance.

Best Answer

There isn't a built in way to export data from Log Analytics to a storage account, so if you want to do this you are going to need to run a script on regular basis to export the data. You could look at using an Azure Function or Azure Automation job to do this. There are a number of examples online about how to do this.

The two other options you have are:

  1. Increase the retention of your LA workspace - yes this will be more expensive than storage, but you will need to balance that against the additional cost of the automation or function to do this, and managing it
  2. Configure export to storage at the resource level. This could be done with an Azure policy. You could create a policy that configures both Log Analytics and Storage as a destination for the logs.