diff options
author | Zhidao HONG <z.hong@f5.com> | 2024-10-28 17:45:19 +0800 |
---|---|---|
committer | Zhidao HONG <z.hong@f5.com> | 2024-11-14 09:43:49 +0800 |
commit | bc838c5e1b6270c5195c4bdaa6a0a4bb72e48549 (patch) | |
tree | dc84b5da1946ca521cd78ac821640e7fae50f3c2 /test/test_access_log.py | |
parent | a760e24a2c4e5f93703bb365b12807d8b1035cf5 (diff) | |
download | unit-bc838c5e1b6270c5195c4bdaa6a0a4bb72e48549.tar.gz unit-bc838c5e1b6270c5195c4bdaa6a0a4bb72e48549.tar.bz2 |
http: Support JSON format in access log
Allow format to be an object to generate JSON logs. The object keys
become JSON field names, and values support string, variable, and JS.
Note that when there is no JS in the format values, the object will
be pre-serialized to a JSON template string at configuration phase
for better performance.
Example config:
{
"access_log": {
"path": "/tmp/access.log",
"format": {
"remote_addr": "$remote_addr",
"time_local": "$time_local",
"request_line": "$request_line",
"status": "$status",
"body_bytes_sent": "$body_bytes_sent",
"header_referer": "$header_referer",
"header_user_agent": "$header_user_agent"
}
}
}
Diffstat (limited to 'test/test_access_log.py')
0 files changed, 0 insertions, 0 deletions