Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Commit

Permalink
Remove the retention policy setting (#3452)
Browse files Browse the repository at this point in the history
* Remove the configuration of the autoscale diagnostic

* only remove the retention policy

* set retention policy to false

* remove settings

* remove retentionPolicy from bicep

* format
  • Loading branch information
chkeita authored and AdamL-Microsoft committed Aug 28, 2023
1 parent 4e61aa7 commit 63195d7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/ApiService/ApiService/onefuzzlib/AutoScale.cs
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ private async Async.Task<OneFuzzResult<DiagnosticSettingsResource>> 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
Expand Down
1 change: 0 additions & 1 deletion src/deployment/azuredeploy.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
Expand Down
9 changes: 2 additions & 7 deletions src/deployment/bicep-templates/autoscale-settings.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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'
Expand All @@ -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'
}
Expand Down Expand Up @@ -79,10 +78,6 @@ resource functionDiagnosticSettings 'Microsoft.Insights/diagnosticSettings@2021-
{
categoryGroup: 'allLogs'
enabled: true
retentionPolicy: {
days: logRetention
enabled: true
}
}
]
workspaceId: workspaceId
Expand Down

0 comments on commit 63195d7

Please sign in to comment.