@@ -298,13 +298,14 @@ public void testWlsLoggingExporter() throws Exception {
298
298
299
299
// Verify that serverName:managed-server1 is filtered out
300
300
// by checking the count of logs from serverName:managed-server1 is zero and no failures
301
- // e.g. when running the query:
302
- // curl -X GET http://elasticsearch.default.svc.cluster.local:9200/wls/_count?q=serverName:managed-server1
303
- // Expected return result is:
304
- // {"count":0,"_shards":{"total":5,"successful":5,"skipped":0,"failed":0}}
305
- regex = ".*count\" :(\\ d+),.*failed\" :(\\ d+)" ;
306
- String filteredServer = managedServerFilter .split ("-" )[1 ];
307
- queryCriteria = "/_count?q=serverName:" + filteredServer ;
301
+ regex = "(?m).*\\ s*.*count\" \\ s*:\\ s*(\\ d+),.*failed\" \\ s*:\\ s*(\\ d+)" ;
302
+ StringBuffer queryCriteriaBuff = new StringBuffer ("/doc/_count?pretty" )
303
+ .append (" -H 'Content-Type: application/json'" )
304
+ .append (" -d'{\" query\" :{\" query_string\" :{\" query\" :\" " )
305
+ .append (managedServerFilter )
306
+ .append ("\" ,\" fields\" :[\" serverName\" ],\" default_operator\" : \" AND\" }}}'" );
307
+
308
+ queryCriteria = queryCriteriaBuff .toString ();
308
309
verifyCountsHitsInSearchResults (queryCriteria , regex , WEBLOGIC_INDEX_KEY , true , "notExist" );
309
310
310
311
logger .info ("Query WebLogic log info succeeded" );
@@ -457,7 +458,7 @@ private void verifyCountsHitsInSearchResults(String queryCriteria, String regex,
457
458
int failedCount = -1 ;
458
459
String hits = "" ;
459
460
String results = execSearchQuery (queryCriteria , index );
460
- Pattern pattern = Pattern .compile (regex );
461
+ Pattern pattern = Pattern .compile (regex , Pattern . DOTALL | Pattern . MULTILINE );
461
462
Matcher matcher = pattern .matcher (results );
462
463
if (matcher .find ()) {
463
464
count = Integer .parseInt (matcher .group (1 ));
0 commit comments