Skip to content

Commit

Permalink
bugfix: stream server block didn't inherit the log_by_lua* directives…
Browse files Browse the repository at this point in the history
… configured in stream block.
  • Loading branch information
willmafh authored Sep 2, 2023
1 parent d23c278 commit 7a3acd6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/ngx_stream_lua_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,13 @@ ngx_stream_lua_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
conf->preread_chunkname = prev->preread_chunkname;
}

if (conf->log_src.value.len == 0) {
conf->log_src = prev->log_src;
conf->log_handler = prev->log_handler;
conf->log_src_key = prev->log_src_key;
conf->log_chunkname = prev->log_chunkname;
}

return NGX_CONF_OK;
}

Expand Down
14 changes: 14 additions & 0 deletions t/075-logby.t
Original file line number Diff line number Diff line change
Expand Up @@ -363,3 +363,17 @@ log handler
ok
--- no_error_log
[error]



=== TEST 21: log_by_lua in stream level
--- stream_config
log_by_lua_block { ngx.log(ngx.ERR, "Hello from log_by_lua stream level: ", ngx.var.protocol) }
--- stream_server_config
content_by_lua_block {
ngx.say('hello')
}
--- stream_response
hello
--- error_log
Hello from log_by_lua stream level: TCP

0 comments on commit 7a3acd6

Please sign in to comment.