OBLYTECH Logo
OBLYTECH Logo

Configure a license key discovery rule

To configure a license key discovery rule, create and test a parser for the vendor’s license file, then connect it to a License File Configuration record. Choose the matching filename, platform, and priority, and activate the discovery components so the agent can collect license information during file scanning.

Prepare to configure a license key discovery rule

A new vendor format needs two records that work together: one interprets the file’s contents, while the other identifies files that should reach that interpreter. Start with the parser because the matching rule needs a reference to it. A filename match without a suitable parser does not establish that the license details can be extracted correctly.

The role required for this configuration procedure is agent_client_collector_admin or discovery_admin. Before changing records, check the controls available on your instance and release. Keep the initial scope small enough to compare a known file with a known result, then extend coverage after that comparison succeeds.

Collect representative file content and record the expected product name, vendor, license key, and expiry date where present. Include examples with multiple license entries if the vendor can store several products in one file. These samples give you a concrete test target rather than relying on whether a script appears plausible.

Plan the sample files, target operating systems, and configuration owner together. The Discovery implementation roadmap can help place that work in the wider rollout. Keep this change focused on the vendor format and the matching conditions it needs.

Build the parser around the result contract

Enter sn_acc_vis_content_license_parser.list in the navigation menu to open License Parsers. Select New and populate Parser Name with a name that distinguishes the format being handled. A format-oriented name helps reviewers identify which parser belongs to a matching rule when a vendor has several file layouts.

The parser runs server-side JavaScript against the raw text from a matched file. Its job is to extract license details into result objects. Use product_name, vendor, license_key, and expiry_date as the result properties where the corresponding information is available. Do not substitute guessed values for missing source data.

Set the variable answer to an array. Put a separate result object into that array for each license entry found. Returning a single object for a file containing one license still fails the array requirement: the parser is considered invalid if answer is not an array.

Think through record boundaries before writing extraction logic. For example, a sample containing two products should produce two distinct objects, with each key and date attached to the correct product. A script that finds the right strings but combines fields from different entries has not passed a meaningful test.

Avoid treating a recognizable filename as evidence that the text follows the expected layout. As a review practice, compare samples from the vendor formats you intend to support and document their differences. This makes it easier to decide whether one parser can handle them clearly or whether separate configurations would be easier to maintain.

Test the parser with explicit expected output

Use the License Parser record’s Related Links section to find Test Parser. Fill sample_input with representative license file text and sample_output with the exact result expected from that text. Then select Test Parser. This exercises the same execution path that processes a file during a scan and compares the actual result with your expected result.

Start with a simple sample whose fields you can check manually. Follow with a sample containing multiple entries and one that lacks an optional expiry date. These are suggested test cases: choose them according to the vendor’s format, rather than inventing file structures the vendor does not use.

  • Check that the result is an array, including for a single entry.
  • Compare the number of result objects with the entries in the sample.
  • Verify that product, vendor, and key values belong together.
  • Check how an available expiry date appears in the expected result.

When a comparison fails, inspect the first difference between the expected and actual values. Correct either the extraction logic or an incorrectly prepared expectation, then rerun the test. Do not change the expected result merely to make a faulty extraction pass. Retain the sample and its intended result as review evidence for subsequent parser changes.

Define which files invoke the parser

After validation, enter sn_acc_vis_content_license_file_config.list in the navigation menu and create a License File Configuration record. This is the matching rule. Use display_name to give the rule a unique identity, and use parser to reference the parser you have tested.

Set file_name to the complete filename or the relevant partial name. The file_name_condition values are exact_match, starts_with, ends_with, and contains; exact_match is the default. Choose the condition from the actual naming convention. A partial-name condition deserves particular review because it may select unrelated files that share the same text.

Use file_extension when an extension helps narrow the match. Enter the extension without a leading dot. Set platform to all, windows, linux, or mac according to where the rule should apply; all is the default. Matching the intended operating systems reduces ambiguity when similar filenames exist across different software distributions.

The order field resolves priority when several rules could select a file. Its default is 100, and a smaller value takes precedence. Review overlapping filenames before assigning a lower number. Otherwise, a broader rule could outrank the rule designed for a particular vendor format.

The active field defaults to true and indicates whether the rule is in use. Review the filename condition, extension, platform, parser reference, and order together before allowing the rule into your scanning scope. For wider ownership and review practices, use the Discovery governance model.

Enable collection and verify the outcome

The matching rule needs the collection components enabled. Navigate to All > System Properties > All Properties, locate sn_acc_vis_content.enable_license_key_discovery, set Value to true, and select Save. The property defaults to false, so a completed parser and rule alone do not establish that collection is enabled.

Also check that the policy File Based Discovery Policy – License Key and the check definition File Based Discovery – License Key are active. With these components enabled, the agent uses its regular file-scanning activity to look for files selected by the configuration.

Review the outcome against your known sample rather than checking only whether records exist. Successful software catalog matching is part of the path by which discovered licenses appear in the appropriate tables. Verify the product association as well as the extracted key before considering the vendor format ready for broader use.

For help planning this work, see ServiceNow implementation.

Keep the acceptance evidence specific: which sample passed, which configuration selected it, which parser was referenced, and what license information resulted. The Discovery best practices page provides broader rollout guidance once this focused validation is complete.

Diagnose a rule that produces no usable license data

Separate selection, parsing, activation, and catalog matching during troubleshooting. If the expected file is outside the chosen platform or filename conditions, revisit the matching rule. If another rule can select the same file, compare order values before changing the parser.

If the intended parser is selected but the output is wrong, reproduce the issue with sample_input and sample_output. If that test succeeds, compare the real file’s layout with the sample. Keep changes narrow so you can identify which correction explains the improved result.

If the configuration looks correct but collection does not occur, review the property, policy, and check definition together. If data is extracted but the expected license outcome is missing, investigate the software catalog match. Track these checks in the Discovery automation opportunities discussion when planning repeatable validation work.

Questions about adjacent license collection scenarios

What if the license value is stored in the Windows registry?

Use License Registry Configuration records for registry paths and values. That collection path requires the SAM Professional plugin, com.snc.samp, and the Agent Client Collector for Visibility Content Windows agent on the endpoints. A file parser does not define registry entries.

How can registry configuration changes be applied immediately?

For registry collection, go to All > System Definition > Scheduled Jobs, locate Refresh License Key Config File, and select Execute Now. The role specified for the registry configuration procedure is agent_client_collector_admin or discovery_admin.

What does the registry configuration refresh produce?

Refresh License Key Config File collects active configuration records into LicenseKeyConfig.json for the agent. On its next run, the Windows agent queries the configured registry locations and returns the collected values to the instance.

What happens when a previously collected registry key disappears?

A previously detected registry key that is no longer found receives the status Absent. Registry-discovered values reside in License Keys, sn_acc_vis_content_license_keys, with links to the device CI, associated SAM product, and the CI’s assigned user.