Fortsatte roadmapen med multi-entity stream profiles
This commit is contained in:
@@ -42,6 +42,16 @@ def profile_entity(event: LogEvent, field: str) -> str:
|
||||
return str(event.fields.get(field.lower(), "")).strip()
|
||||
|
||||
|
||||
def profile_entities(event: LogEvent, profile: object) -> tuple[str, ...]:
|
||||
fields = tuple(str(field) for field in getattr(profile, "entity_fields", ()) if field) or (str(getattr(profile, "entity_field", "")),)
|
||||
values = []
|
||||
for field in fields:
|
||||
value = profile_entity(event, field)
|
||||
if value and value not in values:
|
||||
values.append(value)
|
||||
return tuple(values)
|
||||
|
||||
|
||||
def sample_timeline(events: Iterable[LogEvent], *, limit: int = 20) -> list[dict[str, str]]:
|
||||
samples = [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user