I have some lua code that is instrumenting requests and tagging those metrics with host and upstream info, but it would be really useful to include the location block value as a tag as well. Is this information exposed as a variable? For instance:
location /api/v1 {
log_by_lua_block {
ngx.var.location_val -- "/api/v1"
}
}
location /api/v2 {
log_by_lua_block {
ngx.var.location_val -- "/api/v2"
}
}
I know I could manually copy the location values into a context variable for every location block in my nginx config, but am hoping there is a better way.