Event Management | How To Test Similarity Percentage for Tag Based Alert Cluster TagsSummary<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: #000000; } span { font-size: 12pt; font-family: Lato; color: #000000; } h2 { font-size: 24pt; font-family: Lato; color: black; } h3 { font-size: 18pt; font-family: Lato; color: black; } h4 { font-size: 14pt; font-family: Lato; color: black; } a { font-size: 12pt; font-family: Lato; color: #00718F; } a:hover { font-size: 12pt; color: #024F69; } a:target { font-size: 12pt; color: #032D42; } a:visited { font-size: 12pt; color: #00718f; } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } When a Tag Based Alert Clustering (TBAC) Tag's Match Method is Fuzzy the configured alert field value has to be an approximate match for alerts to be included in a group depending on the value specified in the TBAC Tag's Similarity field.For example, Similarity set to 50 indicates that at least 50 percent of the indicated value must appear in the alert for the alert to be included in the group.When creating a new TBAC Tag or when troubleshooting Alerts that were expected to group based on the similarity set in a TBAC Tag you may want to test the actual similarity percentage between two character strings instead of simulating test events/alerts.This can be done through the background script in this KB which calls the same functions from Script Include EvtMgmtTagBasedComparators used by the Tag Based Clustering Engine.This script will take two character strings as inputs and will return the similarity percentage as the output. Facts<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: #000000; } span { font-size: 12pt; font-family: Lato; color: #000000; } h2 { font-size: 24pt; font-family: Lato; color: black; } h3 { font-size: 18pt; font-family: Lato; color: black; } h4 { font-size: 14pt; font-family: Lato; color: black; } a { font-size: 12pt; font-family: Lato; color: #00718F; } a:hover { font-size: 12pt; color: #024F69; } a:target { font-size: 12pt; color: #032D42; } a:visited { font-size: 12pt; color: #00718f; } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } The Tag Based Alert Clustering Engine application from the ServiceNow Store must be installed on your instance for the script to work.The TBAC Tag's Similarity field will only accept whole number integers like 50, 85, 90, etc.The logic from EvtMgmtTagBasedComparators considers the strings a match if the similarity percentage is greater than or equal to the value in the Similarity field.If the similarity percentage for two strings you want to match is 80.99999999, then you would need to set the Similarity to 80.If the similarity percentage for two strings you do NOT want to match is 91.00000001, then you would need to set the Similarity to 92. Release<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: #000000; } span { font-size: 12pt; font-family: Lato; color: #000000; } h2 { font-size: 24pt; font-family: Lato; color: black; } h3 { font-size: 18pt; font-family: Lato; color: black; } h4 { font-size: 14pt; font-family: Lato; color: black; } a { font-size: 12pt; font-family: Lato; color: #00718F; } a:hover { font-size: 12pt; color: #024F69; } a:target { font-size: 12pt; color: #032D42; } a:visited { font-size: 12pt; color: #00718f; } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } All Releases Instructions<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: #000000; } span { font-size: 12pt; font-family: Lato; color: #000000; } h2 { font-size: 24pt; font-family: Lato; color: black; } h3 { font-size: 18pt; font-family: Lato; color: black; } h4 { font-size: 14pt; font-family: Lato; color: black; } a { font-size: 12pt; font-family: Lato; color: #00718F; } a:hover { font-size: 12pt; color: #024F69; } a:target { font-size: 12pt; color: #032D42; } a:visited { font-size: 12pt; color: #00718f; } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } 1. Navigate to the System Definition > Scripts - Background module 2. Paste the below background script to the text box to enter JavaScript 3. Add the two character strings you want to compare to string1 and string2 on lines 2 and 3 of the script 4. Click the Run Script button. // 1 // Enter the values of the two strings to compare below. var string1 = "1 hour interval average of 0.98 Mbit/s (Traffic In) is unusually low for this hour of the week"; var string2 = "1 hour interval average of 1.23 Mbit/s (Traffic In) is unusually low for this hour of the week"; // 2 // Click Run Script ////////////////////////////////////////////////////////////////// var comparator = new sn_em_tbac.EvtMgmtTagBasedComparators(); similarity = comparator._levenshteinAlgorithm(string1,string2)* 100; var simString = similarity.toString(); if(simString.length > 2){ for(i=3;i<simString.length;i++){ if(simString[i] != 0){ similarity = simString.slice(0,i + 1); break; } } } gs.info(similarity); ////////////////////////////////////////////////////////////////// Related Links<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: #000000; } span { font-size: 12pt; font-family: Lato; color: #000000; } h2 { font-size: 24pt; font-family: Lato; color: black; } h3 { font-size: 18pt; font-family: Lato; color: black; } h4 { font-size: 14pt; font-family: Lato; color: black; } a { font-size: 12pt; font-family: Lato; color: #00718F; } a:hover { font-size: 12pt; color: #024F69; } a:target { font-size: 12pt; color: #032D42; } a:visited { font-size: 12pt; color: #00718f; } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } ServiceNow Product Documentation Event Management tag based alert clustering tag form ServiceNow Store Tag Based Alert Clustering Engine