UID problem with nginx

Hi all,
I have two issues with cookie logging:

  1. I want to know which is the best way to say this in nginx:

If the user is new user log $uid_set else log $uid_got instead.

I was previously having apache on my servers…and this was happening by
default. But I don’t know what to do now…in nginx. Basically i want the
cookie to be logged whether he is
a new user or not. But I dont want to log both $uid_set an $uid_got on
my
logs…

I can only think of one way to achieve this…an if block that checks
$uid_got to have any value…if it has, have a log format (say A)
another if block again checking the same thing and it has no value then
have
a different log format(say B).

Is there a better way?

  1. I understand that the nginx sends the base64 encoded value of the
    cookie
    to the browser…but logs($uid_set/$uid_got) the actual value as a hex
    string…
    For Eg:
    like on the browser we have:

KQGowEkCmLwATSmbAwMDAg==

But on the logs when we log $uid_got we get :

C0A80129BC9802499B294D0002030303.

I know both are same.

But the issue is I have one another apache server (a subdomain) which
just
logs… cookies (HTTP_COOKIE) (but no setting) …hence effectively this
one
logs the value got from the browser (the base64 encoded value)…
Because of this I’m not able to do any correlational studies between
logs of
nginx(which set the cookies) and the apache logs…Is there a way
around?
other than me writing a wrapper to do an
in place edit of the logs?

Regards
Harish