File-Based Discovery Deep DiveSummary<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: var(--now-color--text-primary, #000000); } span { font-size: 12pt; font-family: Lato; color: var(--now-color--text-primary, #000000); } h2 { font-size: 24pt; font-family: Lato; color: var(--now-color--text-primary, black); } h3 { font-size: 18pt; font-family: Lato; color: var(--now-color--text-primary, black); } h4 { font-size: 14pt; font-family: Lato; color: var(--now-color--text-primary, black); } a { font-size: 12pt; font-family: Lato; color: var(--now-color--link-primary, #00718F); } a:hover { font-size: 12pt; color: var(--now-color--link-primary, #024F69); } a:target { font-size: 12pt; color: var(--now-color--link-primary, #032D42); } a:visited { font-size: 12pt; color: var(--now-color--link-primary, #00718f); } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } File-Based Discovery (FBD) Technical Reference Guide Complete technical documentation for ServiceNow File-Based Discovery implementation, configuration, and troubleshooting Table of Contents Phase 0: Setup & ActivationPhase 1: Probe ExecutionPhase 2: Sensor LogicPhase 3: FileBasedDiscoveryAPIPhase 4: Configuration & PropertiesPhase 5: Troubleshooting Phase 0: Setup & Activation Goal: Activate required FBD plugins and verify prerequisites Prerequisites ServiceNow instance with SAM (Software Asset Management) moduleMID Server(s) deployed and activeWindows 7+ or Unix/Linux target systemsLocal administrator or equivalent privilegesPowerShell 3.0+ (Windows)Standard shell access (Unix/Linux) Step 1: Activate FBD Plugins Navigate to System Applications > PluginsSearch for File-based DiscoveryActivate the following plugins: Plugin NamePlugin IDStatusFile-based Discoverycom.snc.discovery.file_based_discoveryActiveSoftware Asset Management - File Signature Normalizationcom.snc.file_signature_normalizationActiveSoftware Asset Management Professionalcom.snc.sampActive ✓ Phase 0 Complete: FBD plugins activated. Proceed to Phase 1. Phase 1: Probe Execution Goal: Collect file metadata from Windows and Unix/Linux targets The probe executes on target systems to discover files and extract metadata. Separate probe implementations exist for Windows (PowerShell) and Unix/Linux (shell script). 1.1 Windows Probe Execution Probe Placement & Initialization MID Server places PowerShell script on target: C:\Windows\Temp\snc_fbd_probe_<randomId>.ps1Execution parameters: Scan directories: c:\program files*|c:\windowsFile extensions: .exe|.dll|.jar|.aspx|.vbs|.batMax files: 10000Instance ID: discovery_12345 Executes via WinRM with full command path and parameters PowerShell Startup Sequence Checks PowerShell version (≥ 3.0 required)Creates temp file: C:\Windows\Temp\snc_tmp_discovery_12345.tmpSets process priority to IdleLoads scan parameters Directory Traversal & File Collection Depth-first directory traversal with 10-second throttle sleep between directory scans to avoid target system overload. FileSize (bytes)FileVersionProductVersionAcroRd32.exe20485762023.001.123452023.001Acrobat.dll10240002023.001.100002023.001 ℹ️ Note: Files not matching specified extensions are skipped. Non-PE files omit version information. Output Format Results written to snc_tmp_discovery_12345.tmp with special markers: | = directory markerPipe-delimited file info: filename|size|fileVersion|productVersion# = completion message> = summary statistics Scan Completion Temp file renamed on completion: BEFORE: C:\Windows\Temp\snc_tmp_discovery_12345.tmp (IN PROGRESS)AFTER: C:\Windows\Temp\snc_tmp_discovery_12345.result (COMPLETE) 1.2 Unix/Linux Probe Execution Goal: Collect file metadata from Unix/Linux targets using an SSH-executed shell script. Probe Execution MID Server copies the script to the target: /tmp/snc_fbd_probe_<randomId>.sh Executes via SSH with parameters such as: Scan directories: /usr|/opt|/bin|/sbinFile extensions: .so|.jar|.sh|.pl|.pyMax files: 10000Instance ID: discovery_12345 Scan Process Creates a temporary output file: /tmp/snc_tmp_discovery_12345.tmp Uses standard Unix utilities (find, stat, file) to: Traverse directories recursivelyIdentify files matching configured extensionsCollect metadata such as file name, size, type, and version (when available) Output Format Results are written to the temporary file using markers: | = directory marker filename|size|version|product # = completion marker > = summary statistics Example: java|143360|17.0.8|OpenJDK libssl.so|684032|3.0.8|OpenSSL ℹ️ Note: Unlike Windows executables, Unix/Linux files often do not contain embedded version information, so version fields may be empty. Scan Completion The output file is renamed when the scan finishes: BEFORE: /tmp/snc_tmp_discovery_12345.tmp AFTER: /tmp/snc_tmp_discovery_12345.result The MID Server retrieves the result file and passes it to the File-Based Discovery sensor for processing. Phase 2: Sensor Logic Universal Sensor Logic (All Platforms) The following processing steps apply identically to Windows, Unix, and Linux: processJSON() — Main Entry Point Receives file discovery data from probe/MID Server (any platform)Normalizes and unpacks directory-mapped files into flat arrayHandles wildcard file paths separatelyChecks discovery status: STARTED → RUNNING → FINISHEDLogs messages uniformly across all systemsOrchestrates file identification and reconciliation pipeline Key Processing Steps StepDescriptionPlatform ScopeFile Data UnpackingTransforms discovered files into flat objects with name, path, size, versionAllFile FilteringRemoves files matching exclusion extensions (swid_tags_software_exclusion_list)AllSoftware IdentificationCalls FileBasedDiscoveryAPI.identifyFilePackages() to match files against known signaturesAll ℹ️ Key Point: FBD sensor logic is universal across all platforms. Probes differ by platform, but sensor processing is identical. ✓ Phase 2 Complete: All files processed uniformly with optional SAM enrichment. Proceed to Phase 3. Phase 3: FileBasedDiscoveryAPI Goal: Match files against signature database and populate output tables Data Flow Discovered Files → FileBasedDiscoveryAPI.identifyFilePackages() → File Signature Matching (samp_file_map: Rank 1 → Rank 0) → Publisher/Product Identification (samp_file_set enrichment) → cmdb_file_information → cmdb_sam_sw_install SAM Output Tables TableContentPlatformcmdb_file_informationFile metadata and fingerprints from FBDAllcmdb_sam_sw_installSoftware Installation records for discovered packagesAll ✓ Phase 3 Complete: API processed signatures and populated output tables. Configuration & Properties Goal: Configure FBD scan parameters and system properties Configuration Location All > Discovery Definition > Configuration Console Key Configuration Items Enable/Disable FBD: Master on/off switchScan Directories: Paths to scan (e.g., c:\program files*, /opt, /usr/local)File Extensions: Extensions to include (.exe, .dll, .jar, .so)Max Files: Maximum files per scan (default: 100000)Frequency: Scan frequency (monthly recommended)Performance Tuning: Sleep time and throttle settingsSWID Scanning: Enable/disable SWID tag collectionExclusions: Exclude paths and file patterns Troubleshooting Goal: Diagnose and resolve common FBD issues Issue 1: FBD is Disabled via System Property Problem: System property enabled=false Symptoms: FBD probes not runningNo file data collectedDiscovery logs show FBD disabled messages Resolution: Navigate to Configuration ConsoleVerify glide.discovery.file_discovery.enabled = trueSave and test Issue 2: CDS Content Has Not Been Synched Problem: Timestamps show 1970-01-01 in samp_file_* records Symptoms: File signatures not matchingIncorrect software identificationNo SAM output generated Resolution: Navigate to All > Discovery Definition > CDS Client ScheduleSelect cds_client_schedule recordClick Execute NowWait for sync completionRe-run FBD discovery Issue 3: Interval Has Not Passed Since Last Execution Problem: Scheduled frequency not yet expired Symptoms: Discovery skipping scheduled FBD scansScheduled probes not runningStale file data in CMDB Resolution: Navigate to Configuration ConsoleAdjust glide.discovery.file_discovery.frequency propertySave changesRe-run discovery manually or wait for next scheduled interval For questions or updates, contact ServiceNow support team