Can I replicate nginx's "time_iso8601" variable in unit? #1118
-
I am experimenting with porting an nginx+uwsgi setup to unit, and when trying to replicate the access log format, I ran into the problem that the nginx format used the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
You can get an ISO date string with a JavaScript template literal. Here is a sample configuration for a very simple log format. {
"access_log": {
"path": "/dev/stdout",
"format": "`@timestamp=${new Date().toISOString()} ip=${remoteAddr} uri=${uri}`"
}
} However, when using JavaScript, you don't currently have access to the rest of Unit's variables (issue #977) until (PR #1024) arrives in the next release. |
Beta Was this translation helpful? Give feedback.
This is as close as I can get with Unit 1.31.1
Note that request is just the URI and that status, bytes, request_time are missing.
As I mentioned, JavaScript doesn't currently allow you t…