Currently in Nginx log_format we are logging entire request as aprt of $request. Sample Request :
test-registration.com/emp/reg?reqId=939393&usrName=Jimmy
Now our requirement is to extract the value of "reqId", hash that value and put the hashed value back to url
So if the hashed reqID is ru64%$YYE&$&$ expected output should be :
test-registration.com/emp/reg?reqId=ru64%$YYE&$&$&usrName=Jimmy
I know we can extract the value of "reqId" by using map and regex which will be something like
map $request $hashedReqId {
"regular expression" $requestId;
}
But I am stuck in the next part.
My question is :
1) How to hash a string in Nginx ? Can we write Digest::SHA256.hexdigest str1 or somethig like this?
2) After hashing how to put it back to the url?
Please help me resolving this issue
Thanks