You need to enable JavaScript to run this app.
Torch Log Service

Torch Log Service

Copy page
Download PDF
SQL function
URL function
Copy page
Download PDF
URL function
This article introduces the syntax of URL functions supported by Log Service and provides usage examples for common scenarios.​
Function list​
tip​
In Log Service analysis statements (SQL statements), single quotes ('') are used to enclose string literals; unquoted or double-quoted ("") characters represent field names or column names. For example, 'time' represents a string, while time or "time" represents a field name or column name.​
​
Function name​
Function syntax​
Description​
URL_ENCODE(KEY)​
Encode the URL.​
URL_DECODE(KEY)​
Decode the URL.​
URL_EXTRACT_FRAGMENT(KEY)​
Extract fragment information from URL.​
URL_EXTRACT_HOST(KEY)​
Extract host information from the URL.​
URL_EXTRACT_PARAMETER(KEY, parameter ** name)​
Extract the value of a specified parameter from the Query part of the URL.​
URL_EXTRACT_PATH(KEY)​
Extract access path information from URL.​
URL_EXTRACT_PORT(KEY)​
Extracts port information from the URL.​
URL_EXTRACT_PROTOCOL(KEY)​
Extract protocol information from the URL.​
URL_EXTRACT_QUERY(KEY)​
Extracts the complete Query section from the URL.​
​
URL_ENCODE function​
The URL_ENCODE function encodes a URL.​
Function syntax​
  • Syntax format​
  • ​
    URL_ENCODE(KEY)​
    ​
  • Parameter description​
  • ​
    Parameter​
    Description​
    KEY​
    Field or expression representing a URL address.​
    ​
  • Return value description​
  • The return value is of Varchar type.​
Function example​
  • Scenarios​
  • Encode the value of the test_url_text field.​
  • Log sample​
  • ​​​
  • Query and analysis statements​
  • ​
    * | SELECT URL_ENCODE(test_url_text)​
    ​
  • Query and analysis results​
  • ​​​
URL_DECODE function​
The URL_DECODE function decodes URLs.​
function syntax​
  • syntax format​
  • ​
    URL_DECODE(KEY)​
    ​
  • parameter description​
  • ​
    Parameter​
    Description​
    KEY​
    Field or expression with an encoded URL address value.​
    ​
  • return value description​
  • the return value is of varchar type.​
function example​
  • scenarios​
  • decode the value of the test_url_text field.​
  • log example​
  • ​​​
  • search and analyze statement​
  • ​
    * | SELECT URL_DECODE(test_url_text)​
    ​
  • Query and analysis results​
  • ​​​
URL_EXTRACT_FRAGMENT function​
The URL_EXTRACT_FRAGMENT function extracts fragment information from a URL.​
Function syntax​
  • Syntax format​
  • ​
    URL_EXTRACT_FRAGMENT(KEY)​
    ​
  • Parameter description​
  • ​
    Parameter​
    Description​
    KEY​
    Field or expression with a URL value.​
    ​
  • Return value description​
  • The return value is of the Varchar type.​
Function example​
  • Scenarios​
  • Extract Fragment information from the test_url_text field value.​
  • Log sample​
  • ​​​
  • Query and analysis statements​
  • ​
    * | SELECT URL_EXTRACT_FRAGMENT(test_url_text) ​
    ​
  • Query and analysis results​
  • ​​​
URL_EXTRACT_HOST function​
The URL_EXTRACT_HOST function extracts Host information from a URL address.​
Function syntax​
  • Syntax format​
  • ​
    URL_EXTRACT_HOST(KEY)​
    ​
  • Parameter description​
  • ​
    Parameter​
    Description​
    KEY​
    Field or expression with a URL value.​
    ​
  • Return value description​
  • The return value is of Varchar type.​
Function example​
  • Scenarios​
  • Extract the Host information from the test_url_text field.​
  • Log example​
  • ​​​
  • Query and analysis statements​
  • ​
    * | SELECT URL_EXTRACT_HOST(test_url_text)​
    ​
  • Query and analysis results​
  • ​​​
URL_EXTRACT_PARAMETER function​
The URL_EXTRACT_PARAMETER function extracts the value of a specified parameter from the query part of a URL.​
Function syntax​
  • Grammar format​
  • ​
    URL_EXTRACT_PARAMETER(KEY, parameter name)​
    ​
  • Parameter description​
  • ​
    Parameter​
    Description​
    KEY​
    Field or expression with a URL address value.​
    parameter name​
    Parameter name from the Query part of the URL.​
    ​
  • Return value description​
  • The return value is of Varchar type.​
Function example​
  • Scenarios​
  • Extract the value of the region parameter from the url field.​
  • Log example​
  • ​Image​​
  • Query and analysis statements​
  • ​
    * | SELECT URL_EXTRACT_PARAMETER(url,'region') AS region​
    ​
  • Query and analysis results​
  • ​Image​​
URL_EXTRACT_PATH function​
The URL_EXTRACT_PATH function extracts the access path information from a URL.​
function syntax​
  • syntax format​
  • ​
    URL_EXTRACT_PATH(KEY)​
    ​
  • parameter description​
  • ​
    Parameter​
    Description​
    KEY​
    Field or expression with a URL address value.​
    ​
  • return value description​
  • the return value is of type Varchar.​
function example​
  • scenarios​
  • extract the access path information from the url field value.​
  • log sample​
  • ​Image​​
  • query and analyze statement​
  • ​
    * | SELECT URL_EXTRACT_PATH(url) AS path​
    ​
  • query and analysis results​
  • ​Image​​
URL_EXTRACT_PORT function​
The URL_EXTRACT_PORT function extracts port information from a URL.​
function syntax​
  • syntax format​
  • ​
    URL_EXTRACT_PORT(KEY)​
    ​
  • parameter description​
  • ​
    Parameter​
    Description​
    KEY​
    Field or expression with a URL address value.​
    ​
  • return value description​
  • the return value is of varchar type.​
Function example​
  • Scenarios​
  • Extract port information from the url field value.​
  • Log example​
  • ​
    url:http://localhost:8080​
    ​
  • Query and analysis statements​
  • ​
    * | SELECT URL_EXTRACT_PORT(url) AS port​
    ​
  • Query and analysis results​
  • ​Image​​
URL_EXTRACT_PROTOCOL function​
The URL_EXTRACT_PROTOCOL function extracts protocol information from a URL.​
Function syntax​
  • Syntax format​
  • ​
    URL_EXTRACT_PROTOCOL(KEY)​
    ​
  • Parameter description​
  • ​
    Parameter​
    Description​
    KEY​
    Field or expression with a URL address value.​
    ​
  • Return value description​
  • The return value is of type Varchar.​
Function example​
  • Scenarios​
  • Extract protocol information from the url field value.​
  • Log sample​
  • ​
    url:http://localhost:8080​
    ​
  • Query and analysis statements​
  • ​
    * | SELECT URL_EXTRACT_PROTOCOL(url) AS protocol​
    ​
  • Query and analysis results​
  • ​Image​​
URL_EXTRACT_QUERY function​
The URL_EXTRACT_QUERY function extracts the complete query part from a URL.​
Function syntax​
  • Syntax format​
  • ​
    URL_EXTRACT_QUERY(KEY)​
    ​
  • Parameter description​
  • ​
    Parameter​
    Description​
    KEY​
    Field or expression with a URL address value.​
    ​
  • Return value description​
  • The return value is of type Varchar.​
Function example​
  • Scenarios​
  • Extract query part information from the url field value.​
  • Log example​
  • ​
    url:http://localhost:8080/query?name=regan​
    ​
  • Retrieve and analyze statements​
  • ​
    * | SELECT URL_EXTRACT_QUERY(url) AS query​
    ​
  • Retrieve and analyze results​
  • ​Image​​
​
Last updated: 2026.02.05 15:56:04