Data Retention Settings

Earn 25 points (50 with Pro) in two steps

  1. ① Read through the lesson — each section gets a ✓ as you scroll through it.
  2. ② When every section has a ✓, tap Complete lesson.

0 of 10 read · keep scrolling

✦ See fewer ads and earn double points — 50 a lesson instead of 25 — with Pro

Configuring Data Retention in Microsoft Sentinel Workspaces

Introduction: The Criticality of Data Retention

In the modern landscape of cybersecurity, data is the lifeblood of security operations. Microsoft Sentinel, as a cloud-native Security Information and Event Management (SIEM) and Security Orchestration, Automation, and Response (SOAR) solution, relies entirely on the data ingested into its underlying Log Analytics workspace. However, data is not just a collection of logs; it is a financial and operational asset that requires careful management. Data retention settings define exactly how long your organization keeps its security logs before they are automatically purged, archived, or moved to long-term storage.

Why does this matter? Simply put, retention policies are a balancing act between compliance, cost, and incident response capability. If you retain data for too short a period, you may find yourself unable to conduct a forensic investigation for a breach that occurred months ago. If you retain data for too long without a strategy, your storage costs can balloon uncontrollably, leading to significant budget overruns. Furthermore, many regulatory frameworks—such as GDPR, HIPAA, and PCI-DSS—mandate specific retention periods for audit logs. Understanding how to configure these settings is not just a technical task; it is a fundamental aspect of organizational governance and security maturity.

This lesson will guide you through the technical nuances of managing data retention within Microsoft Sentinel and the associated Log Analytics workspaces. We will explore the differences between interactive retention and long-term storage, how to manage costs through granular table-level settings, and the best practices for aligning your technical configuration with your business requirements.


Not read yet

Understanding the Log Analytics Workspace Architecture

Before diving into the configuration steps, it is vital to understand that Microsoft Sentinel stores all its data in an Azure Log Analytics workspace. While you manage your security incidents and detection rules within the Sentinel interface, the actual "storage bucket" is the workspace itself. Consequently, all data retention policies are applied at the workspace level or the specific table level within that workspace.

Every workspace has a default retention period, which is typically 30 days for the free tier or up to 730 days for paid tiers. When you create a new workspace, it is important to consider the projected data volume and the required retention duration from the outset. Because Sentinel integrates so deeply with these workspaces, changing retention settings impacts every data source connected to that workspace, from Microsoft 365 logs to Azure Activity logs and third-party firewall data.

Callout: The Distinction Between Retention and Archival It is common to confuse "retention" with "archival." Retention refers to the period during which data is available for interactive querying via Kusto Query Language (KQL). Archival refers to moving that data into a low-cost, compressed storage tier where it is not immediately searchable but remains available for compliance or forensic purposes. Understanding this distinction is the key to optimizing your security budget.


Not read yet

Configuring Workspace-Level Data Retention

The most straightforward way to manage data is at the workspace level. This setting acts as the "global" rule for all data tables that do not have their own specific overrides.

Step-by-Step: Adjusting Default Retention

  1. Navigate to the Azure Portal and search for Log Analytics workspaces.
  2. Select the specific workspace associated with your Microsoft Sentinel instance.
  3. In the left-hand menu, under the Settings section, click on Usage and estimated costs.
  4. Select Data Retention from the top menu bar.
  5. Use the slider to adjust the retention period. You can typically choose any number of days between 30 and 730.
  6. Click Apply to save your changes.

Note: Increasing your retention period will immediately start incurring additional costs based on the volume of data stored. Always check the "Usage and estimated costs" pane to see a projection of how these changes will affect your monthly Azure invoice.

Why Workspace-Level Settings Are Often Insufficient

While the workspace-level setting is easy to manage, it is rarely the most efficient approach for a production environment. Different types of data have different values and legal requirements. For example, you might need to keep authentication logs for one year for compliance, but firewall "allow" logs might only be useful for 30 days. Applying a one-year retention to your entire workspace just because of one table is a common and expensive mistake.


Not read yet

Implementing Table-Level Retention

To avoid the "one-size-fits-all" trap, Microsoft allows you to set retention policies on individual tables. This allows you to keep high-value logs for longer periods while letting low-value or high-volume logs expire quickly.

The Power of Granular Control

Table-level retention overrides the workspace default. If your workspace is set to 30 days, but you configure the SecurityEvent table to have a retention of 365 days, the SecurityEvent data will persist for the full year, while all other tables will follow the 30-day workspace rule.

Step-by-Step: Configuring Table-Level Settings via Azure CLI

While you can use the portal, using the Azure CLI or PowerShell is often faster and more repeatable. Below is an example of how to update a table's retention period using the Azure CLI.

# Set the retention for a specific table to 90 days
az monitor log-analytics workspace table update \
    --resource-group MyResourceGroup \
    --workspace-name MySentinelWorkspace \
    --name SecurityEvent \
    --retention-time 90

Explanation of the command:

  • az monitor log-analytics workspace table update: This is the base command for modifying table-specific settings.
  • --resource-group: Specifies the resource group where your workspace resides.
  • --workspace-name: The name of your existing Log Analytics workspace.
  • --name: The specific table (e.g., SecurityEvent, SigninLogs) you want to modify.
  • --retention-time: The number of days to retain the data.

Warning: Be cautious when lowering the retention period for a table. Once you reduce the retention time, data that is older than the new setting will be permanently deleted from the workspace and will no longer be available for hunting or investigation. There is no "undo" button for data deletion.


Not read yet

Long-Term Archival: The Strategic Solution

If you find that you need to retain data for years rather than months, keeping that data in the "hot" interactive tier of Log Analytics is financially unsustainable. This is where Data Archival comes into play.

How Archival Works

When you enable archiving for a table, data that reaches the end of its interactive retention period is moved to a compressed, long-term storage format. This data is not searchable via standard KQL queries in the Sentinel hunting interface. If you need to access it, you must perform a "search job" or restore the data to a temporary location, which takes time and incurs additional costs.

Benefits of Archival

  • Cost Efficiency: Archival storage is significantly cheaper than interactive storage.
  • Compliance: You can meet multi-year data retention requirements without clogging your daily security operations.
  • Performance: Keeping your interactive workspace lean ensures that your queries run faster, which is critical during an active incident response.

Configuring Archival

You can configure archiving by updating the table properties. Archival can be set for up to 7 years (2,555 days).

# Update a table to have 30 days of interactive retention and 365 days of archive
az monitor log-analytics workspace table update \
    --resource-group MyResourceGroup \
    --workspace-name MySentinelWorkspace \
    --name SecurityEvent \
    --retention-time 30 \
    --total-retention-time 395

Key distinction: The --total-retention-time includes both the interactive retention and the archive duration. In this example, 30 days are interactive, and the remaining 365 days (total 395) are stored in the archive.


Not read yet

Best Practices for Data Retention Strategy

Managing data retention requires a mix of technical knowledge and business alignment. Follow these industry-standard practices to ensure your environment is both secure and cost-effective.

1. Perform a Data Classification Exercise

Before configuring any settings, categorize your data sources.

  • High-Value Logs: Authentication logs, administrative actions, and critical security alerts. These should have long retention periods.
  • Operational/Debug Logs: Verbose logs that provide little security value but high volume. These should have the shortest possible retention.
  • Compliance Logs: Logs required by auditors. These should be moved to long-term archive as soon as the active investigation period ends.

2. Monitor Data Ingestion Trends

Data volume is rarely static. New applications or increased traffic can cause your log volume to spike, which directly impacts your retention costs. Set up Azure Monitor alerts to notify you if data ingestion exceeds a certain threshold.

3. Review Retention Annually

Business requirements change, and so do security threats. What was important two years ago may be irrelevant today. Schedule an annual review of your retention policies with your Legal and Compliance teams to ensure you are not paying to store data you are no longer required to keep.

4. Leverage KQL for "Data Pruning"

Sometimes, you might ingest logs that contain unnecessary information (like verbose debug data). Before they hit the storage layer, you can use Data Collection Rules (DCRs) to filter out or transform data. By reducing the data before it reaches the workspace, you save money on both ingestion and retention.

Callout: The "Data Pruning" Strategy Many organizations focus solely on how long they keep data, but the best way to manage retention is to manage what gets kept. Using Data Collection Rules (DCRs) to drop unnecessary fields or filter out "noise" events is the most effective way to optimize your total cost of ownership (TCO).


Not read yet

Common Pitfalls and How to Avoid Them

Even experienced administrators often fall into traps when managing Sentinel workspaces. Awareness of these pitfalls is your best defense.

Pitfall 1: Ignoring the "Free" Tier Limitations

Many users start with a free trial or a small workspace that uses the free tier. This tier has a strict 31-day retention limit and no option for long-term archiving. If you suddenly need to keep data for 90 days, you must upgrade the workspace tier, which can lead to unexpected billing changes.

Pitfall 2: Over-retaining Data "Just in Case"

It is tempting to set everything to 730 days just to be safe. However, this is a dangerous practice. If your organization is subject to a legal discovery request, you are generally required to produce all data you possess. By keeping data you do not need, you increase your legal liability and your storage costs simultaneously.

Pitfall 3: Failing to Test Search Jobs

If you rely on archiving for compliance, you must periodically test your ability to retrieve that data. If an auditor asks for logs from 18 months ago, you do not want to find out for the first time that your search job configuration is broken. Perform a "dry run" every six months to ensure you can successfully restore archived data.

Pitfall 4: Neglecting Table-Level Overrides

If you have a massive volume of "Firewall Deny" logs, they will quickly consume your entire workspace quota. If you do not set a specific, shorter retention for this table, you will end up paying to store low-value data for the same duration as your high-value authentication logs.


Not read yet

Quick Reference: Retention Configuration Summary

Feature Scope Purpose
Workspace Default Entire Workspace Sets the baseline for all tables without specific overrides.
Table-Level Retention Specific Table Allows granular control for high-value or high-volume data.
Data Archiving Specific Table Moves data to low-cost storage for long-term compliance.
Data Collection Rules Ingestion Pipeline Filters out unnecessary data before it is stored.

Frequently Asked Questions (FAQ)

Can I change the retention period for system tables?

Yes, most tables, including those created by Microsoft Sentinel solutions, support custom retention settings. However, always verify in the documentation if a specific solution has hardcoded dependencies on certain data periods.

What happens to my data if I delete the workspace?

If you delete the Log Analytics workspace, all data contained within it is permanently deleted. There is no way to recover this data. Always back up critical configurations and consider exporting logs to an Azure Blob storage account if you need an external backup.

Does changing retention affect existing data?

Yes. If you reduce the retention period, the system will immediately identify data that exceeds the new limit and purge it. If you increase the retention period, it applies to both existing data and future incoming data.

How do I see how much data each table is consuming?

Navigate to your Log Analytics workspace, click on Tables, and look at the Size column. This will give you a clear breakdown of which logs are taking up the most space, helping you decide which tables need more aggressive retention policies.


Not read yet

Managing Data Retention at Scale: A Practical Example

Imagine you are the security lead for a large enterprise. You have 500 gigabytes of data flowing into your Sentinel workspace daily. Your Legal department requires you to keep "Audit Logs" for 7 years, but your "Network Traffic" logs are only useful for 14 days.

Your Action Plan:

  1. Apply Workspace Default: Set the workspace default to 30 days. This covers 90% of your general logs.
  2. Configure Network Table: Use the Azure CLI to set the NetworkTraffic table to 14 days. This saves you 16 days of storage costs for a very high-volume data source.
  3. Configure Audit Table: Set the AuditLogs table to 30 days of interactive retention and 2,525 days of archive. This ensures you meet the 7-year requirement (30 + 2,525 = 2,555 days) while keeping the data out of your interactive workspace.
  4. Monitor: Set up a monthly report in the "Workbooks" section of Sentinel to track the size of these tables. If the NetworkTraffic table grows significantly, you can further refine your DCRs to drop specific, non-essential traffic patterns.

This approach balances the "Hot" tier (interactive) for speed and the "Archive" tier for cost and compliance. By treating retention as a tiered strategy rather than a single setting, you maintain a high-performance SIEM while keeping your cloud costs under control.


Not read yet

Key Takeaways for Security Professionals

  1. Retention is a Balancing Act: You must constantly weigh the needs of incident responders (who need fast access to recent data) against the needs of compliance officers (who need long-term access to old data).
  2. Granularity Saves Money: Never rely solely on workspace-level retention. Use table-level settings to ensure that high-volume, low-value logs do not inflate your storage costs.
  3. Archiving is Not Optional: For any organization with strict regulatory requirements, long-term archival is the only way to retain data for years without massive costs.
  4. Data Pruning is Proactive: The best retention policy is not storing useless data in the first place. Use Data Collection Rules (DCRs) to filter and transform data before it reaches your workspace.
  5. Regular Audits are Essential: Data retention policies are not "set and forget." Review your settings annually to ensure they still align with your business needs and current threat environment.
  6. Understand the "Point of No Return": Always remember that lowering retention policies is a destructive action. Once logs are purged, they cannot be recovered. Always verify your requirements with stakeholders before reducing retention.
  7. Use Automation: Configuration of these settings should be handled through Infrastructure as Code (IaC) tools like Terraform or Bicep. This ensures that your retention policies are consistent across all environments and can be audited as part of your CI/CD pipeline.

By mastering these settings, you transition from simply "collecting logs" to "managing an intelligence asset." This level of discipline is what separates a reactive security team from a proactive, well-governed operation that is prepared for both the daily demands of incident response and the long-term demands of regulatory compliance. As you continue your journey with Microsoft Sentinel, keep these principles at the forefront of your workspace management strategy.

Not read yet

Each section gets a ✓ as you scroll through it. Tap the button to jump to the next one.