Log Analytics Retention Query

Piyush Solanki 0 Reputation points
2026-07-16T10:19:57.11+00:00

I am working for optimising log analytics workspace , but I am stuck in calculating the amount of money that can be saved if I change the retention period if it is above the free window provided by azure.
For example I have a log analytics workspace with retention set to 365 days and Azure provide me 90 days for free retention only ingestion cost comes , But Now if I have set the retention to 365 days then I will have to incur cost of 275 days for retention , so i change it again to 90 days then how can i calculate the potential savings that i will have , i want exact money amount.
Also How can i see the amount of the data retained in GB ?

Cost Management
Cost Management

A Microsoft offering that enables tracking of cloud usage and expenditures for Azure and other cloud providers.


1 answer

Sort by: Most helpful
  1. Jose Benjamin Solis Nolasco 10,891 Reputation points Volunteer Moderator
    2026-07-16T11:28:37.4466667+00:00

    Welcome to Microsoft Q&AHello @Piyush Solanki I hope you are doing well.

    The savings cannot be calculated directly from the retention setting alone because Microsoft charges for retained data based on the average volume of data retained beyond the included retention period, not simply by multiplying the current storage by the number of days.

    To estimate your potential savings, you should first determine how much data is being retained beyond the included retention period.

    1. Check your current retention settings

    In your Log Analytics workspace:

    Log Analytics Workspace > Usage and estimated costs

    Log Analytics Workspace > Properties

    These pages show your current retention period and daily ingestion volume.

    2. Estimate the retained data

    If your workspace ingests approximately X GB/day, then the billable retained data is roughly:

    Billable retention (GB) =

    Daily ingestion (GB/day) × (Configured retention - Included retention)

    For example:

    Daily ingestion: 10 GB/day

    Retention: 365 days

    Included retention: 90 days

    Then:

    10 × (365 - 90) = 2,750 GB

    This is the approximate volume subject to long-term retention charges.

    3. Calculate the savings

    If you reduce retention from 365 days to 90 days, the retained data beyond the included period becomes 0 GB, so your monthly savings would be approximately:

    Billable retained GB × Azure retention price per GB-month

    The exact amount depends on your region and pricing tier. You can obtain the current rate using the Azure Pricing Calculator.

    1. View how much data is stored

    To understand your ingestion patterns, you can run the following KQL query:

    Usage

    | summarize TotalGB = sum(Quantity) by bin(TimeGenerated, 1d)

    | order by TimeGenerated desc

    • Or review Usage and estimated costs, which provides daily ingestion trends directly in the Azure portal.

    Note: Log Analytics does not expose a single metric showing the exact number of GB currently retained for billing purposes. Retention charges are calculated by Azure based on retained data over time, so the closest estimate is derived from your daily ingestion rate and configured retention period.

    References:

    Azure Monitor Logs pricing:

    https://learn.microsoft.com/azure/azure-monitor/logs/cost-logs

    Manage Log Analytics workspace retention:

    https://learn.microsoft.com/azure/azure-monitor/logs/data-retention-configure

    Azure Pricing Calculator:

    https://azure.microsoft.com/pricing/calculator/

    If my answer helped you, please consider marking it as accepted. This helps others in the community find similar solutions.

    Was this answer helpful?


Your answer

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