Collect Java Flight Recording (JFR) in WebLogic Kubernetes Operator Pod

Puneeth Prakash
1 min readOct 17, 2023

--

Step 1:

Get the pods in Operator Namespace :

Syntax: kubectl get pods -n <operator_namespace>

bash-3.2$ kubectl get pods -n sample-weblogic-operator-ns

NAME READY STATUS RESTARTS AGE
weblogic-operator-webhook-b96d4b5d6–7cvqs 1/1 Running 0 71s
weblogic-operator-88fc58c65-jfxs6 1/1 Running 0 71s

Step 2:

Use kubectl exec to get a shell to the Operator Pod container :

Syntax: kubectl exec -it <operator_pod> -n <operator_namespace> -- /bin/bash

bash-3.2$ kubectl exec -it weblogic-operator-88fc58c65-jfxs6 -n sample-weblogic-operator-ns -- /bin/bash

Step 3:

Use “jps” command to get list of running java processes:

bash-5.1$ jps
209 Jps
15 weblogic-kubernetes-operator.jar

Step 4:

Start JFR recording using JCMD utility

Syntax: jcmd <pid> JFR.start duration=<in_seconds> filename=<filename.jfr>

bash-5.1$ jcmd 15 JFR.start duration=10s filename=/tmp/my.jfr
15:
Started recording 1. The result will be written to:
/tmp/my.jfr
bash-5.1$ cd /tmp/
bash-5.1$ ls
2023_10_17_03_59_36_15 hsperfdata_oracle hsperfdata_root my.jfr
bash-5.1$ exit
exit

Step 4:

Copy the JFR recording to your local machine:

Syntax: kubectl cp <pod-id>:<path> <local-path> -n <namespace>

bash-3.2$ kubectl -n sample-weblogic-operator-ns cp weblogic-operator-88fc58c65-jfxs6:/tmp/my.jfr ~/Desktop/my.jfr
bash-3.2$

--

--

Puneeth Prakash
Puneeth Prakash

Written by Puneeth Prakash

I work as a Subject Matter Expert in FMW at Oracle. This blogging space is to share my learning experiences. Views expressed here are solely my own.

No responses yet