Skip to main content
Question

API Endpoint for Activity Log and Overview Report

  • 10 March 2022
  • 2 replies
  • 425 views

Hi,

Is there any endpoint or anyway that we can pull the data of Activity Log and Overview Report using the API yet?

Thank you.

I am also interested in the answer to this question. I need to query the log to find out that patches have completed installing, so they can be put back into the F5 VIP.


This is how I’ve captured the Activity Log for a specific policy going back 7 days. Want to get everything, drop the &policyID=$policy from the URL.

# Header info
$apiKey = Read-Host "api-key: "
$orgID = "Your-Org-ID"
$headers = @{ "Authorization" = "Bearer $apiKey" }

# The policy
$policy = "Your-Policy-Number"

# Search Requirements
$start = (Get-Date).AddDays(-7) # go back 7 days
$start = Get-Date $start -f 'yyyy-MM-dd'
$end = Get-Date -f 'yyyy-MM-dd'
$i = 0

$data = do{
$url = "https://console.automox.com/api/events?o=$orgID&policyId=$policy&limit=500&page=$i&startDate=$start&endDate=$end"
$response = (Invoke-WebRequest -Method Get -Uri $url -Headers $headers).Content | ConvertFrom-Json
$response | % {
$name = $_.server_name
$id = $_.server_id
pscustomobject] @{
host = $name
hostid = $id
status = $_.data.status
timestamp = $_.create_time
data = $_.data.text
}
}
$i++
}
while ($response)

$data

 


Reply