Skip to content

Commit

Permalink
bugfix fitlering
Browse files Browse the repository at this point in the history
  • Loading branch information
cmcginley-splunk committed Oct 30, 2024
1 parent 4a5cc2f commit 1f2431f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions contentctl/objects/correlation_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,19 @@ def __next__(self) -> dict[str, Any]:
# log message at appropriate level and raise if needed
message = f"SPLUNK: {result.message}"
self.logger.log(level, message)
filtered = False
if level == logging.ERROR:
# if the error matches any of the filters, just continue on
# if the error matches any of the filters, flag it
for filter in self.error_filters:
if filter.match(message):
continue
self.logger.debug(f"Filter: {filter}; message: {message}")
if filter.match(message) is not None:
self.logger.debug(f"Error matched filter {filter}; continuing")
filtered = True
break

# if no filter was matched, raise
raise ServerError(message)
if not filtered:
raise ServerError(message)

# if dict, just return
elif isinstance(result, dict):
Expand Down

0 comments on commit 1f2431f

Please sign in to comment.