Skip to content

Commit

Permalink
logging
Browse files Browse the repository at this point in the history
  • Loading branch information
KelvinTegelaar committed Oct 4, 2024
1 parent 30c15e9 commit a4bb1a2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Modules/CIPPCore/Public/Webhooks/Test-CIPPAuditLogRules.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ function Test-CIPPAuditLogRules {
}

if ($Data.clientip) {
Write-Information "Doing an IP lookup for $($data.clientIp) - $($TenantFilter)"
if ($Data.clientip -match '^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:\d+$') {
$Data.clientip = $Data.clientip -replace ':\d+$', '' # Remove the port number if present
}
Expand Down Expand Up @@ -132,13 +131,14 @@ function Test-CIPPAuditLogRules {
$Data.CIPPLocationInfo = ($Location | ConvertTo-Json)
$Data.AuditRecord = ($RootProperties | ConvertTo-Json)
}
Write-Information "Audit log: Finished IP lookup if required, creating data object. $($Data.operation) - $($TenantFilter)"
$Data | Select-Object * -ExcludeProperty ExtendedProperties, DeviceProperties, parameters
} catch {
Write-Information "Audit log: Error processing data: $($_.Exception.Message)`r`n$($_.InvocationInfo.PositionMessage)"
Write-LogMessage -API 'Webhooks' -message 'Error Processing Audit Log Data' -LogData (Get-CippException -Exception $_) -sev Error -tenant $TenantFilter
}
}

Write-Host "Processed Data: $(($ProcessedData | Measure-Object).Count) - This should be higher than 0 in many cases, because the where object has not run yet."
Write-Information "Creating filters - $($data.operation) - $($TenantFilter)"

$Where = $Configuration | ForEach-Object {
Expand Down Expand Up @@ -166,7 +166,6 @@ function Test-CIPPAuditLogRules {
}

}
Write-Information "Webhook: The list of operations in the data are $(($ProcessedData.operation | Select-Object -Unique) -join ', ')"

$MatchedRules = [System.Collections.Generic.List[string]]::new()
$DataToProcess = foreach ($clause in $Where) {
Expand Down

0 comments on commit a4bb1a2

Please sign in to comment.