From 63195d77860677aa3038729391158c32597f442e Mon Sep 17 00:00:00 2001 From: Cheick Keita Date: Fri, 25 Aug 2023 16:35:06 -0700 Subject: [PATCH] Remove the retention policy setting (#3452) * Remove the configuration of the autoscale diagnostic * only remove the retention policy * set retention policy to false * remove settings * remove retentionPolicy from bicep * format --- src/ApiService/ApiService/onefuzzlib/AutoScale.cs | 4 ++-- src/deployment/azuredeploy.bicep | 1 - src/deployment/bicep-templates/autoscale-settings.bicep | 9 ++------- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/ApiService/ApiService/onefuzzlib/AutoScale.cs b/src/ApiService/ApiService/onefuzzlib/AutoScale.cs index d721715737..73d5d429e5 100644 --- a/src/ApiService/ApiService/onefuzzlib/AutoScale.cs +++ b/src/ApiService/ApiService/onefuzzlib/AutoScale.cs @@ -263,8 +263,8 @@ private async Async.Task> SetupAutoSca // The field is there in github though, so need to update this code once that code is released: // https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/LogSettings.cs // But setting logs one by one works the same as "allLogs" being set... - var logSettings1 = new LogSettings(true) { RetentionPolicy = new RetentionPolicy(true, 30), Category = "AutoscaleEvaluations" }; - var logSettings2 = new LogSettings(true) { RetentionPolicy = new RetentionPolicy(true, 30), Category = "AutoscaleScaleActions" }; + var logSettings1 = new LogSettings(true) { Category = "AutoscaleEvaluations" }; + var logSettings2 = new LogSettings(true) { Category = "AutoscaleScaleActions" }; var parameters = new DiagnosticSettingsData { WorkspaceId = logAnalyticsWorkspaceId diff --git a/src/deployment/azuredeploy.bicep b/src/deployment/azuredeploy.bicep index 4f655cb09a..99c175c6e7 100644 --- a/src/deployment/azuredeploy.bicep +++ b/src/deployment/azuredeploy.bicep @@ -167,7 +167,6 @@ module autoscaleSettings 'bicep-templates/autoscale-settings.bicep' = { server_farm_id: serverFarm.outputs.id owner: owner workspaceId: operationalInsights.outputs.workspaceId - logRetention: log_retention autoscale_name: 'onefuzz-autoscale-${uniqueString(resourceGroup().id)}' function_diagnostics_settings_name: 'functionDiagnosticSettings' } diff --git a/src/deployment/bicep-templates/autoscale-settings.bicep b/src/deployment/bicep-templates/autoscale-settings.bicep index e380be272e..185c603c48 100644 --- a/src/deployment/bicep-templates/autoscale-settings.bicep +++ b/src/deployment/bicep-templates/autoscale-settings.bicep @@ -2,7 +2,6 @@ param location string param server_farm_id string param owner string param workspaceId string -param logRetention int param autoscale_name string param function_diagnostics_settings_name string @@ -27,7 +26,7 @@ resource autoscaleSettings 'Microsoft.Insights/autoscalesettings@2015-04-01' = { rules: [ { metricTrigger: { - metricName: 'CpuPercentage' + metricName: 'CpuPercentage' metricResourceUri: server_farm_id operator: 'GreaterThanOrEqual' statistic: 'Average' @@ -50,7 +49,7 @@ resource autoscaleSettings 'Microsoft.Insights/autoscalesettings@2015-04-01' = { operator: 'LessThan' statistic: 'Average' threshold: 25 - timeAggregation:'Average' + timeAggregation:'Average' timeGrain: 'PT1M' timeWindow: 'PT10M' } @@ -79,10 +78,6 @@ resource functionDiagnosticSettings 'Microsoft.Insights/diagnosticSettings@2021- { categoryGroup: 'allLogs' enabled: true - retentionPolicy: { - days: logRetention - enabled: true - } } ] workspaceId: workspaceId