INNER CODE UNIT · Python
total_events
panther-labs/panther-analysis · .scripts/find_zero_match_detections.py:49
total_events = sum(events for _, events, _, _ in rows)
results.append((detection_id, rows, total_events))
# Sort by number of customers desc, then total events desc
results.sort(key=lambda x: (-len(x[1]), -x[2]))
if not results:
print("No detections found matching the criteria.")
return
print(f"Found {len(results)} detection(s) with events>0 for >1 customer, 0 matches, and 0 errors:\n")
print(f"{'DETECTION ID':<50} {'CUSTOMERS':>9} {'TOTAL EVENTS':>14}")
print("-" * 78)
for detection_id, rows, total_events in results:
print(f"{detection_id:<50} {len(rows):>9} {total_events:>14,.0f}")
for customer, events, _, _ in sorted(rows, key=lambda r: -r[1]):
print(f" {'':48} {customer:<20} events={events:>12,.0f}")