fix(collector): strip port from remote_addr before attacker identity resolution
host:port in remote_addr was creating a distinct Attacker row per TCP connection instead of per IP. Split on the last ':' in parse_rfc5424; preserve the port as fields['remote_port'] so repeated source ports are retained as fingerprint signal in bounty payloads.
This commit is contained in:
@@ -472,7 +472,14 @@ def parse_rfc5424(line: str) -> Optional[dict[str, Any]]:
|
||||
attacker_ip = "Unknown"
|
||||
for fname in _IP_FIELDS:
|
||||
if fname in fields:
|
||||
attacker_ip = fields[fname]
|
||||
raw = fields[fname]
|
||||
# remote_addr may be "host:port" — split so identity keys on IP only.
|
||||
host, _, port = raw.rpartition(":")
|
||||
if host and port.isdigit():
|
||||
attacker_ip = host.strip("[]") # handle [::1]:port IPv6 form
|
||||
fields.setdefault("remote_port", port)
|
||||
else:
|
||||
attacker_ip = raw
|
||||
break
|
||||
|
||||
# Fallback for plain `logger` callers that don't use SD params (notably
|
||||
|
||||
Reference in New Issue
Block a user