Skip to main content
emnode
Monitoring

Control Log Analytics ingestion and retention costs

One capability across every workspace: keep ingestion to the data you actually use to run and observe the estate, retain it only as long as it earns its keep, and put a safety net under unexpected spikes, all without going blind to what your services are doing.

14 min·10 sections·AZURE

Last reviewed

Log Analytics cost control: the basics

Why does an observability bill quietly become one of the largest lines in a subscription?

Azure Monitor charges you mainly for one thing: the volume of data ingested into a Log Analytics workspace, billed per gigabyte, plus a smaller charge for retaining that data beyond the included period. Almost everything else, the queries you run, the dashboards, activity log alerts, follows from how much you collect and how long you keep it. So the cost of observing your estate is set less by how many resources you monitor and more by how much each of them is told to send, and for how long the workspace holds it.

The volume creeps up in ordinary ways. A diagnostic setting is created with every log category ticked rather than the few you query. A new fleet of virtual machines is onboarded with verbose performance counters polling every fifteen seconds. A chatty application starts emitting traces at full fidelity. A table that is only ever queried during an incident is kept in the Analytics plan, paying the full ingestion rate, when it could sit in the cheaper Basic plan. None of these is a mistake exactly; each is a default that was never tuned. Microsoft's own guidance is blunt that the primary lever is to collect no more data than you require to assess the health and performance of your services.

The work, then, is not to monitor less. It is to make the ingestion deliberate: see what each workspace is collecting and from where, drop the categories nobody queries, move infrequently queried tables to Basic Logs, set retention to match how long the data is genuinely useful, and put a daily cap and an anomaly alert underneath as a safety net so a runaway source cannot quietly double the bill. The aim is full visibility of what your services are doing at a cost you chose on purpose.

In this lesson you will learn what actually drives an Azure Monitor bill, how to see what each Log Analytics workspace is ingesting and from where, and how to bring the cost down deliberately without losing the visibility that shortens an outage. You will use Log Analytics workspace insights and the Usage table to find the heavy sources, move incident-only tables to the Basic plan, tune retention, and put an anomaly alert and a daily cap underneath as a safety net rather than a cost strategy.

Fun fact

The daily cap that blinded the on-call

Microsoft's own documentation carries an unusually pointed warning about the Log Analytics daily cap: do not use it as your primary way to control cost. The reason is that when the cap is hit, data collection simply stops for the rest of the day, and as the docs put it, you are then 'effectively blind to the current state of your monitored environment.' Teams have learned this the hard way by setting an aggressive cap to save money, only for a busy afternoon to trip it and leave the on-call engineer with no fresh logs precisely when an incident was unfolding. The cap is a circuit breaker for runaway spend, not a budget knob, which is why Microsoft tells you to also alert at ninety per cent so a human can intervene before the lights go out.

Finding what a workspace is really ingesting

Priya runs the platform team at a growing SaaS company. The monthly Azure bill has crept up for three months straight, and the largest single mover is the Log Analytics workspace. Nobody has changed the monitoring on purpose, so something is quietly sending more than it used to.

Rather than reach for the daily cap to stop the bleeding, Priya starts by asking the workspace what it is actually collecting. The Usage table records billable volume per table, which is exactly where the waste, and the must-keep data, will show up.

Run a Usage query against the workspace to rank tables by billable gigabytes over the last month. The heaviest tables are where both the waste and the savings live.

$ az monitor log-analytics query \ --workspace "$WORKSPACE_ID" \ --analytics-query 'Usage | where TimeGenerated > ago(30d) | where IsBillable | summarize GB = sum(Quantity)/1000 by DataType | top 5 by GB desc' \ -o table
DataType GB
------------------ ------
ContainerLogV2 412.6
Perf 188.3
AppTraces 96.1
AzureDiagnostics 71.4
# ContainerLogV2 is over 400 GB and only queried during incidents: a Basic-plan candidate.

The Usage table ranks billable volume per table. The heaviest table that you only read during incidents is the first candidate to move to the cheaper Basic plan, not to delete.

How Azure Monitor decides what you paydeep dive

Three workspace mechanics set almost the entire bill. The first is ingestion volume: every gigabyte written to an Analytics-plan table is billed at the pay-as-you-go rate, and the data size that counts is measured after any ingestion-time transformation, which is why Microsoft points to data collection rule transformations, not the daily cap, as the right way to actually reduce volume. The second is the table plan: a table can sit in the Analytics plan with full query and alerting features, in the Basic plan with a much lower ingestion charge but limited features and a per-query search cost, or in the Auxiliary plan for high-volume, rarely queried data. The third is retention: data is included for a default of thirty days in a workspace, or ninety days if Microsoft Sentinel is enabled, and you pay to keep it longer, with long-term retention available far more cheaply than interactive retention because you only occasionally search or restore it.

On top of those, two pricing structures change the per-gigabyte rate itself. Commitment tiers let you commit to a daily ingestion volume in exchange for a lower rate than pay-as-you-go, which is worth it once your steady-state volume is high enough; Microsoft's Usage and estimated costs view models your spend at each tier so the decision is evidence-based rather than a guess. The daily cap is the opposite kind of control: it does not lower a rate, it stops billable collection for Analytics and Basic tables once a gigabyte threshold is hit for the day, resuming at a per-workspace reset hour you cannot configure. Auxiliary-plan tables are not subject to the cap, and the cap cannot stop collection at exactly the threshold, so some excess is expected and still billed.

The way these combine is the whole game. Azure Advisor watches your workspaces and raises specific cost recommendations against these same levers, with exact names worth recognising: 'Consider configuring the low-cost Basic logs plan on selected tables' when a table over a gigabyte a month is eligible, 'Consider changing pricing tier' when your volume would be cheaper on a commitment tier, 'Consider removing unused restored tables' when restored data is sitting idle, and 'Data ingestion anomaly was detected' when this week's rate jumps against the previous three. Acting on those is the difference between a bill you read after the fact and one you steer.

What is the impact of leaving ingestion untuned?

The first impact is a bill that grows on its own. Because Azure Monitor charges by volume and retention, every untuned diagnostic setting, every verbose agent, every chatty application adds to the run rate continuously, and a single new workload onboarded on defaults can move the line materially before anyone notices. Left alone, observability quietly becomes one of the larger items in a subscription, and the growth is invisible until the invoice arrives.

The second impact is the opposite and easy to miss: visibility you are paying for but cannot use. When a workspace ingests far more than the team queries, the signal that matters in an incident is buried in noise, dashboards slow down, and the cost of every query rises. Paradoxically, collecting everything can make you slower to find the one thing that is wrong, which lengthens mean-time-to-detect and mean-time-to-resolve, the very metrics the monitoring exists to improve.

The third impact is the failure mode of over-correcting. A team that reacts to the bill by setting an aggressive daily cap, or by deleting tables wholesale, can blind itself. When the cap trips, collection stops and the on-call has no fresh data; when a table that turns out to matter has been dropped, the next incident takes longer to diagnose. The cost of flying blind during an outage, longer downtime, a slower root-cause, a worse customer impact, dwarfs the few gigabytes saved. The discipline is to tune deliberately: remove what nobody uses, reprice what is only read occasionally, and keep what shortens an outage, with the cap as a backstop you hope never to hit.

How do you bring the cost down without going blind?

Work the capability as one loop rather than reaching for the cap. The order matters: understand what you collect before you change anything, so you remove noise rather than the data an engineer needs in an incident.

1. See what each workspace ingests, and from where

Use Log Analytics workspace insights and the Usage table to rank tables by billable gigabytes and identify your heaviest sources. This is the source of truth, not the invoice total, because it tells you which table is driving the cost and whether anyone actually queries it. Re-run it after any new fleet or service is onboarded, since that is when defaults add the most volume.

2. Remove what nobody uses, reprice what is read rarely

Trim diagnostic settings to the log categories you query rather than ticking every box, and apply data collection rule transformations to drop unneeded rows before ingestion, which is the only mechanism that genuinely lowers volume. Move tables that you only read during incidents and never alert on, such as verbose container or trace logs, to the Basic plan for a much lower ingestion rate.

3. Match retention to usefulness, and right-size the tier

Set workspace and per-table retention to how long the data is genuinely useful interactively, and push older data to cheaper long-term retention rather than paying interactive rates to hold it. Where steady-state volume is high, use the Usage and estimated costs view to check whether a commitment tier beats pay-as-you-go, and act on the matching Azure Advisor recommendation.

4. Put a safety net underneath, not a budget knob

Turn on the 'Data ingestion anomaly was detected' Advisor alert and a log alert at ninety per cent of any daily cap, so a human sees a spike before collection stops. Only then set a daily cap, sized above normal peak, as a circuit breaker for runaway spend. Treat hitting the cap as an incident, because it means you have gone blind, not as a success.

# 1. Reprice an incident-only table to the cheaper Basic plan (lower ingestion rate).
az monitor log-analytics workspace table update \
  --resource-group "$RG" \
  --workspace-name "$WORKSPACE" \
  --name ContainerLogV2 \
  --plan Basic

# 2. Trim interactive retention to how long the data is genuinely useful (days).
#    --quota sets the daily cap in GB; min 0.023, -1 means unlimited (no cap).
az monitor log-analytics workspace update \
  --resource-group "$RG" \
  --workspace-name "$WORKSPACE" \
  --retention-time 30 \
  --quota 150

# 3. Backstop: alert when the daily cap is reached, so the on-call is warned, not surprised.
az monitor scheduled-query create \
  --resource-group "$RG" \
  --name "daily-cap-reached" \
  --scopes "$WORKSPACE_ID" \
  --condition "count 'Placeholder_1' > 0" \
  --condition-query Placeholder_1="_LogOperation | where Category =~ 'Ingestion' | where Detail has 'OverQuota'" \
  --description "Log Analytics daily cap reached: ingestion has stopped for the day" \
  --severity 2

Quick quiz

Question 1 of 5

The Log Analytics line on the bill has risen for three months. What is the right first move?

You can now treat Log Analytics cost as one capability rather than a number to squeeze: see what each workspace ingests and from where, remove what nobody queries, reprice incident-only tables to the Basic plan, match retention to usefulness, and put an anomaly alert and a daily cap underneath as a safety net rather than a strategy. The result is full visibility into the state of your estate at a cost you chose on purpose, with mean-time-to-detect and mean-time-to-resolve protected rather than sacrificed.

Back to the library