Does anyone know how I could log into Apache access_logs a cookie that I've just set in the response ? A basic scenario would be :
- A user comes to my site with a bunch of already existing cookies for this domain
- My PHP web application sets a new cookie (let's call it "foo" with value "bar")
- I want to log this cookie into Apache using a CustomLogFormat
I've looked at Apache Documentation for mod_log_config but it is explicitly said that {foo}C will log the cookie named "foo" found in the request and not in the response.
I've maybe found a solution with a RewriteRule and a RewriteCond but it does not seem to be a good idea : not a clean code :(
Another method would be to store the cookie value in an Apache env using PHP apache_setenv() method and use it in CustomLog with {FOO}e. It feels to me that it would be cleaner that the first solution but I'm still not satisfied.
Do you have any idea how I could log a cookie set in the response header ? Thanks !