How to retrieve any type of log files from a BOSH-controlled VM
search cancel

How to retrieve any type of log files from a BOSH-controlled VM

book

Article ID: 425562

calendar_today

Updated On:

Products

VMware Tanzu Platform

Issue/Introduction

If you want to retrieve any kind of file, such as logs generated by an errand, from a bosh-controlled VM, you can make use of the built-in command bosh logs.

Environment

Tanzu Platform for Cloud Foundry

Resolution

Write (or move) the files you want to retrieve under /var/vcap/sys/log. Add files to that top level directory, or create a subdirectory under "log" in which to add files.

When you create and download the log bundle with this command

bosh -d <deployment> logs vm-name

 

... the file(s) will be included in the compressed tar file, which is written to a directory on the system where the bosh logs command was executed.

  1. Make sure all files and directories are readable by everyone
    sudo chmod a+r /var/vcap/sys/log/addedfiles

     

  2. Remove the added files as soon as you have run bosh logs to retrieve them. Otherwise, these file will remain forever and could eventually cause disk space issues.
    bosh -d <deployment> ssh vm-name -c "sudo rm -rf /var/vcap/sys/log/addedfiles"

Additional Information

Please check this KB if you want to collect additional logs for OpsManager, Bosh director and Bosh VM managed https://knowledge.broadcom.com/external/article?legacyId=91889