Log Analytics Workspace Retention Reporting Options (Part 2)
In my previous post I talked about using Postman to make a REST API call to a Log Analytics workspace to view and change the retention settings. Equally I mentioned that I would look to utilise an Azure Monitor workbook to visualise the settings.
Azure Monitor workbooks are a fantastic way to visualise data within a Log Analytics workspace and there are a number available in the Azure Portal.
Useful references
- Azure Monitor Workbook documentation
- Azure Log Analytics REST API reference
- Setting Data Retention by data type
- Azure Resource Graph
The workbook uses a combination of Azure Resource Graph (ARG) and the Log Analytics REST API to collect the required pieces of information that are needed, which is available from my repository on GitHub, where you will also find instructions on how to download and import it.
On importing the workbook, you will notice two dropdown pickers (as shown below), one which allows you to select the subscription where the Log Analytics workspace(s) are and the other is for what I refer to as the Report Option.
Use the Subscription dropdown picker to select the appropriate subscription, which will use Azure Resource Graph (ARG) to retrieve all the workspaces that exist in that subscription and the results are presented in a table as shown below:
The Report Option picker gives you two choices:
- Full List – where the REST API call returns the Data Retention settings for all tables
- View by Table – where you choose or search for a particular table and its associated Data Retention setting
NOTE: The Report Option is dependent on you having selected a particular workspace which is displayed in a table above as this exports some values into parameters that are used by the API queries.
So, here are some screenshots showing the results of both of those options:
Full List view
You will note that I have highlighted a couple of tables in the Full List report option that I changed as part of my previous post.
View by Table
You see the picker allows you to scroll through the list of available tables or you can do a text search. Once you have chosen a table the result will be presented to the right of the dropdown.
I will look at making some enhancements to this workbook in the future.
Thanks Paul