Get Event Logs Using Windows Power Shell
This process assumes access to HYPR Control Center and Windows PowerShell with Administrator privileges.
The following script provides guidance on how to export Events from a relying party (RP) using PowerShell. The output will be a .csv
file, with data ordered in descending order by date and time.
Instructions
set $hypr_host
set $hypr_token
set $rpAppId
$hypr_host = "https://host.domain.com"
$hypr_token = "##################"
$rpAppId = "AppName"
$headers = New-Object "System.Collections.Generic.Dictionary\[\[String\],\[String\]\]"
$headers.Add("Content-Type", "application/json; charset=utf-8;")
$headers.Add("Authorization", "Bearer $hypr_token")
$headers.Add("accept", "*/*")
$headers.Add("sec-fetch-mode", "cors")
$headers.Add("accept-encoding", "gzip, deflate, br")
$headers.Add("accept-language","en-US,en;q=0.9")
$endTSUTC = \[double\](Get-Date -Date ((Get-Date).ToUniversalTime()) -UFormat %s) * 1000
Write-Host "EndUTC: " $endTSUTC
$startTSUTC = $endTSUTC - 3600000
Write-Host "StartUTC: " $startTSUTC
$pageSize = 5000
$getEventsParams = @{
Uri = "$hypr_host" + "/cc/api/versioned/audit/search?endTSUTC=" + $endTSUTC + "&startTSUTC=" + $startTSUTC + "&rpAppId=" + $rpAppId + "&pageSize=" + $pageSize + "&orderBy=eventTimeInUTC&sortDir=desc"
Headers = $headers
Method = 'GET'
ContentType = 'application/json'
}
$eventsResponse = Invoke-RestMethod @getEventsParams -SkipHeaderValidation
$eventsResponse.data | ConvertTo-Csv
Events for the specified HYPR Relying Party (RP) App during the specified duration are generated in the `.csv` file.