Set value of NGINX remote_user variable from plugin

We have a bespoke Lua plugin which performs custom authentication, which has the authenticated user account at request processing time. I’d like to be able to use that value to set the NGINX remote_user variable so that it will be captured in the standard Kong access log along with the rest of the other log fields when that is written. I know I can use the log module to write my own log custom entries, but it would be cleaner to leverage the remote_user field if possible.

It looks like the nginx.lua module exposes information about NGINX that can be read, but not to set anything. Is that even possible?

Thanks in advance.

Had also posted this to the discussion for Kong OSS in Github and got a response there that worked. Sharing here to close this off: