I'd like to include cookie data in an nginx access log like so:
(simplified example)
log_format foo '$remote_addr "$request" $cookie_bar';
access_log /var/log/nginx/access.log foo;
This works great on requests that already have a cookie "bar", but for the first request to my server nginx will report "-" as the value of "bar".
It seems like my problem is that nginx is looking at the request headers for the cookie value. Is there a way check for a Set-Cookie in the response and use that as a fallback?