add more
This commit is contained in:
@@ -75,9 +75,10 @@ def _rate_per_minute(events: list[LogEvent]) -> tuple[float | None, float]:
|
||||
|
||||
|
||||
def detect_source_anomalies(
|
||||
events: list[LogEvent], *, limit: int = 20, baselines: dict[str, dict[str, object]] | None = None
|
||||
events: list[LogEvent], *, limit: int = 20, baselines: dict[str, dict[str, object]] | None = None, field_deviations: dict[str, list[dict[str, object]]] | None = None
|
||||
) -> list[AnomalyFinding]:
|
||||
baselines = baselines or {}
|
||||
field_deviations = field_deviations or {}
|
||||
by_src: dict[str, list[LogEvent]] = defaultdict(list)
|
||||
for event in events:
|
||||
if event.src_ip:
|
||||
@@ -217,6 +218,10 @@ def detect_source_anomalies(
|
||||
score += 10
|
||||
reasons.append("public source with repeated security-relevant events")
|
||||
|
||||
for deviation in field_deviations.get(src_ip, []):
|
||||
score += int(deviation.get("score", 0))
|
||||
reasons.append(str(deviation.get("reason", "stream field baseline deviation")))
|
||||
|
||||
if not reasons:
|
||||
continue
|
||||
|
||||
|
||||
Reference in New Issue
Block a user