How to get User Information in Nginx log?
7qi opened this issue · 1 comments
7qi commented
Hi, thank you for you sharing, and may I ask a question?
When I use this module, I also want to get the login information of users.
We found there is an api in module of apache, which can help us to get the userinfo in Apache log.
Does this nginx module have such a function?
Thanks in advance.
tippexs commented
Good morning - You have full access to the JWT Payload by using $jwt_claim_*
https://nginx.org/en/docs/http/ngx_http_auth_jwt_module.html#var_jwt_claim_
If you want to log the username from the given jwt you can simply add $jwt_claim_sub to your custom log format.
Read more about log formats here: https://nginx.org/en/docs/http/ngx_http_log_module.html#log_format