

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 9
click for more info
Not enough gems
Cost: 6 gems
1: Can You Keep a Secret?
incomplete
2: Error Responses
incomplete
3: Minimal Logging
incomplete
4: Obfuscation
incomplete
5: Filtering Logs
incomplete
6: Encrypted Logs
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
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.
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.