Instead of exiting with an uncaught exception on a badly formatted
modify filter, convert the exception to an ApplicationError that
will be logged, along with the line that is badly formatted.
Redmine issue:
https://redmine.openinfosecfoundation.org/issues/3536
line = line.rsplit(" #")[0]
line = re.sub(r'\\\$', '$', line) # needed to escape $ in pp
- rule_filter = matchers_mod.ModifyRuleFilter.parse(line)
- if rule_filter:
+ try:
+ rule_filter = matchers_mod.ModifyRuleFilter.parse(line)
filters.append(rule_filter)
- else:
- log.error("Failed to parse modify filter: %s" % (line))
+ except Exception as err:
+ raise exceptions.ApplicationError(
+ "Failed to parse modify filter: {}".format(line))
return filters