Write rules for URL grouping
Write rules to group URLs based on criteria that matches your business specifications, and organize data to match your business needs. Group URLs by path, domain, and parameters.
Splunk RUM automatically groups URLs together that capture errors and metrics such as page load and route change duration, JavaScript errors, backend errors, and Web vitals. This topic explains how to write rules to group URLs based on your own criteria so that you can organize your data in a way that maximizes its meaningfulness to you.
There are two versions of this feature:
| Version 1 features | Version 2 features |
|---|---|
|
Generates page-level metrics ( To migrate your rules to v2, see Migrate to v2. |
|
Key concepts
| Term | Definition |
|---|---|
|
Components of a URL |
For Splunk RUM, the components of a URL are:
For example, in the URL
Fragments introduced by a |
|
Domain |
The domain consists of a top-level domain and any prefixed subdomains. Host tokens are separated by a dot ( |
|
Hash token ( |
Single-page applications often use a hash token (#) to introduce a fragment or hash-based route. To match a hash-based route in a V2 URL grouping rule, include # and the relevant fragment structure in the path pattern. For example, Host pattern: Path pattern: The host and path must be entered separately. Do not include the scheme or host in the path pattern. |
|
Path |
Path components are separated by a forward slash symbol ( |
|
Pattern |
The pattern is the most important component of a rule. The pattern defines the common portion in the path or domain that is shared by all URLs that match the rule. Patterns also consist of tokens, like the domain and path in the URL. Wildcards match variable text in a URL's host or path. In V2, wildcards can match text within a token. Greedy wildcards can also span multiple tokens and match zero characters. |
| Parameter |
Also called query parameter. In addition to host and path, v2 rules can require specific query parameters to be present with values matching a pattern. All six wildcards (<?>, <??>, <*>, <**>, <w*>, <w**>) are supported in the value pattern, and unlike host or path segments, the value pattern has no delimiter, so non-greedy wildcards (<?>, <*>, <w*>) can appear anywhere in the value and can be freely combined with literal characters inside a single value (for example, order-<?> or v<w*>-beta). |
|
Rule |
A rule defines how Splunk RUM groups URLs. |
|
Token |
A token is a string appearing in a path between two forward slashes ( |
Pattern syntax
This section describes each rule pattern, examples of URLs that match this pattern, and examples of URLs that don’t match the pattern.
- Use greedy wildcards in v2 rules
-
-
Description: In v2 host and path patterns, greedy wildcards can appear at the beginning, middle, or end. They can match zero or more characters within a token, span multiple tokens, and continue matching literal text that follows. In query-parameter value patterns, greedy wildcards must remain at the end. The three greedy wildcards render their matches differently:
-
<**>preserves the matched text. -
<w**>preserves matched text that passes the word-like checks. -
<??>replaces the matched range with<??>.
-
-
Use case: When literal text follows a greedy wildcard, the wildcard matches the longest possible string that still allows the remaining pattern text to match.
-
Example:
/<??>.png-
/a.png→/<??>.png -
/.png→/<??>.png
-
A pattern can combine capturing and placeholder greedy wildcards.
-
Pattern:
/<**>/images/<??>.png -
Input:
/a/images/b/images/c.png -
Output:
/a/images/b/images/<??>.png
<**>takes the longest match that still allows /images/ and the rest of the pattern to match.<??>replaces the final variable text with the placeholder. -
-
<?>Single placeholder wildcard -
-
Description: Matches variable text within one host or path token and replaces the matched text with <?> in the normalized URL.
-
Use case: When you want to match but normalize to a placeholder instead of the actual value.
-
Example:
/products/<?>-
/products/product1→/products/<?> -
/products/product2→/products/<?> -
/products/product2/comments→ Not matched
-
-
-
<??>Greedy placeholder wildcard -
-
Description: Matches zero or more characters and replaces the matched text with
<??>in the normalized URL. The wildcard can match within a token, span multiple tokens, and continue matching literal text that follows the wildcard. -
Use case: Use
<??>to combine URLs with variable text into one normalized URL. -
Example:
/<??>.png-
/a.png→/<??>.png -
/.png→/<??>.png
-
A pattern can combine capturing and placeholder greedy wildcards. For example,
/a/images/b/images/c.png→/a/images/b/images/<??>.png.<**>takes the longest match that still allows /images/ and the rest of the pattern to match.<??>replaces the final variable text with the placeholder. -
-
<*>Single-token capturing wildcard -
-
Description: Matches variable text within one host or path token and preserves the matched text in the normalized URL.
-
Use case: When you need to capture and show the actual value in both normalized URL and group names.
-
Example:
/products/<*>-
/products/product1→/products/product1 -
/products/product2→/products/product2 -
/products/product2/comments→ Not matched
-
-
-
<**>Greedy capturing wildcard -
-
Description: Matches zero or more characters and preserves the matched text in the normalized URL. The wildcard can match within a token, span multiple tokens, and continue matching literal text that follows the wildcard.
-
Use case: Use
<**>to match variable text and retain that text in the normalized URL. -
Example:
/<**>.png-
/image.png→/image.png -
/images/image.png→/images/image.png -
/images/icons/user.png→/images/icons/user.png
-
-
-
<w*>Single-token word capturing wildcard -
-
Description: Matches word-like variable text within one host or path token and preserves the matched text in the normalized URL.
Matches:
maroon-5,7-eleven,iphone-14-pro,best-practices-2024,module-1-lesson-4,getting-started-guide.Does not match: UUIDs (
550e8400-e29b-41d4-a716-446655440000), pure digit strings (12345), long encoded tokens (aGVsbG93b3JsZGV4YW1wbGU...), segments longer than 100 characters, user IDs with low letter-to-symbol ratio.Supports enhanced pattern matching: Recognizes sophisticated patterns like
-
Hyphenated phrases:
5-reasons-to-use-ai,maroon-5,7-eleven -
Module identifiers:
module-1-lesson-4,chapter-2-section-3 -
Product names:
iphone-14-pro,windows-11-home -
Article titles:
best-practices-2024,getting-started-guide
-
-
Use case: When you want to only match and capture on sentence-like strings. In other words you want to prevent creating groups for high cardinality elements like UUIDs, user ids, timestamps, encoded binary data, and so on; when you want to group real route names without inflating metric cardinality from IDs, hashes, or timestamps that would otherwise appear in the URL.
-
Example:
/products/<w*>-
/products/product1→/products/product1 -
/products/12345→ Not matched
-
-
-
<w**>Greedy word capturing wildcard -
-
Description: Matches zero or more characters that pass the same word-like checks as
<w*>and preserves the matched text in the normalized URL. The wildcard can match within a token, span multiple tokens, and continue matching literal text that follows the wildcard. -
Use case: Use
<w**>to match and retain variable text while excluding high-cardinality values that do not pass the word-like checks. -
Example:
/<w**>/remoteEntry.js/app/remoteEntry.js-
/app/shell/remoteEntry.js -
Does not match: /remoteEntry.js
-
Separate multiple greedy wildcards
Separate multiple greedy wildcards in a host or path pattern with literal text or a host or path separator. The separator defines a distinct matching region for each greedy wildcard.
-
/<**>-<??>.png
-
/<**>_<??>.png
-
/<**>/<??>.png
-
/<**><??>.png
-
/<??><??>.png
-
/<**><*><**>.png
A non-greedy wildcard such as <*> does not provide meaningful separation between two greedy wildcards.
Validation and preview safeguards
V2 URL grouping enforces the following validation limits:
-
A V2 host or path pattern can contain up to 50 wildcard elements and 1,024 characters.
-
A V2 configuration can contain up to 500 enabled host or path patterns that either use a greedy wildcard (<**>, <w**>, or <??>) or contain more than five wildcards in a single host or path segment. Each host and path alternative counts separately.
-
A query-parameter value pattern can contain up to five wildcards. Greedy wildcards in query-parameter values must remain at the end.
Disabled rules do not count toward the 500-pattern limit, but their patterns must still be valid. Splunk RUM might reject a pattern within these limits if its combination of wildcards and literal text is too complex to evaluate safely. Simplify the pattern or divide it into multiple rules if this occurs. If a processing safety limit is reached while generating a preview, the preview is incomplete and displays a warning.
Syntax validation
| Pattern | v1 behavior | v2 behavior |
|---|---|---|
.A.B.C or A.B.C. |
Invalid. Host patterns cannot begin or end with a period (.). |
Invalid for the same reason as v1. |
A.<??>.C |
Invalid. <??> must be the final token in the pattern. |
Valid. <??> can span host tokens and continue matching at .C. |
<?>A.B.C |
Invalid. <?> must be separated from literal text by a period (.). |
Valid. |
/lor<?>/ipsum |
Invalid. <?> must be separated from literal text by forward slashes (/). |
Valid. |
lorem.ips<??> |
Invalid. <??> must be separated from literal text by a period (.). |
Valid. A greedy wildcard can match part of a host token. |
A/B/C |
Invalid. A path pattern must begin with a forward slash (/). |
Invalid. A path pattern must begin with / or #. |
/A/<??>/C |
Invalid. <??> must be the final token in the pattern. |
Valid. <??> can span path tokens and continue matching at /C. |
/A/B<?>/C |
Invalid. <?> must be separated from literal text by forward slashes (/). |
Valid. |
/<**><??>.png |
Invalid. | Invalid. Separate greedy wildcards with literal text or a host or path separator. |
Match a file at varying path depths
Use a greedy wildcard before a fixed file name when the file can appear at different path depths.
-
Host pattern:
app.example.com -
Path pattern:
/<w**>/remoteEntry.js
-
https://app.example.com/shell/remoteEntry.js
-
https://app.example.com/shell/orders/remoteEntry.js
-
https://app.example.com/shell/orders/history/remoteEntry.js
Because <w**> preserves the matched path, each URL can produce a different normalized URL.
To combine all variable prefixes into one normalized URL, use the path pattern /<??>/remoteEntry.js. These paths all normalize to /<??>/remoteEntry.js:
-
/app/remoteEntry.js -
/app/shell/remoteEntry.js -
/app/shell/orders/remoteEntry.js
Use cases
The following examples illustrate URL grouping strategies.
- Group API versions while retaining the function
-
Use
<?>to replace the API version and<*>to preserve the function. This combines different API versions of the same function while keeping different functions in separate groups.Example URLs
Pattern
Result
/api/v1/downloadimage/api/v2/downloadimage/api/v2/uploadimage/api/<?>/<*>/api/v1/downloadimage→/api/<?>/downloadimage/api/v2/downloadimage→/api/<?>/downloadimage/api/v2/uploadimage→/api/<?>/uploadimage - Group URLs by domain
-
Use
<?>to group together URLs with the same domain.Example URLs
Pattern
Result
sub3nds9.example.comsubfd89fs.example.comsub6f8sd.example.com<?>.example.comGroups URLs of multiple sub-domains.
- Group all URLs under a common path prefix
-
Use
<??>to replace everything after a common path prefix. This combines all matching URLs into one normalized URL, regardless of API version or function.Example URLs
Pattern
Result
/api/v1/downloadimage→/api/<??>/api/v2/downloadimage/api/<?>→/api/<??>/api/<??>All URLs normalize to
/api/<??>. - Group URLs by a pattern of multiple tokens
-
Use a combination of wildcards to group together URLs by a pattern of multiple tokens.
Pattern
Matches
Doesn't match
/<?>/v2/<??>/api/v2/users/api/v2/profiles/edit/app/v2/dashboard/123/api/v3/users/app/dashboard/v2/charts/app/v2
Create a new rule
Before you create a new rule, learn about your URLs. Identify the components and tokens. Figure out what kind of results you want to see. Review the pattern syntax and examples to better understand how to formulate rules that work for your data.
Host and path rules are combined to create the URL Name in the UI. Spans are retained for 8 days in Splunk RUM. For more, see Data retention in Splunk Observability Cloud.
- v1 rules
-
-
Review the default rules first: select .
-
Deactivate any default rules that create URL groups you don't want.
-
First add a domain rule, then you can add a path rule.
-
- v2 rules
-
-
Select .
-
On the Create grouping rule popup:
-
Select the priority (order) of the new rule.
-
Select the URL token for which you want to write a rule.
-
Select the application(s) you want to monitor. If you don't select an application, the new rule will apply to all applications.
-
Write the patterns by which you want to group the URLs. The pattern consists of 3 components:
-
Host pattern (required)
-
Path pattern
-
URL parameters (key-value pairs)
-
-
-
Select Add.
-
Select Apply.
View URL groups
<other> group.
Manage rules
Use an updated URL grouping system in Splunk Real User Monitoring.
Splunk RUM automatically groups URLs together based on default rules that capture errors and metrics such as page load and route change duration, JavaScript errors, backend errors, and web vitals.
Migrate to v2
Splunk RUM URL grouping v2 includes a unified rule structure system, richer wildcard matching, and query parameter grouping to better manage URL groups in Splunk RUM. In the new version, only one URL group is created after matching to a single rule. The previous logic created multiple groups based on all matching rules. Additionally, groups are created by evaluating all relevant parts of the URL (host, path, and query parameter matching), eliminating the need to coordinate separate host and path logic.
Select Start migration on the RUM URL Grouping page to begin migrating your existing rules to the new grouping system. Follow the guided workflow to review the impact to existing rules and dependencies that require manual updates. Most rules are matched exactly, resulting in no changed behavior. Additionally, review the list of dashboards and detectors where the impacted URL groups are used and confirm changes.
You can cancel the migration at any time before selecting Save with no impact to the URL grouping behavior. Your old URL grouping rules will also be saved. Metrics will populate for the new rules once they become active.
Edit a rule
Follow these steps to edit an existing rule:
data that has already been ingested.
-
Select the three dot symbol, then Edit.
-
Make your changes, then select Update.
Deactivate or reactivate a rule
Follow these steps to deactivate or reactivate an existing rule. When you deactivate a rule, Splunk RUM stops processing incoming data according to this rule. If you choose to deactivate a rule and then activate it again in the future, the rule is not applied to data that was already ingested by Splunk RUM.
-
Select the three dot symbol, then Edit
- Select the three dot symbol, then Edit.
-
Select Activate or Deactivate.
Delete a rule
Follow these steps to delete a rule:
-
Select the three dot symbol, then select .