To troubleshoot performance issues, you can use the regex-diagnosis tool, which lets you know about how much time was needed to process individual Regex (Regular expression) terms.
The tool is stored in a folder with system files on Web Gateway. The path to it is /opt/mwg/bin. You can run the tool from a system console.
To evaluate Regex terms, you specify two files as parameters of the tool command. One that includes these terms and another that they are compared with to detect matches.
regex-diagnosis tool - Usage
You can use the regex-diagnosis tool to evaluate the processing of Regex (Regular expression) terms regarding the time that is consumed by this processing.
The tool resides in the /opt/mwg/bin system files folder on a Web Gateway appliance.
Unless otherwise described, parameters are optional.
One of the files specified here can have — (dash) as its filename. The file is then retrieved from stdin.
Mode of execution
Either this parameter or -f must be specified.
com.scur.type.regex.* file from /opt/mwg/storage/ area.
Either this parameter or -m must be specified.
|-r <filename>||Raw Regex input file.|
|-d <filename>||Text file with string data to match the data in the file specified under- -f <filename> or -r <filename>.|
Evaluate Regex terms with the regex-diagnosis tool
Use the regex-diagnosis tool to evaluate the processing of Regex (Regular expression) terms regarding the time consumed.
In the following sample evaluation, two files with lists of Regex terms are compared with a list in a default file for matches.
The time needed for detecting any matches is provided by the tool. The time is also provided if no match could be detected.
- From a system console, connect to the Web Gateway appliances where the files with the Regex terms that you want to evaluate reside.
- Run the following command to start the tool.
/opt/mwg/bin/regex-diagnosis -m mwg -f /opt/mwg/storage/subscribed_lists/update_server/ com.scur.type.regex.3216.xml -d -
- Review the tool output. It might look as follows.
Regex mode : mwg Regex filename: /opt/mwg/storage/subscribed_lists/update_server/ com.scur.type.regex.3216.xml Data filename : - successfully opened '/opt/mwg/storage/subscribed_lists/update_server/ com.scur.type.regex.3216.xml' with mode: 'r' https://some.url.not.in.the.list.com https://some.url.in.the.list.office365.com #2 data elements in file - data = https://some.url.not.in.the.list.com, match = false, matching Regex = '', CPU time used: 0.144074 ms data = https://some.url.in.the.list.office365.com NRE: First match='.office365.com' NRE: Found match='.office365.com' NRE: Matched regex/glob='*.office365.com' , match = true, matching Regex = '*.office365.com', CPU time used: 0.193654 ms Summary: #0 compilation errors, #1 matches, #1 mismatches, #0 exceptions
As a result from evaluating the Regex terms in these files, the following was found:
- The some.url.not.in.the.list list produced no matches.
CPU time needed to find this out: 0.144074 ms.
- The some.url.not.in.the.list.office365 list produced one match: *.office365.com.
CPU time needed to find this out: 0.193654 ms.