I have found some solutions to anonymize IP in nginx log - like this Anonymize IP logging in nginx?
But this will strip IP to C-subnet. Thats too much. For my purposes and GDPR compilant is in my opinion enough if the last octet of IP will be divided by 2, floored and multiplied by 2 to again. So IP will not be exact.
Can be done this in nginx / map. I did not have any luck yet.