Search for up to two years of data with OMS Log Analytics

Summary: Modify the retention value to save data for up to two years in Log Analytics.

Update: You can now change the retention period by using the Azure portal. Instructions and more information are available at Change how long Log Analytics stores data.

Good morning everyone, Richard Rundle here, and today I want to talk about how you can choose to keep your data for up to two years in Log Analytics.

Our paid pricing plans include 30 days of data retention, but you can now increase that retention to be up to 730 days (two years)!

We’re still in the process of building the user interface (UI) and adding support for setting this through PowerShell, but we know many of you are eager to keep your data for longer. This post shows how to use Azure Resource Explorer to make the change.

Change data retention

You need to be on the Standalone or OMS pricing plan to be able to change your retention. If you are on the Free pricing plan, your retention is fixed at 7 days. If you have a workspace created prior to October 1, your retention is fixed at 30 days if you are on the Standard plan, or 365 days if you are on the Premium plan.

To move from the default of 30 days retention to a longer retention, use the following steps:

  1. Open https://resources.azure.com and login with the credentials you use to login to portal.azure.com
  2. T expand subscriptions, click the + (plus) symbol in the left pane.

Expand subscriptions

  1. To expand the subscription click the +  symbol.
  2. To expand resourceGroups, click the +  symbol.
  3. Expand the resource group that contains your Log Analytics workspace. In the Azure portal, when you select your Log Analytics workspace, the properties page show you the name of the resource group.
  4. Expand Microsoft.OperationalInsights. If you don’t see Microsoft.OperationalInsights, there are no workspaces in this resource group. Refer to step 5 to find which resource group your workspace is in.
  5. Click the name of your workspace. If you don’t see your workspace, make sure that you selected the resource group. Refer to step 5 to find which resource group your workspace is in.

Finding your resource group

  1. To change to Read/Write mode, click Read/Write at the top of the page.
  2. To change to Edit mode, click the Edit button. The Get button will change its name to PUT, and the blue button will change to Cancel.
  3. To change the value for retentionInDays, select the text and typing a new value.

Changing the retentionInDays value

  1. Click the green PUT button to make the change.

The Put button

  1. Verify that new retention value is shown.

The new retention value

Troubleshooting

There are two errors that you might see.

The value provided for retention is invalid

This error means that you’ve tried to change the retention on a Free, Standard, or Premium plan. You can only change the retention if the plan is Standalone or OMS. (The OMS tier will show as “pernode” in the following  UI):

The "The value provided for retention is invalid" error

You can’t do this operation because you are in ‘Read Only’ mode.

This will occur if you skip Step 8.

The ) “You can’t do this operation because you are in ‘Read Only’ mode.” error

If you are creating a new workspace by using Azure Resource Manager templates, see Manage Log Analytics using Azure Resource Manager templates to learn how to specify the length of time that you’d like to retain data.

That is all I have for you today. I would like to hear any feedback you have.

Please feel free to send me an e-mail at Richard.Rundle@microsoft.com with questions, comments, and suggestions.

Richard Rundle
Microsoft Operations Management Team