Skip to content

Commit 0370ba1

Browse files
committed
add API query support
1 parent 2602c29 commit 0370ba1

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Modules/CIPPCore/Public/Entrypoints/Invoke-ListLogs.ps1

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ function Invoke-ListLogs {
5858
$PartitionKey = $Request.Query.DateFilter
5959
$username = $Request.Query.User ?? '*'
6060
$TenantFilter = $Request.Query.Tenant
61+
$ApiFilter = $Request.Query.API
6162

6263
$StartDate = $Request.Query.StartDate ?? $Request.Query.DateFilter
6364
$EndDate = $Request.Query.EndDate ?? $Request.Query.DateFilter
@@ -87,7 +88,8 @@ function Invoke-ListLogs {
8788
$Rows = Get-AzDataTableEntity @Table -Filter $Filter | Where-Object {
8889
$_.Severity -in $LogLevel -and
8990
$_.Username -like $username -and
90-
($TenantFilter -eq $null -or $TenantFilter -eq 'AllTenants' -or $_.Tenant -like "*$TenantFilter*" -or $_.TenantID -eq $TenantFilter)
91+
($TenantFilter -eq $null -or $TenantFilter -eq 'AllTenants' -or $_.Tenant -like "*$TenantFilter*" -or $_.TenantID -eq $TenantFilter) -and
92+
($ApiFilter -eq $null -or $_.API -match "$ApiFilter")
9193
}
9294

9395
if ($AllowedTenants -notcontains 'AllTenants') {
@@ -122,8 +124,8 @@ function Invoke-ListLogs {
122124
}
123125

124126
return [HttpResponseContext]@{
125-
StatusCode = [HttpStatusCode]::OK
126-
Body = @($ReturnedLog | Sort-Object -Property DateTime -Descending)
127-
}
127+
StatusCode = [HttpStatusCode]::OK
128+
Body = @($ReturnedLog | Sort-Object -Property DateTime -Descending)
129+
}
128130

129131
}

0 commit comments

Comments
 (0)