Skip to content

Commit 622fc04

Browse files
committed
memory usage tracking
1 parent 2048073 commit 622fc04

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

Modules/CIPPCore/Public/Entrypoints/Activity Triggers/Webhooks/Push-AuditLogTenant.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ function Push-AuditLogTenant {
3232
# Get webhook rules
3333
$ConfigEntries = Get-CIPPAzDataTableEntity @ConfigTable
3434
$LogSearchesTable = Get-CippTable -TableName 'AuditLogSearches'
35-
35+
Write-Information ("Audit: Memory usage before processing $([System.GC]::GetTotalMemory($false))")
36+
$SearchCount = 0
3637
$Configuration = $ConfigEntries | Where-Object { ($_.Tenants -match $TenantFilter -or $_.Tenants -match 'AllTenants') }
3738
if ($Configuration) {
3839
try {
@@ -88,12 +89,17 @@ function Push-AuditLogTenant {
8889
}
8990
}
9091
}
92+
$SearchCount++
93+
Write-Information "Audit: Memory usage after processing $SearchCount searches: $([System.GC]::GetTotalMemory($false))"
9194
}
9295
} catch {
9396
Write-Information ( 'Audit Log search: Error {0} line {1} - {2}' -f $_.InvocationInfo.ScriptName, $_.InvocationInfo.ScriptLineNumber, $_.Exception.Message)
9497
}
9598
}
9699
} catch {
97100
Write-Information ( 'Push-AuditLogTenant: Error {0} line {1} - {2}' -f $_.InvocationInfo.ScriptName, $_.InvocationInfo.ScriptLineNumber, $_.Exception.Message)
101+
} finally {
102+
Write-Information "Audit Logs: Completed processing $($TenantFilter)"
103+
Write-Information "Audit Logs: Memory usage after processing $([System.GC]::GetTotalMemory($false))"
98104
}
99105
}

0 commit comments

Comments
 (0)