How to collect logs in VMware PKS environment
search cancel

How to collect logs in VMware PKS environment

book

Article ID: 316956

calendar_today

Updated On:

Products

VMware Cloud PKS

Issue/Introduction

This article provides instructions on how to collect Bosh deployment logs in VMware PKS environment.


Environment

VMware Pivotal Container Service 1.x

Resolution

Before proceeding, you will need to access a system that has the BOSH command and has connectivity to the BOSH VM.

Alternately, you can access the BOSH command line from the Ops Manager VM by exporting the bosh command line credentials available at, Ops Manager UI > Bosh Tile > Credentials > Bosh Commandline Credentials.

Example:
export BOSH_CLIENT=ops_manager
export BOSH_CLIENT_SECRET=LTYa8CWh0l0YN_Wb4fs0cDTAg1s0096v
export BOSH_CA_CERT=/var/tempest/workspaces/default/root_ca_certificate
export BOSH_ENVIRONMENT=192.168.10.50
 

To collect the logs by using BOSH:
  1. List all the bosh deployment names by running the command:
    bosh deployments --column=name

    Example:
    ubuntu@clientvm:~$ bosh deployments --column=name
    Using environment '192.168.10.50' as client 'ops_manager'

    Name
    harbor-container-registry-fdb88949eb52d58b850f
    pivotal-container-service-b3b8732f7ebe9ebbd7b7
    service-instance_b4b109eb-b732-4425-9941-74779e83e44e

    3 deployments

    Succeeded

  2. To collect logs for all the VMs in a deployment, run this command:
    bosh logs -d deployment name

    Note: This will collect the logs and save them at the location from where you are running the command.

    Example:
    ubuntu@clientvm:~$ bosh logs -d pivotal-container-service-b3b8732f7ebe9ebbd7b7
    Using environment '192.168.10.50' as client 'ops_manager'

    Using deployment 'pivotal-container-service-b3b8732f7ebe9ebbd7b7'

    Task 2584

    Task 2584 | 08:03:47 | Fetching logs for pivotal-container-service/db1e7c74-0810-469f-bc24-7a1b262c6b5c (0): Finding and packing log files (00:00:01)
    Task 2584 Started  Fri Feb 15 08:03:47 UTC 2019
    Task 2584 Finished Fri Feb 15 08:03:48 UTC 2019
    Task 2584 Duration 00:00:01
    Task 2584 done

    Downloading resource 'bb13a3cc-b31e-4e33-4de8-b0fb40816ab6' to '/home/ubuntu/pivotal-container-service-b3b8732f7ebe9ebbd7b7-20190215-080343-892599218.tgz'...
                                                                               0.00%
    Succeeded

  3. To collect the logs and save in a specific location, specify the location as below:
    bosh logs -d deployment_name --dir /location

  4. To collect the logs for a specific VM in a deployment, run this command:
    bosh logs vm_name -d deployment_name

    Example:
    ubuntu@clientvm:~$ bosh logs master/75268dd4-c8fc-40ed-9dfa-38ca528baf5e -d service-instance_b4b109eb-b732-4425-9941-74779e83e44e
    Using environment '192.168.10.50' as client 'ops_manager'

    Using deployment 'service-instance_b4b109eb-b732-4425-9941-74779e83e44e'

    Task 2588
    Task 2588 | 08:11:02 | Fetching logs for master/75268dd4-c8fc-40ed-9dfa-38ca528baf5e (0): Finding and packing log files (00:01:19)

    Task 2588 Started  Fri Feb 15 08:11:02 UTC 2019
    Task 2588 Finished Fri Feb 15 08:12:21 UTC 2019
    Task 2588 Duration 00:01:19
    Task 2588 done


    Downloading resource 'ecd8c514-519c-45ee-503b-9a5e6d6e8ddc' to '/home/ubuntu/service-instance_b4b109eb-b732-4425-9941-74779e83e44e.master.75268dd4-c8fc-40ed-9dfa-38ca528baf5e-20190215-081216-774662052.tgz'...
    ##########################################################    95.74% 22.64 MiB/s
    Succeeded