Hello Shivansh Agarwal
Thank you for posting your query on Microsoft Q&A platform.
The maximum query time range for log alerts is 2 days. This is a platform limitation documented under Azure Monitor service limits
Log search alerts have a maximum query time range of 48 hours.
As a workaround you can set OverrideQueryTimeRange and WindowSize in PowerShell or CLI for scheduled query rules. Scheduled Query Alerts with OverrideQueryTimeRange.
https://learn.microsoft.com/en-us/cli/azure/monitor/scheduled-query?view=azure-cli-latest
Use Logic Apps or Functions for Stateful Comparison: If the platform enforces 2-day limits, Microsoft recommends aggregating data externally and triggering alerts via Logic Apps or Functions.
Reference: https://learn.microsoft.com/en-us/azure/azure-monitor/alerts/best-practices-alerts
Dynamic Thresholds for Longer Patterns: Dynamic thresholds use historical data (10+ days) to detect anomalies without manually coding multi-day logic.
Reference: https://learn.microsoft.com/en-us/azure/azure-monitor/alerts/alerts-dynamic-thresholds
Metric Alerts for Rolling Windows: Metric alerts support longer evaluation periods and can be configured for multi-day checks.
Reference: https://learn.microsoft.com/en-us/azure/azure-monitor/alerts/alerts-types#metric-alerts
Kindly let us know if the solution provided worked for you.
If you need any further assistance, please feel free to reach out.
Thanks,
Suchitra.