tencent cloud

All product documents
Cloud Log Service
URL Function
Last updated: 2024-03-20 11:47:49
URL Function
Last updated: 2024-03-20 11:47:49
This document introduces the basic syntax and examples of URL functions.

Syntax Format

URL functions can extract fields from standard HTTP URLs. The following is an example of a standard URL:
[protocol:][//host[:port]][path][?query][#fragment]
Note:
The extracted fields do not include URL delimiters : and ?.

Common URL Functions

Function
Description
Example
Output
url_extract_fragment(url)
Extracts fragment from the URL. The result is of the varchar type.
* | select url_extract_fragment('https://console.cloud.tencent.com/#/project/dashboard-demo/categoryList')
/project/dashboard-demo/categoryList
url_extract_host(url)
Extracts host from the URL. The result is of the varchar type.
* | select url_extract_host('https://console.cloud.tencent.com/cls')
console.cloud.tencent.com
url_extract_parameter(url, name)
Extracts the value of query from the URL. The result is of the varchar type.
* | select url_extract_parameter('https://console.cloud.tencent.com/cls?region=ap-chongqing','region')
ap-chongqing
url_extract_path(url)
Extracts path from the URL. The result is of the varchar type.
* | select url_extract_path('https://console.cloud.tencent.com/cls?region=ap-chongqing')
/cls
url_extract_port(url)
Extracts port from the URL. The result is of the bigint type.
* | select url_extract_port('https://console.cloud.tencent.com:80/cls?region=ap-chongqing')
80
url_extract_protocol(url)
Extracts protocol from the URL. The result is of the varchar type.
* | select url_extract_protocol('https://console.cloud.tencent.com:80/cls?region=ap-chongqing')
https
url_extract_query(url)
Extracts the key of query from the URL. The result is of the varchar type.
* | select url_extract_query('https://console.cloud.tencent.com:80/cls?region=ap-chongqing')
region=ap-chongqing
url_encode(value)
Escapes value so that it can be used in URL_query.
Letters will not be decoded.
.-*_ will not be encoded.
Spaces are decoded as +.
Other characters are decoded into the UTF-8 format.
* | select url_encode('https://console.cloud.tencent.com:80/cls?region=ap-chongqing')
https%3A%2F%2Fconsole.cloud.tencent.com%3A80%2Fcls%3Fregion%3Dap-chongqing
url_decode(value)
Decodes the URL.
* | select url_decode('https%3A%2F%2Fconsole.cloud.tencent.com%3A80%2Fcls%3Fregion%3Dap-chongqing')
https://console.cloud.tencent.com:80/cls?region=ap-chongqing

Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support
Hong Kong, China
+852 800 906 020 (Toll Free)
United States
+1 844 606 0804 (Toll Free)
United Kingdom
+44 808 196 4551 (Toll Free)
Canada
+1 888 605 7930 (Toll Free)
Australia
+61 1300 986 386 (Toll Free)
EdgeOne hotline
+852 300 80699
More local hotlines coming soon