How to Collect A Range Of Operations Manager Apply Changes Logs
search cancel

How to Collect A Range Of Operations Manager Apply Changes Logs

book

Article ID: 297208

calendar_today

Updated On:

Products

Support Only for Spring

Issue/Introduction

The Support Bundle obtained from Tanzu Operations Manager (Opsman) will contain a variety of information such as bosh director logs, deployment manifests, bosh instance information, and historical Apply Changes Deployment logs. In an effort to moderate the size of the of the Support Bundle, it is configured to only obtain the last 5 Apply Changes deployment logs. Sometimes there is a need to collect a range of Apply Changes logs before in addition to the most recent 5. This article provides a script that can be referenced to obtain and tarball the targeted range of logs.

Environment

Operations Manager : all versions

Resolution

For example, to collect deployments 380-400:

mkdir installation_logs && cd installation_logs
for i in {380..400}
do
 echo "Saving log $i to file."
 curl -k -s -H "Authorization: Bearer $TOKEN" https://<OPSMAN-FQDN>/api/v0/installations/$i/logs | awk '{gsub(/\\n/,"\n")}1' | awk '{gsub(/\\t/,"\t")}1' >> change_log_$i.log
 echo "log $i saved."
done
cd .. && tar -zcvf installation_logs.tar.gz installation_logs


Please ensure the following is modified in the script to match needs:

<OPSMAN-FQDN> should map to the env's Opsman FQDN
$TOKEN should be Opsman UAA token 
380..400 can be modified to the range that is desired to be obtained

Note, please ensure that where you run this has enough capacity to store the files.