@@ -218,7 +218,7 @@ private void applyConfig(Object config_, AppSecModuleConfigurer.Reconfiguration
218218 List <String > errors = new ArrayList <>();
219219 try {
220220 // ddwaf_init/update
221- success = initializeNewWafCtx (reconf , config , curCtxAndAddresses , errors );
221+ success = initializeNewWafCtx (reconf , config , curCtxAndAddresses );
222222 } catch (Exception e ) {
223223 throw new AppSecModuleActivationException ("Could not initialize/update waf" , e );
224224 } finally {
@@ -227,18 +227,13 @@ private void applyConfig(Object config_, AppSecModuleConfigurer.Reconfiguration
227227 } else {
228228 WafMetricCollector .get ().wafUpdates (currentRulesVersion , success );
229229 }
230- if (!errors .isEmpty ()) {
231- log .error ("Errors during WAF initialization: {}" , errors );
232- WafMetricCollector .get ().addWafConfigError (errors .size ());
233- }
234230 }
235231 }
236232
237233 private boolean initializeNewWafCtx (
238234 AppSecModuleConfigurer .Reconfiguration reconf ,
239235 CurrentAppSecConfig config ,
240- CtxAndAddresses prevContextAndAddresses ,
241- List <String > errors )
236+ CtxAndAddresses prevContextAndAddresses )
242237 throws AppSecModuleActivationException , IOException {
243238 CtxAndAddresses newContextAndAddresses ;
244239 RuleSetInfo initReport = null ;
@@ -286,10 +281,9 @@ private boolean initializeNewWafCtx(
286281 if (initReport != null
287282 && initReport .getErrors () != null
288283 && !initReport .getErrors ().isEmpty ()) {
289- errors .addAll (
290- initReport .getErrors ().values ().stream ()
291- .flatMap (List ::stream )
292- .collect (Collectors .toList ()));
284+
285+ WafMetricCollector .get ()
286+ .addWafConfigError (initReport .getErrors ().values ().stream ().mapToInt (List ::size ).sum ());
293287 }
294288 } catch (InvalidRuleSetException irse ) {
295289 initReport = irse .ruleSetInfo ;
0 commit comments