Can not use $bytes_sent in module (complex values)
Benjamin Grössing
mailtogroe at gmail.com
Tue Sep 18 13:55:38 UTC 2012
Hello,
I am currently working on a nginx module, that parses user defined
strings for variables using ngx_http_complex_value_t. That works great
with all variables defined in ngx_http_variables.c (i.e.
$body_bytes_sent). However, variables as $bytes_sent do not exist here
since ngx_http_log_module uses its own variable parsing system. What
is the best way to use these extra variables in my module? I have
thought of the following options, I am not very sure about what is the
best way to go:
a) Copy the ngx_http_log_module code in my own module and rename every
single type and function to avoid double definitions. Reuse functions
and types from there.
b) Move the ngx_http_log_module code in my own module directory and
compile it only there. Reuse functions and types from there.
c) Write own variable parsing system, reuse a few snippets from
ngx_http_variables and ngx_http_log_module, whatever fits best.
d) Use complex values and try to extend the ngx_http_core_variables
array to include $body_bytes_sent and the other missing variables (I
don't understand why they are not included here anyway?).
e) Any better way to achieve that?
I'd really appreciate your help.
Regards
Benjamin
More information about the nginx-devel
mailing list