Collecting Sensor Performance Logs with Sensor Capture Script
book
Article ID: 284850
calendar_today
Updated On:
Products
Carbon Black Cloud Endpoint Standard (formerly Cb Defense)Carbon Black Cloud Enterprise EDR (formerly Cb Threathunter)
Issue/Introduction
Steps to collect Process Monitor (Procmon) Logs, Windows Performance Recorder (WPR) ETL Trace, and Sensor Diagnostic logs with Sensor Capture Script for troubleshooting issues sensor performance issues
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 the Support Case
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: 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
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 2: 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
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 3: 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
Additional Information
The ProcmonLowAlt.zip attached to How to Collect a low Altitude Procmon Capture was modified so that the configuration steps and reboot typically required if procmon is downloaded directly from Microsoft are not necessary; however, the modified version of procmon included in ProcmonLowAlt.zip has not been signed
The WPR Trace cannot be collected at the same time as a Procmon Log
Sensor Capture Script resets counters by default unless skipreset is specified
The keepevents parameter requires the uninstall code even if "Require code to uninstall sensor" is not enabled on the sensor policy
The PSC events should be collected separately from procmon and wpr if possible