Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

extract_url_pub_suffix

Use the extract_url_pub_suffix() function to return the public suffix of a given URL string (for example, "com", "org", "net").

Syntax

extract_url_pub_suffix ("<URL>")

Parameters

Name
Type
Required
Description

<URL>

string

Yes

The input string literal or field containing the URL from which the public suffix needs to be extracted.

Returns

The extract_url_pub_suffix() function returns a string representing the public suffix of the URL.

Usage notes

  • The function requires a string value representing a URL as input.

  • The function always returns the public suffix value in lowercase characters, regardless of the input URL's original casing.

  • This function is typically used within the alter stage to create new fields or modify existing ones based on extracted URL data, or within the filter stage for conditional logic.

Examples

Example 1: Basic public suffix extraction from a standard URL

Goal: Extract the public suffix from a common HTTPS URL.

XQL code:

Explanation: The query extracts "com" as the public suffix from the URL "https://www.paloaltonetworks.com".

Output:

EVENT_ID
EXTRACTED_PUB_SUFFIX

101

"com"

Example 2: Public suffix extraction from a URL with multiple suffixes/paths

Goal: correctly identify only the public suffix from a URL that includes subdomains and extended paths.

XQL code:

Explanation: The function correctly isolates "com" as the public suffix, ignoring subdomains and path components.

Output:

EVENT_ID
EXTRACTED_PUB_SUFFIX_COMPLEX

101

"com"

Example 3: Public suffix extraction with mixed-case input

Goal: Demonstrate that the function returns the public suffix in lowercase characters, even if the input URL contains uppercase letters.

XQL code:

Explanation: Despite "www.Example.Co.UK" having mixed casing, the function returns "uk" in all lowercase, demonstrating its built-in lowercasing behavior.

Output:

EVENT_ID
EXTRACTED_PUB_SUFFIX_LOWERCASE

101

"uk"

Example 4: Handling NULL input

Goal: Demonstrate the function's behavior when provided with a NULL input.

XQL code:

Explanation: Consistent with standard XQL function behavior, if the input to extract_url_pub_suffix() is NULL, the function returns NULL.

Output:

EVENT_ID
NULL_URL_INPUT
EXTRACTED_PUB_SUFFIX_FROM_NULL

101

NULL

NULL

Last updated

Was this helpful?