3

Is it possible to write in nginx access log value of key 'uuid' from Cookie for server response (header: Set-Cookie)?

$cookie_uuid - return uuid that sent client $sent_http_set_cookie - return whole header Set-Cookie: 'uuid=897587e7-a733-422f-9daa-b3105a5895aa; domain=domain.com; path=/; expires=Tue, 09-Aug-2033 01:17:54 GMT', but I need save only value for key 'uuid'

Thanks

Alexey
  • 2,326
  • 5
  • 17
  • 27

1 Answers1

3
map $sent_http_set_cookie $resp_uuid {
    ~*uuid=(?<u>[0-9a-f-]+) $u;
}

Reference:

VBart
  • 14,714
  • 4
  • 45
  • 49
  • One comment: `~*uuid=(?0-9a-f-)+ $u;` does not work for me, but `~*uuid=(?[0-9a-f-]+) $u;` works right – Alexey Aug 11 '13 at 11:42