If you tell Apache to use CustomLog files, Apache2 will create these files on startup. And it always gives them to user root:root. How can I change this behavior?
Background
Apache runs with
SuexecUserGroup www-data www-data
and at the same time, I use a CustomLog that pipes it output to a script. The script removes two bytes from the IP and then wirtes to the logfile. As you cannot tell Apache to omit the IP from the error.log, this piped-output is important (regarding German privacy law).
The script cannot access my custom log if this does not belong to www-data.
If I change the owner, everthing works fine.
I also know how to change the file owner when logrotate renames and re-creates the logfile.
However, if I stop the Apache process, delete the logfiles, and then restart the Apache process, new files beloging to root:root are created.
How can I tell Apache to create the new, void files as/for www-data on startup?