docs: Improve the log example to cover hiding IPs

This commit is contained in:
Francis Lavoie 2020-11-01 14:43:42 -05:00
parent 785ffebb23
commit 78b03f359d
No known key found for this signature in database
GPG key ID: 7D1A27F0725BE5D8

View file

@ -227,13 +227,14 @@ log {
} }
``` ```
Mask the remote address from the request, keeping the first 16 bytes (i.e. 255.255.0.0) for IPv4 addresses, and the first 64 bytes from IPv6 addresses: Mask the remote address from the request, keeping the first 16 bytes (i.e. 255.255.0.0) for IPv4 addresses, and the first 64 bytes from IPv6 addresses, and also deletes the `common_log` field which would normally contain an unmasked IP address:
```caddy-d ```caddy-d
log { log {
format filter { format filter {
wrap console wrap console
fields { fields {
common_log delete
request>remote_addr ip_mask { request>remote_addr ip_mask {
ipv4 24 ipv4 24
ipv6 32 ipv6 32