Ny central normalisering
This commit is contained in:
@@ -4,6 +4,7 @@ import ipaddress
|
||||
from collections.abc import Iterable
|
||||
|
||||
from .models import LogEvent
|
||||
from .normalization import canonical_value
|
||||
|
||||
|
||||
ENTITY_FIELDS: dict[str, tuple[str, ...]] = {
|
||||
@@ -46,13 +47,13 @@ def sample_timeline(events: Iterable[LogEvent], *, limit: int = 20) -> list[dict
|
||||
{
|
||||
"stream": event.fields.get("fgai_stream", "local_syslog"),
|
||||
"timestamp": event.fields.get("eventtime", event.fields.get("timestamp", "")),
|
||||
"type": event.fields.get("type", ""),
|
||||
"type": canonical_value(event.fields, "type"),
|
||||
"subtype": event.subtype,
|
||||
"action": event.action,
|
||||
"severity": event.severity,
|
||||
"destination": event.dst_ip or event.fields.get("query_domain", event.fields.get("url", "")),
|
||||
"service": event.fields.get("service", event.fields.get("query_type", "")),
|
||||
"context": event.fields.get("query_domain", event.fields.get("qh", event.fields.get("url", event.fields.get("message", event.fields.get("msg", "")))))[:240],
|
||||
"destination": event.dst_ip or canonical_value(event.fields, "context"),
|
||||
"service": canonical_value(event.fields, "service"),
|
||||
"context": canonical_value(event.fields, "context")[:240],
|
||||
}
|
||||
for event in events
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user