Last active
August 25, 2020 22:28
-
-
Save pburkholder/1487ee78da3de11ea49bbcd49984e1cf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment