Windows
Option 1: Via Sensor Capture Script
This option is currently only available for Sensor Versions 4.1 and below. For 4.2, use the manual steps for the time being. Prerequisites- You will need an uninstall or deregistration code to authenticate for repcli.
- Create a folder where all logs will be saved. For the purposes of this document, this location will be referenced as C:\temp although the C:\temp file location can be replaced with whatever location you have specified for saving the log files.
- Download the cbc-sensor-capture.ps1.zip attached to this article.
- Extract and copy cbc-sensor-capture.ps1 to C:\temp
- Download ProcmonLowAlt.exe.zip attached to the article How to Collect a low Altitude Procmon Capture. Alternatively, follow the steps "Configure Procmon for Low Altitude" from the same article.
- Unzip procmon and copy to C:\temp
- Ensure wpr.exe exists in C:\Windows\System32\
NOTE: If C:\Windows\System32\wpr.exe does not exist, download Debugging Tools for Windows and at the "Select the features you want to download" install prompt deselect all other options except "Windows Performance Toolkit". WPR.exe will download to C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit by default. Once downloaded copy wpr.exe to C:\Windows\System32\ |
Step 1: Authenticate with Repcli
Run the repcli unlock command
c:\Program Files\Confer
repcli unlock <UninstallCode>
Step 2: Capture Logs While The Sensor Is Active (Not in Bypass Mode)
In this section we want to reproduce the behavior when sensor is active. This consists of three separate sub-steps:
- KeepEvents
- This tells the sensor to retain the raw event files even after it's been sent to the backend. This is helpful as it helps us narrow down what the sensor was all seeing/doing at the exact time of the issue
- Windows performance Recorder (WPR) Capture
- This is a powerful Microsoft utility based on Event Tracing for Windows (ETW). The utility records system and application events.
- Procmon Capture
- Another Microsoft utility that shows system, registry, and process/thread activity.
- This gives a different viewpoint than WPR. Combining information from WPR and Procmon can make it easier to diagnose the issue
KeepEvents
- Open Command Prompt using the "Run As Administrator" option
- Change Directory to C:\temp
C:\WINDOWS\system32>cd to C:\temp
C:\temp>
- Run the following command to reset sensor counters and retain PSC events
C:\temp>Powershell -ExecutionPolicy bypass -f c:\temp\cbc-sensor-capture.ps1 keepevents
- When the Enter the uninstall code to unlock restricted RepCLI commands.: prompt is presented, enter the uninstall code
- When "Hit enter to stop trace and collect logs.:" presents, start to reproduce the behavior
- Document the exact steps taken to reproduce to provide to Support
- Note local machine time when testing started, and timezone of machine
- Note local time when issue occurred
- Once behavior is fully reproduced, press Enter to exit the capture
- A zip will be created with the device hostname, date and time of the capture (i.e. hostname-YYYYDDMMHHMMSS.zip).
- Rename the .zip file by adding the prefix "keepevents-active" (i.e. keepevents-active-hostname-YYYYDDMMHHMMSS.zip)
Windows performance Recorder (WPR) Capture
- Run the following command to start wpr trace depending on the estimated time needed to reproduce
More than 5 minutes
C:\temp>powershell -ExecutionPolicy bypass -f c:\temp\cbc-sensor-capture.ps1 wpr
Less than 5 minutes
C:\temp>powershell -ExecutionPolicy bypass -f c:\temp\cbc-sensor-capture.ps1 minifilter
- When "Hit enter to stop trace and collect logs.:" presents, start to reproduce the behavior
- Once behavior is fully reproduced, press Enter to exit the capture
- Document exact steps taken to reproduce to provide to Support
- Note local machine time when testing started, and timezone of machine
- Note local time when issue occurred
- A folder will be created with the device hostname, date and time of the capture (i.e. hostname-YYYYDDMMHHMMSS.zip).
- NOTE: If the files are too large, the script may be unable to zip the folder. In this case, please manually compress the folder into a zip file.
- NOTE: If the issue takes longer than 10 minutes to reproduce the issue, then the resulting log files may take up excessive disk space
- Rename the .zip file by adding the prefix "wpr-active" (i.e. wpr-active-hostname-YYYYDDMMHHMMSS.zip)
Procmon Capture
- Run the following command to start procmon
C:\temp>powershell -executionpolicy bypass -f c:\temp\cbc-sensor-capture.ps1 procmon
- When "Hit enter to stop trace and collect logs.:" presents, start to reproduce the behavior
- Once behavior is fully reproduced, press Enter to exit the capture
- A zip will be created with the device hostname, date and time of the capture (i.e. hostname-YYYYDDMMHHMMSS.zip).
- NOTE: If the files are too large, the script may be unable to zip the folder. In this case, please manually compress the folder into a zip file
- NOTE: If the issue takes longer than 10 minutes to reproduce the issue, then the resulting log files may take up excessive disk space
- Rename the .zip file by adding the prefix "procmon-active" (i.e. procmon-active-hostname-YYYYDDMMHHMMSS.zip)
Step 3: Capture Logs While The Sensor Is in Bypass Mode
In this section we want to reproduce the same exact steps when sensor is in bypass mode. This helps us compare what the system looks like when the sensor is no longer active and the machine is no longer experiencing the issue.
Windows performance Recorder (WPR) Capture
- Run the following command to start wpr trace depending on the estimated time needed to reproduce
More than 5 minutes
C:\temp>powershell -ExecutionPolicy bypass -f c:\temp\cbc-sensor-capture.ps1 wpr bypass
Less than 5 minutes
C:\temp>powershell -ExecutionPolicy bypass -f c:\temp\cbc-sensor-capture.ps1 minifilter bypass
- When "Hit enter to stop trace and collect logs.:" presents, start to reproduce the issue
- Once issue fully reproduced, press Enter to exit the capture
- Document exact steps taken to reproduce to provide to Support
- Note local machine time when testing started, and timezone of machine
- Note local time when issue occurred
- A folder will be created with the device hostname, date and time of the capture (i.e. hostname-YYYYDDMMHHMMSS.zip).
- Rename the .zip file by adding the prefix "wpr-bypass" (i.e. wpr-bypass-hostname-YYYYDDMMHHMMSS.zip)
Procmon Capture
- Run the following command:
C:\temp>powershell -executionpolicy bypass -f c:\temp\cbc-sensor-capture.ps1 procmon bypass
- When "Hit enter to stop trace and collect logs.:" presents, start to reproduce the issue
- Once the behavior has been reproduce, press Enter to exit the capture
- A folder will be created with the device hostname, date and time of the capture (i.e. hostname-YYYYDDMMHHMMSS.zip).
- Rename the .zip file by adding the prefix "procmon-bypass" (i.e. procmon-bypass-hostname-YYYYDDMMHHMMSS.zip)
Step 4: Zip all the logs
- Go to C:\temp and zip all the files that were created:
- keepevents-active-hostname-YYYYDDMMHHMMSS.zip
- wpr-active-hostname-YYYYDDMMHHMMSS.zip
- procmon-active-hostname-YYYYDDMMHHMMSS.zip
- wpr-bypass-hostname-YYYYDDMMHHMMSS.zip
- procmon-bypass-hostname-YYYYDDMMHHMMSS.zip
NOTE: If an item from the above list is missing, re-review the steps above and collect it.
- Rename the zip as perfcapture-<date>-logs.zip
- Upload the "perfcapture-<date>-logs.zip" file to the case for support to review
Option 2: Manually via CLI
Only use this manual option if running Sensor Version 4.2+ or if you cannot run the sensor_capture_script.ps1 Prerequisites- You will need an uninstall or deregistration code to authenticate for repcli.
- Create a folder where all logs will be saved. For the purposes of this document, this location will be referenced as c:\temp although the c:\temp file location can be replaced with whatever location you have specified for saving the log files.
- Procmon configured for a Low Altitude capture (may require reboot to setup).
- Windows Performance Recorder
- The command line version is included by default on Windows 10 and above.
- The Graphical User Interface can be installed for other versions.
|
Step 1: Authenticate with Repcli
Run the repcli unlock command
Version 4.2+:
Cd C:\Program Files\Broadcom\Endpoint Security Agent\CurrentVersion\bin64
repcli unlock <UninstallCode>
Version 4.1 and below:
cd c:\Program Files\Confer
repcli unlock <UninstallCode>
Step 2: Reproduce the behavior when Sensor is Active
Windows performance Recorder (WPR) Capture
- Open a command line prompt using "Run as Administrator".
- Run the following command to start the WPR Trace (ETL) Log and reset counters depending on the estimated time needed to reproduce
Less than 5 Minutes
C:\temp>wpr -start GeneralProfile -start CPU -start Registry -start FileIO -start DiskIO -start Minifilter -start Network -filemode
More than 5 Minutes
C:\temp>wpr -start GeneralProfile -start CPU -start Registry -start FileIO -start DiskIO -start Network -filemode
- Reproduce the behavior
- Document exact steps taken to reproduce to provide to Support
- Note local machine time when testing started, and timezone of machine
- Note local time when issue occurred
- Collect the wpr-active.etl, counters.txt, and psc_sensor.zip
repcli counters > C:\temp\counters-wpr-active.txt -- Change to desired location
wpr -stop c:\temp\wpr-active.etl
repcli capture c:\temp -- Change to desired location
Collecting diagnostic data (this may take a few minutes)...
....
Captured diagnostic data in c:\temp\psc_sensor.zip
- Rename psc_sensor.zip to psc_sensor.zip-wpr-active
Procmon Capture
- Run the following commands to collect the Procmon, Sensor logs, Counter logs:
- Sensor Version 4.2+
repcli deletepolicy 1DED7E47-CE4C-448E-AD01-6F4AC3CE7F5D
repcli resetcounters
- Sensor Version 4.1 and below:
sc qprotection cbdefense --Result will show either ANTIMALWARE LIGHT or None. If none skip to step H.
repcli bypass 1
repcli registerProtectedSvcs 0
repcli stopCbServices
sc start cbdefense
repcli bypass 0
repcli deletepolicy 1DED7E47-CE4C-448E-AD01-6F4AC3CE7F5D
repcli resetcounters
- Launch Procmon.exe
- Start collection in Procmon (CTRL+E)
- Reproduce the behavior
- Document exact steps taken to reproduce to provide to Support
- Note local machine time when testing started, and timezone of machine
- Note local time when issue occurred
- Stop collection in Procmon (CTRL+E) and save the log file
- In the Save pop-up window, Select "Events to save: All events" and "Format: PML"
- Change the file name to procmon-active.PML
- Click "Save" and save to C:\temp
- Run commands to collect counters.txt and psc_sensor.zip
repcli counters > C:\temp\counters-procmon-active.txt -- Change to desired location
repcli capture c:\temp -- Change to desired location
Collecting diagnostic data (this may take a few minutes)...
....
Captured diagnostic data in c:\temp\psc_sensor.zip
- Rename psc_sensor.zip to psc_sensor-procmon-active.zip
Step 3: Reproduce the behavior when Sensor is in Bypass
Windows performance Recorder (WPR) Capture
- Place the sensor into bypass mode:
repcli bypass 1
- Run the following command to start the WPR Trace (ETL) Log and reset counters depending on the estimated time needed to reproduce
Less than 5 Minutes
C:\temp>wpr -start GeneralProfile -start CPU -start Registry -start FileIO -start DiskIO -start Minifilter -start Network -filemode
More than 5 Minutes
wpr -start GeneralProfile -start CPU -start Registry -start FileIO -start DiskIO -start Network -filemode
- Reproduce the behavior
- Document exact steps taken to reproduce to provide to Support
- Note local machine time when testing started, and timezone of machine
- Note local time when issue occurred
- Collect the wpr-bypass.etl
C:\temp>wpr -stop c:\temp\wpr-bypass.etl
Procmon Capture
- Launch Procmon.exe
- Start collection in Procmon (CTRL+E)
- Reproduce the behavior
- Document exact steps taken to reproduce to provide to Support
- Note local machine time when testing started, and timezone of machine
- Note local time when issue occurred
- Stop collection in Procmon (CTRL+E) and save the log file
- In the Save pop-up window, Select "Events to save: All events" and "Format: PML"
- Change the file name to procmon-bypass.PML
- Click "Save" and save to C:\temp
- Run commands to restore sensor:
Step 4: Zip all the logs
Go to C:\temp and zip all the files that were created:
- wpr-active.etl
- counters-wpr-active.txt
- psc_sensor-wpr-active.zip
- wpr-bypass.etl
- procmon-active.PML
- counters-procmon-active.txt
- psc_sensor-procmon-active.zip
- procmon-bypass.PML
- Rename the zip capture as perfcapture-<Date>-logs.zip
- Upload the "perfcapture-<date>-logs.zip" file to the case for support to review
macOS
- Collect Carbon Black Cloud Sensor Logs Locally
- Sysdiagnose results: Attempt to replicate the performance issue while executing Diagnose MacOS Network Issues Using Network Extension Diagnostics
- Replicate the issue while Activity Monitor is running
- Attach the log bundles to your support ticket with Broadcom support.
Linux
Note: For CPU performance issues, confirm that the total usage is greater than 200% (2 CPU cores) sustained, because according to the Linux Sensor OER, the sensor is designed to use up to 2 full CPU cores during times of high event creation by default and still considered functional.
Determine the baseline for what is considered "typical utilization", for instance: "My application normally handles X transactions/second, with the sensor installed, it handles less transactions/second”
- Ensure the utility "perf" is installed
- Save the following code as a bash file, then run it from the affected machine as superuser, while the issue is present:
#!/bin/bash
DIRNAME=$(hostname)_cbc-perf-$(date +%Y-%m-%d_%H-%M-%S)
mkdir $DIRNAME
cd $DIRNAME
echo "VMWare Carbon Black Cloud - Performance Metrics Gathering Script"
echo "Working..."
top -b -n 10 > cbc-kmod.top
ps -efT > cbc-kmod.ps
ps -efo uid,pid,pcpu,rss,spid,ppid,c,stime,tty,time,comm > cbc-cpu.ps
#vmstat output
vmstat 3 10 > cbc.vmstat
#iostat output
iostat 3 10 > cbc.iostat
#Backup kptr_restrict
cp /proc/sys/kernel/kptr_restrict ./kptr_restrict_$(date +%Y-%m-%d_%H-%M-%S)
# Get kptr_restrict value
old_kptr_restrict=$(cat /proc/sys/kernel/kptr_restrict)
# Disable kptr_restrict for a moment
echo 0 > /proc/sys/kernel/kptr_restrict
# Record everything for 15 seconds
echo "Sleeping for 15ish seconds ..."
perf record -o cbc-perf_sleep_15.data -F 99 -a -g sleep 15
# Dump human readable data to file for easier reading
perf report -i cbc-perf_sleep_15.data --hierarchy > cbc-perf_sleep_15.stdio
# Copy kallsyms for kmod addresses
cp /proc/kallsyms .
cd ..
# Restore kptr_restrict
echo "${old_kptr_restrict}" > /proc/sys/kernel/kptr_restrict
tar -zcf $DIRNAME.tgz $DIRNAME
rm -rf $DIRNAME
echo "Wrote $DIRNAME.tgz"
echo "Please share $DIRNAME.tgz with support"
- The script will output a compressed file with a .tgz extension
- Collect Historical Carbon Black Cloud Sensor Logs
- Bundle the two files and upload them to the case.
In cases where the cbagentd memory consumption is raising rapidly beyond 5GB+ within few minutes, perform below steps:
- Stop and Start CBC Linux Sensor, and then enable below following debugs:
[root@ log]# sudo systemctl stop cbagentd
[root@ log]# sudo systemctl start cbagentd
[root@ log]# /opt/carbonblack/psc/bin/repcli debug 1
Sensor is in debug mode
[root@ log]# /opt/carbonblack/psc/bin/repcli debug-th 1
threat-hunter is in debug mode
- Enable strace logging (The strace logging have to be running for a short period of time):
strace -fkt -o strace.out -p `pgrep cbagentd` -e trace=mmap,munmap,brk
- Keep tracking the memory consumption, and if it hits the maximum or goes above 7GB, then stop the debugs and the strace logging (Ctrl+c), and collect debug logs:
#For stopping the debugging of cbc sensor
[root@ log]# /opt/carbonblack/psc/bin/repcli debug 0
[root@ log]# /opt/carbonblack/psc/bin/repcli debug-th 0
- Collect the stract.out, and the debug logs and attach it to your support ticket with Broadcom support.