Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion .travis/apisix_cli_test/test_main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ make stop

echo "passed: access log with JSON format"

# check uninitialized variable in access log
# check uninitialized variable in access log when access admin
git checkout conf/config.yaml

rm logs/error.log
Expand All @@ -877,6 +877,24 @@ fi

echo "pass: uninitialized variable not found during writing access log"

# don't log uninitialized access log variable when the HTTP request is malformed

git checkout conf/config.yaml

rm logs/error.log
./bin/apisix start
sleep 1 # wait for apisix starts

curl -v -k -i -m 20 -o /dev/null -s https://127.0.0.1:9080 || true
if grep -E 'using uninitialized ".+" variable while logging request' logs/error.log; then
echo "failed: log uninitialized access log variable when the HTTP request is malformed"
exit 1
fi

make stop

echo "don't log uninitialized access log variable when the HTTP request is malformed"

# port_admin set
echo '
apisix:
Expand Down
1 change: 1 addition & 0 deletions apisix/cli/ngx_tpl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ http {
access_log off;
{% else %}
log_format main escape={* http.access_log_format_escape *} '{* http.access_log_format *}';
uninitialized_variable_warn off;

access_log {* http.access_log *} main buffer=16384 flush=3;
{% end %}
Expand Down