Anonymize IP addresses in get_full_log

Mask IPv4 addresses in logs when collecting full log output: added a sed step that replaces the last two octets with "x.x" to avoid exposing full IPs (GDPR). Also updated the comment to reflect anonymization; existing steps that strip carriage returns and ANSI escape sequences remain in place before truncating with head -c.
This commit is contained in:
CanbiZ (MickLesk)
2026-02-23 14:22:51 +01:00
parent dbff5db95a
commit e222a2718c

View File

@@ -391,9 +391,10 @@ get_full_log() {
fi
if [[ -n "$logfile" && -s "$logfile" ]]; then
# Strip ANSI codes and carriage returns, then truncate to max_bytes
# Strip ANSI codes, carriage returns, and anonymize IP addresses (GDPR)
sed 's/\r$//' "$logfile" 2>/dev/null |
sed 's/\x1b\[[0-9;]*[a-zA-Z]//g' |
sed -E 's/([0-9]{1,3}\.)[0-9]{1,3}\.[0-9]{1,3}/\1x.x/g' |
head -c "$max_bytes"
fi
}