@@ -217,7 +217,7 @@ private void applyConfig(Object config_, AppSecModuleConfigurer.Reconfiguration
217217 List <String > errors = new ArrayList <>();
218218 try {
219219 // ddwaf_init/update
220- success = initializeNewWafCtx (reconf , config , curCtxAndAddresses , errors );
220+ success = initializeNewWafCtx (reconf , config , curCtxAndAddresses );
221221 } catch (Exception e ) {
222222 throw new AppSecModuleActivationException ("Could not initialize/update waf" , e );
223223 } finally {
@@ -226,18 +226,13 @@ private void applyConfig(Object config_, AppSecModuleConfigurer.Reconfiguration
226226 } else {
227227 WafMetricCollector .get ().wafUpdates (currentRulesVersion , success );
228228 }
229- if (!errors .isEmpty ()) {
230- log .error ("Errors during WAF initialization: {}" , errors );
231- WafMetricCollector .get ().addWafConfigError (errors .size ());
232- }
233229 }
234230 }
235231
236232 private boolean initializeNewWafCtx (
237233 AppSecModuleConfigurer .Reconfiguration reconf ,
238234 CurrentAppSecConfig config ,
239- CtxAndAddresses prevContextAndAddresses ,
240- List <String > errors )
235+ CtxAndAddresses prevContextAndAddresses )
241236 throws AppSecModuleActivationException , IOException {
242237 CtxAndAddresses newContextAndAddresses ;
243238 RuleSetInfo initReport = null ;
@@ -285,10 +280,9 @@ private boolean initializeNewWafCtx(
285280 if (initReport != null
286281 && initReport .getErrors () != null
287282 && !initReport .getErrors ().isEmpty ()) {
288- errors .addAll (
289- initReport .getErrors ().values ().stream ()
290- .flatMap (List ::stream )
291- .collect (Collectors .toList ()));
283+
284+ WafMetricCollector .get ()
285+ .addWafConfigError (initReport .getErrors ().values ().stream ().mapToInt (List ::size ).sum ());
292286 }
293287 } catch (InvalidRuleSetException irse ) {
294288 initReport = irse .ruleSetInfo ;
0 commit comments