cf cli
get the app guid you want to trace:# cf app simple-http --guid
936cd7bb-9216-4f9e-8911-28164104f7ae
bosh ssh
command with the cf-<FOUNDATION_ID> and the Diego Cell ID:# bosh vms
# bosh -d cf<FOUNDATION_ID> ssh diego_cell/<ID>
bosh -d cf-8a##############af9 ssh diego_cell/7913cae8-c9f3-4f0a-a9d6-e0911b395cad
# APP_GUID=936cd7bb-9216-4f9e-8911-28164104f7ae
# cfdot actual-lrps | jq -cr --arg app_guid "$APP_GUID" '. | select(.process_guid | startswith($app_guid))| {guid: .instance_guid, address: .instance_address, cell: .cell_id}'
{"guid":"99b1d7ed-5edd-4b81-71fa-dc62","address":"10.255.255.2","cell":"83de8232-d9f1-45a8-9994-1179657442e4"}
{"guid":"61fb9f91-7d7d-413e-598e-99c2","address":"10.255.255.1","cell":"7913cae8-c9f3-4f0a-a9d6-e0911b395cad"}
# sudo /var/vcap/packages/runc/bin/runc --root /run/containerd/runc/garden state 61fb9f91-7d7d-413e-598e-99c2 | /var/vcap/packages/cfdot/bin/jq .pid
3709610
my-app-trace
" in the filename to something that resembles the problem you are debugging. Most apps will listen on port 8080 (unencrypted):
-i any
-s 0
-C 256
-W
you can set the max amount of data collected before tcpdump will start truncating existing files.-W 4
-C
, which is 256MB in this example. With these command arguments, the tcpdump will only capture 1GB of data spread over 4 files numbered 0,1,2,3. When file 3 reaches 256MB, tcpdump will truncate file 0 and continue capturing new data to file 0. This is called a rolling tcpdump. Using -C and -W protects the system from running out of disk space during large captures. # sudo nsenter -t 3709610 -n tcpdump -i any -s 0 -C 256 -W 4 -w /tmp/`cat /var/vcap/instance/name`-`cat /var/vcap/instance/id`-my-app-trace.trc tcp port 8080
tcpdump: data link type LINUX_SLL2
tcpdump: listening on any, link-type LINUX_SLL2 (Linux cooked v2), snapshot length 256 bytes
13 packets captured
32 packets received by filter
0 packets dropped by kernel
# nsenter -t 3709610 -a netstat -anp | egrep LISTEN
tcp 0 0 127.0.0.1:61003 0.0.0.0:* LISTEN 79/envoy
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 25/simple-http
tcp 0 0 0.0.0.0:61443 0.0.0.0:* LISTEN 79/envoy
tcp 0 0 0.0.0.0:61443 0.0.0.0:* LISTEN 79/envoy
tcp 0 0 0.0.0.0:61443 0.0.0.0:* LISTEN 79/envoy
tcp 0 0 0.0.0.0:61443 0.0.0.0:* LISTEN 79/envoy
tcp 0 0 0.0.0.0:2222 0.0.0.0:* LISTEN 7/diego-sshd
tcp 0 0 0.0.0.0:61002 0.0.0.0:* LISTEN 79/envoy
tcp 0 0 0.0.0.0:61002 0.0.0.0:* LISTEN 79/envoy
tcp 0 0 0.0.0.0:61002 0.0.0.0:* LISTEN 79/envoy
tcp 0 0 0.0.0.0:61002 0.0.0.0:* LISTEN 79/envoy
tcp 0 0 0.0.0.0:61001 0.0.0.0:* LISTEN 79/envoy
tcp 0 0 0.0.0.0:61001 0.0.0.0:* LISTEN 79/envoy
tcp 0 0 0.0.0.0:61001 0.0.0.0:* LISTEN 79/envoy
tcp 0 0 0.0.0.0:61001 0.0.0.0:* LISTEN 79/envoy
# ls -l /tmp/diego_cell-7913cae8-c9f3-4f0a-a9d6-e0911b395cad-my-app-trace.trc0
-rw-r--r-- 1 tcpdump tcpdump 2141 May 23 18:31 /tmp/diego_cell-7913cae8-c9f3-4f0a-a9d6-e0911b395cad-my-app-trace.trc0
/var/vcap/sys/log
. The normal Operations Manager log bundle download will capture all logs in this folder. If you choose this method simply move the files, then go to Operations Manager and trigger a log bundle download for the given diego cell.bosh scp
the file to your local machine:# bosh scp diego_cell/7913cae8-c9f3-4f0a-a9d6-e0911b395cad:/tmp/diego_cell-7913cae8-c9f3-4f0a-a9d6-e0911b395cad-my-app-trace.trc* ~/Documents/