cloud-gov/cg-site

Auditing activity page needs updates and Markdown fixes

Opened this issue · 4 comments

It looks like the Auditing activity documentation we have has outdated information, and the Markdown is broken to boot. We should make sure this is fixed and updated so customers have the correct information in properly formatted way.

@pburkholder, do you have any other details you can share here to help with implementation and expected changes?

Here's an example using pagination:

#!/bin/bash -euo pipefail

query='type+IN+audit.service_instance.create,audit.service_instance.delete'
total_pages=$(cf curl "/v2/events?results-per-page=100&q=${query}" | jq -c -r '.total_pages')

page=1

while [ $page -le $total_pages ]; do
  cf curl "/v2/events?&results-per-page=100&page=${page}&q=${query}" |
     jq -c -r '.resources[].entity | [ .timestamp, .actor_username, .type, .actee_name, .metadata.request.service_plan_guid ] | @csv '
  page=$((page + 1 ))
done

The markdown is fixed. Still need to incorporate the other changes.

We should update to use the V3 API, e.g. cf curl /v3/audit_events?organization_guids=$(cf org --guid sample-org) | jq '.resources[].type'

And a PowerShell version of @pburkholder's script:

$query = "type+IN+audit.service_instance.create,audit.service_instance.delete"
$total_pages = $(cf curl "/v2/events?results-per-page=100&q=${query}" | jq -c -r '.total_pages')

$page = 1

while($page -le $total_pages)
{
    cf curl "/v2/events?&results-per-page=100&page=${page}&q=${query}" |
        jq -c -r '.resources[].entity | [ .timestamp, .actor_username, .type, .actee_name, .metadata.request.service_plan_guid ] | @csv '
    $page=$page + 1
}