mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-03-19 08:23:01 +01:00
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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user