Skip to content

Cost optimisation in Azure Log Analytics and Azure Application Insights

How a detailed analysis and targeted measures in Azure Log Analytics and Application Insights led to measurable cost savings of around 70% for a client

How a detailed analysis and targeted measures in Azure Log Analytics and Application Insights led to measurable cost savings of around 70% for a client

Disclaimer

This case study is based on a real cost optimisation analysis for Azure Log Analytics and Azure Application Insights. For privacy reasons, all client names, resource names and specific identifiers have been anonymised. The data, analyses and optimisation measures presented nevertheless reflect the project’s actual circumstances and results.

Contents

Analysis of the existing environments

DEV environment

Log Analytics

  • Resource: dev-demo-analytics-log
  • Location: France Central
  • Price per GB: EUR 2.358 (as of 23 July 2025)

App Insights

  • Resource: dev-demo
  • Location: West Europe

Visual overview of a 90-day period

Volume in MB over 90 days Figure: The last 90 days for the 5 most important App Insights tables. The original Azure portal screenshots in this case study retain their German interface and labels.

Total number of events over 90 days:

PerformanceCountersTracesDependenciesRequestsMetrics
13.1 thousand12.5 thousand11.1 thousand2.39 thousand837

Usage sorted in ascending order:

UsageSize
AppPerformanceCounters13.13 GB
AppTraces12.45 GB
AppDependencies11.09 GB
AppEvents7.97 GB
AppRequests2.38 GB
AppMetrics0.84 GB
AppExceptions0.52 GB
Total48.38 GB
Price (EUR 2.358/GB)~EUR 114

Pie chart of data distribution by table Figure: Percentage distribution of the App Insights tables.

Tables that need optimisation:

  1. AppPerformanceCounters
  2. AppTraces
  3. AppDependencies
  4. AppEvents

Diagnostic settings

No settings present.

Assumption about when data reduction started

Suspected cost optimisation measure Figure: Timing of a suspected cost optimisation measure.

From 12 June, measures were taken to store less App Insights data. The Log Analytics daily cap may have been set to 1 GB/day to reduce data volume immediately.

Querying the Dependencies table over 90 days

// KQL query for the Dependencies table
dependencies
| where timestamp >= startofday(ago(90d))
| summarize sum(_BilledSize) by operation_Name
| render barchart

Figure: Extract of 1000 entries that are billed and incur costs.

EndpointBytesGB
POST Container/GetContainerToken22928372472.14
POST Api/GetCurrentToken11378569231.06
GET User/GetByToken3318783110.31
POST /connect/token1148223880.11
GET Api/ValidateToken828887760.08
GET User/GetByEmail354836890.03
POST User/GetByToken348204360.03
POST Tenant/GetRelations205241600.02
………

Figure: Grouped data extract of 1000 entries, with GB rounded to 2 decimal places.

Summary of the telemetry data

  1. Cost analysis of the API endpoints responsible for the highest data volumes and costs.
  2. Optimisation potential because frequent data collection for API endpoints such as POST Container/GetContainerToken is not always necessary and could be reduced. For development teams, however, it remains interesting and useful for analysing application behavior.
  3. A period limited to 90 days to inspect current data and identify trends in which API endpoints are called particularly often.
  4. Billing transparency because the KQL analysis aggregates with the _BilledSize filter. This is important for cost control and forecasting.

This detailed data analysis can support dashboards for continuous monitoring. Alerts can be configured when individual API endpoints produce unusually high traffic in a short period and therefore incur costs. It can also prompt code reviews to improve expensive API endpoints.

QA environment

Log Analytics

  • Resource: dev-demo-analytics-log
  • Location: France Central
  • Price per GB: EUR 2.358 (as of 23 July 2025)

App Insights

  • Resource: qa-demoapp1 and qa-demoapp2
  • Location: West Europe and Germany West Central

Visualisation over a 90-day period

Data collection over 90 days Figure: The last 90 days for the 5 most important App Insights tables in the QA environment.

Dashboard

Billable App Insights tables in GB Figure: Dashboard of billable App Insights tables sorted by GB.

Data extracted from the dashboard

SolutionTableIngestion volumePercentageBillable
LogManagementAppDependencies25.04 GB48.4%Billable
LogManagementAppPerformanceCounters10.57 GB20.5%Billable
LogManagementAppTraces6.68 GB12.9%Billable
LogManagementAppRequests5.78 GB11.2%Billable
LogManagementAppMetrics962.88 MB1.9%Billable

Cost calculation (price: EUR 2.358 per GB, as of 23 July 2025):

TableIngestion volumeVolume (GB)Cost (EUR)
AppDependencies25.04 GB25.0459.04
AppPerformanceCounters10.57 GB10.5724.92
AppTraces6.68 GB6.6815.75
AppRequests5.78 GB5.7813.63
AppMetrics962.88 MB0.9632.27
Total49.03115.61

Note: 962.88 MB = 0.963 GB (1 GB = 1024 MB).

Calculation: cost per table = volume (GB) multiplied by EUR 2.358.

Total cost = sum of all individual table costs.

Telemetry data over 90 days

TableTrendDaily ingestion
AppTraces (1)
2025-04-25Down19 MB
AppRequests (1)
2025-04-25Down5 MB
AppDependencies (20)
2025-05-06Down181 MB
2025-05-13Down181 MB
2025-07-07Down131 MB
2025-07-08Down122 MB
2025-07-09Down131 MB
2025-07-10Down131 MB
2025-07-11Down133 MB
2025-07-12Down132 MB
2025-07-13Down121 MB
2025-07-14Down130 MB
2025-07-15Down132 MB
2025-07-16Down134 MB
2025-07-17Down123 MB
2025-07-18Down112 MB
2025-07-19Down128 MB
2025-07-20Down125 MB
2025-07-21Down126 MB
2025-07-22Down132 MB
2025-07-23Down132 MB
2025-07-24Down124 MB
AppPerformanceCounters (1)
2025-07-24Down40 MB

Summary of the 90-day telemetry data

  1. A general “Down” trend is visible from beginning to end, indicating an overall decline in daily data ingestion.
    1. Less activity or application usage.
    2. Cost optimisation measures such as enabled sampling or SDK configuration.
  2. AppDependencies is notably high and regularly shows large data volumes that incur costs.
  3. Other tables are unremarkable and store relatively little data.

Findings from the DEV and QA environments

Optimise data ingestion

  1. Filter at the source using Data Collection Rules and table transformations to collect only relevant metrics and logs from App Insights and Log Analytics, including only necessary columns where appropriate. This reduces data volume, minimises stored data and lowers costs.
    1. Recommended action: yes.
  2. Enable sampling for App Insights to prevent unnecessarily large amounts of telemetry data being collected: Requests, Dependencies, Traces, PerformanceCounters and Metrics.
    1. Recommended actions:
      1. Enable sampling.
      2. Advanced sampling:
        1. Enable adaptive sampling for spikes through the SDK, not in the portal.
      3. Rule out duplicate data collection in code as an active measure.
      4. Adjust the host.json file when using Azure Functions:
        1. logging.applicationInsights.samplingSettings
        2. logging.logLevel
      5. Use the SDK and disable automatic data collection:
        1. Rename the InstrumentationKey or do not set it as a variable.
        2. Install and configure the SDK and control collection of genuinely business-critical data. This has the highest savings potential.
  3. In general, regularly check which applications or services store particularly large amounts of data and whether filtering or adjustments can reduce that volume further.
  4. Limit time intervals for different services such as dashboards, workbooks, Power BI reports, KQL queries in the Basic plan, DCRs and availability tests in Azure Monitor.
    1. No action required because there is no access to inspect these services, and no availability tests that could incur costs are active.

Log Analytics daily cap

Daily cap: This measure is currently active in DEV and QA at 1 GB/day.

Problem: As soon as Log Analytics reaches the storage limit of 1 GB/day, for example at 13:00, no further logs from any other services are stored. This includes services I currently cannot see due to permissions, such as Container Insights and Activity Logs. These data do not appear anywhere and are lost. All these services compete to store their data.

Consequence: Data loss can cause monitoring blind spots. Dashboard visualisations show data only up to a certain limit. Missing data in a measurement period can prevent alerts from firing correctly, even when the trend actually shows a critical increase and an alert would have been necessary.

Recommendation: Treat this only as a last option when data is sent to Log Analytics without control. A better option is enabling sampling, plus adaptive sampling through the SDK, in the individual services so that only a fraction of the data reaches Log Analytics. Where possible, use Data Collection Rules and table transformations as well, or instead, to filter data before it is stored in Log Analytics.

Data retention and recovery strategies

No change is currently necessary because the standard retention periods of 30 or 90 days are already configured for App Insights tables, and no longer retention period is required for compliance reasons.

Nevertheless, choosing the right table plan offers an opportunity to save costs:

  • Recommended action:
    • Identify tables that can move from “Analytics” to “Basic”. This offers moderate to high savings potential.

Table plan settings

The original table plan documentation describes the available plans.

The following table adds Azure Log Analytics prices for the France Central region.

FeaturesAnalyticsBasic
Best suited forHigh-value data for continuous monitoring, real-time detection and performance analysisMedium-importance data for troubleshooting and incident response
Supported table typesAll table typesAzure tables supporting Basic logs and DCR-based custom tables
Ingestion costEUR 2.358 per GBEUR 0.697 per GB
Interactive retention, maximum 2 yearsEUR 0.103 per GB/monthNo, fixed at 30 days
Long-term retention, up to 12 yearsEUR 0.028 per GB/monthEUR 0.028 per GB/month
KQL query priceIncludedNot included, EUR 0.00697 per GB of scanned data
Query capabilitiesFull query capabilitiesFull Kusto Query Language (KQL) on one table, extendable with data from an Analytics table using lookup
AlertsSupportedSupported, simple log alerts
Insights (Workbooks)SupportedNo visualisations
DashboardsSupportedSupported, query costs for dashboard refreshes are not included
Data exportEUR 0.140 per GBEUR 0.140 per GB
Search jobsEUR 0.00697 per GB of scanned dataEUR 0.00697 per GB of scanned data
KQLSupportedLimited to a single table
RestoreEUR 0.140 per GB per day (minimum 2 TB, 12 hours)EUR 0.140 per GB per day (minimum 2 TB, 12 hours)
Total retention periodUp to 12 yearsUp to 12 years

Summary of table plans

  • Analytics: For critical logs that need long-term, repeated analysis through complex queries.
  • Basic: For high log volumes with a short query window, meaning 30 days of interactive retention, and little or no need for cross-table analysis.

Identified App Insights tables

TablePlanRetentionSwitch to Basic possibleDCR
AppPerformanceCountersAnalytics90 days standardNoNot present
AppTracesAnalytics90 days standardYesNot present
AppDependenciesAnalytics90 days standardNoNot present
AppMetricsAnalytics90 days standardNoNot present

Important App Insights tables

TableMeaningStored informationCost optimisation recommendation
PerformanceCountersApplication performance indicatorsPerformance metrics such as CPU, RAM, disk and networkCollect only relevant metrics, use sampling and reduce retention
TracesApplication log messagesLogs, debug information, warnings and errorsAdjust log levels, filter unnecessary logs and use sampling
DependenciesApplication dependencies on external servicesCalls to external services, databases and APIsCapture only critical dependencies, use sampling and filters
MetricsCustom or standard metricsCustom events and interactionsCapture only critical dependencies, use sampling and filters

In summary:

These tables represent the different telemetry data App Insights collects to monitor and analyse application performance, reliability and usage in the DEV and QA environments.

Transformations with KQL

Moving individual table plans from “Analytics” to “Basic” can introduce additional costs for the data being analysed. It is therefore important to aggregate only the data necessary for each visualisation and analysis.

Cost management

  1. Maintain an ongoing view of both ingestion volume and the period covered by costs in Azure Cost Management to identify optimisation opportunities early.
  2. Configure budget limits and notifications to avoid cost overruns and react early.
AreaMeasuresGoal
Data ingestionDCR filters, reduced sampling rate, regular reviews, InsightsMinimise data ingestion
Data retentionAutomatic deletion, archiving, exports, flexible retentionReduce storage costs
TransformationsSelective collection, data filtering/aggregationLower costs, improve data quality
Cost managementCost monitoring, budgets/alerts, commitment tiers, workspace strategyTransparency, control and continuous optimisation

Optimise data ingestion

Goal: Reduce data volume at the source.

Recommendations:

  • Use Data Collection Rules and table transformations to filter relevant telemetry data.
  • Enable sampling in App Insights, including adaptive sampling through the SDK.
  • Avoid repeated data collection, for example duplicate SDK initialisation.
  • Optimise LogLevel in AppTraces: less Debug, more Warn/Error.

Analyse API endpoints and apply targeted filters

Goal: Reduce data costs by analysing high-frequency API endpoints.

Recommendations:

  • Automate KQL analyses, grouping by _BilledSize.
  • Review endpoints such as POST /GetContainerToken.
  • Provide regular feedback to development teams for targeted optimisation.

Evaluate and change table plans

Goal: Reduce storage costs through appropriate table plans.

Recommendations:

  • Move tables to the Basic plan.
    • Lower costs: EUR 0.697/GB instead of EUR 2.358/GB.
  • Keep the Analytics plan when cross-table queries and alerts are needed.

Daily caps only as a last resort

Goal: Avoid monitoring gaps.

Recommendations:

  • A daily cap of 1 GB/day is currently active, but should not be a permanent solution.
  • Risk: once the cap is reached, all further logs are discarded, which can cause blind spots.
  • A better solution combines sampling, adaptive SDK sampling and DCRs.

Cost management and transparency

Goal: Identify and control costs early.

Recommendations:

  • Set up Azure Cost Management alerts and budgets.
  • Create dashboards to monitor costs and volume.

Further optimisations

  • Disable the InstrumentationKey or fully configure the SDK.
  • Adjust time intervals, for example for dashboards.
  • Collect less data.
  • Store only relevant data.
  • Raise awareness within teams.
  • Adjust host.json in Azure Functions:
    • logging.applicationInsights.samplingSettings
    • logging.logLevel

Conclusion

The cost optimisation analysis for Azure Log Analytics and Azure Application Insights in the DEV and QA environments showed that targeted measures can deliver substantial cost savings.

Implementing Data Collection Rules and table transformations, enabling sampling methods and evaluating table plans significantly reduced ingestion and storage costs, resulting in estimated cost savings of around 70% for the client.

Related posts

What should your portal do?

Describe your workflow. Together, we will identify the right next step.

Discuss your workflow