We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Obfuscation

Occasionally, you may need to log sensitive data for debugging or monitoring. A simple example is an IP address. An IP address is often considered PII (it can sometimes trace back to a household), but aggregate IP statistics are still useful.

A good solution is to obfuscate the data. For an IP, you might log only the first three octets (192.168.90.50 becomes 192.168.90.x). For a phone number, maybe only the last three digits (555-867-5309 becomes xxx-xxx-x309). You get the idea.

Obfuscation (logging partial segments) is great for striking a balance between useful logs and data security. You can still see patterns in the data, but an attacker can't use the logs maliciously.

Assignment

Obfuscate client IPs in request logs.

Restart your server with LINKO_LOG_FILE=linko.access.log set:

LINKO_LOG_FILE=linko.access.log go run .

After making a request, check linko.access.log – the client_ip field should show something like 127.0.0.x instead of the full IP.

With the server running, run and submit the CLI tests from the root of the Linko repo.