CATEGORY::lookup¶
Description¶
This command (requires SWG license) returns a list of categories returned by the categorization engine depending on the category type specified (custom, request_default, or request_default_and_custom). If no type is specified, it will return request_default. If the “-display” flag is used, it will return the string with category only, otherwise it will return the string as a category name with the partition to which it belongs.
The URL needs to be of the form:
scheme://domain:port/path?query_string#fragment_id
The query_string and fragment_id are optional. The entire list of categories supported is available in the UI under “Secure Web Gateway” in the APM section. Examples of categories include Sports, Shopping, etc. The response is a list of category names in a TCL array. Most input URLs result in a single category but some will return more than one. Additionally, a result of “199” indicating a recommendation to scan the response can also be returned.
To obtain a full list of the category names that can be returned, run the following TMSH command:
tmsh list sys url-db url-category | grep url-category | cut -d ” ” -f4
The custom_cat_match option will allow lookup of the URL in one specified custom category. To see a list of custom categories to choose from, run the following TMSH command:
tmsh list sys url-db url-category one-line | grep “is-custom true” | cut -d ” ” -f4
Syntax¶
CATEGORY::lookup URL [-display] [request_default | request_default_and_custom | custom] [-ip <IP>] [-custom_cat_match <any_chars>]
Examples¶
when HTTP_REQUEST {
set this_uri http://[HTTP::host][HTTP::uri]
set reply [CATEGORY::lookup $this_uri]
log local0. "Category lookup for $this_uri give $reply"
}