In the past, a new built-in nginx variable was implemented through the
nginx c module
For example, define the ngx_http_variable_t nginx built-in variable on the
nginx module, and then set the nginx built-in variable through various ffi
callback methods
The statement is as follows:
{ngx_string ("app_id"), NULL,
ngx_http_appid_variable, 0,
NGX_HTTP_VAR_NOCACHEABLE, 0},YuanSheng Wang <[email protected]> 于2020年4月20日周一 下午4:05写道: > > How can I create the built-in variable nginx of route_id? > > 1. we can add a new variable `route_id` in nginx.conf . > 2. update it in Lua land. > 3. use it in access log format. > > > On Mon, Apr 20, 2020 at 3:48 PM hui li <[email protected]> wrote: > > > Because when we use apisix, there are certain requirements for the format > > of access.log, and the format needs to be similar to the following: > > [$ http_host] [$ route_id] [$ upstream_id] [$ uri] [$ scheme] [rsp_st: $ > > status] [ups_st: $ upstream_status] > > For example, route_id is the id of the route object. This kind of data is > > not the default built-in variable of nginx. How can I create the built-in > > variable nginx of route_id? > > > > > -- > *MembPhis* > My github: https://github.com/membphis > Apache APISIX: https://github.com/apache/incubator-apisix >
