-
Notifications
You must be signed in to change notification settings - Fork 322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using vars
multiple times in access_log.format
does not work correctly with njs
#1169
Comments
Actually this behavior seems to be random – sometimes it works, sometimes it doesn't 🤔
|
Hi @valtzu Thanks for reaching out! This looks indeed not correct and I was able to reproduce the issue with the latest version of our Docker-Image and the We will have a look on this and share our progress here! Thanks again for reaching out! |
Hi @valtzu,
|
The variables accessed with JS template literal should be not cacheable. Since it is parsed by njs engine, Unit can't create indexes on these variables for caching purpose. For example: { "format": "`{bodyLength:\"${vars.body_bytes_sent}\",status:\"${vars.status}\"}\n`" } The variables like the above are not cacheable. Closes: nginx#1169
The variables accessed with JS template literal should be not cacheable. Since it is parsed by njs engine, Unit can't create indexes on these variables for caching purpose. For example: { "format": "`{bodyLength:\"${vars.body_bytes_sent}\",status:\"${vars.status}\"}\n`" } The variables like the above are not cacheable. Closes: nginx#1169
Reproduces issue nginx#1169.
Reproduces issue nginx#1169.
Reproduces issue nginx#1169.
Reproduces issue nginx#1169.
The variables accessed with JS template literal should not be cacheable. Since it is parsed by njs engine, Unit can't create indexes on these variables for caching purpose. For example: { "format": "`{bodyLength:\"${vars.body_bytes_sent}\",status:\"${vars.status}\"}\n`" } The variables like the above are not cacheable. Closes: #1169
The variables accessed with JS template literal should not be cacheable. Since it is parsed by njs engine, Unit can't create indexes on these variables for caching purpose. For example: { "format": "`{bodyLength:\"${vars.body_bytes_sent}\",status:\"${vars.status}\"}\n`" } The variables like the above are not cacheable. Closes: nginx#1169
Reproduces issue nginx#1169.
Related to recently added feature #1024.
When using NJS-based access log format (with Docker
unit
1.32.0
), the value of firstvars
is used for all the restvars
– see the example below.Config
or
Log output:
Whereas with non-js version
"format": "bodyLength=$body_bytes_sent status=$status"
it works fine:The text was updated successfully, but these errors were encountered: