Lines 24-29
Link Here
|
24 |
* %...I: bytes received, including request and headers, cannot be zero |
24 |
* %...I: bytes received, including request and headers, cannot be zero |
25 |
* %...O: bytes sent, including headers, cannot be zero |
25 |
* %...O: bytes sent, including headers, cannot be zero |
26 |
* |
26 |
* |
|
|
27 |
* Alternately you can use the data stored in the request notes table wth |
28 |
* LogFormat or mod_{perl,ruby,python}. |
29 |
* |
30 |
* eg: |
31 |
* |
32 |
* In mod_ruby with a RubyLogHandler use |
33 |
* |
34 |
* request.main.notes['logio_bytes_in'] |
35 |
* |
36 |
* or in LogFormat |
37 |
* |
38 |
* %...<{logio_bytes_in}n |
39 |
* %...<{logio_bytes_out}n |
40 |
* |
41 |
* ('<' because the note will always be in the original request) |
42 |
* |
27 |
*/ |
43 |
*/ |
28 |
|
44 |
|
29 |
#include "apr_strings.h" |
45 |
#include "apr_strings.h" |
Lines 85-90
Link Here
|
85 |
return apr_off_t_toa(r->pool, cf->bytes_out); |
101 |
return apr_off_t_toa(r->pool, cf->bytes_out); |
86 |
} |
102 |
} |
87 |
|
103 |
|
|
|
104 |
static int logio_notes(request_rec *r) |
105 |
{ |
106 |
logio_config_t *cf = ap_get_module_config(r->connection->conn_config, |
107 |
&logio_module); |
108 |
|
109 |
apr_table_setn(r->notes, "logio_bytes_in", |
110 |
apr_off_t_toa(r->pool, cf->bytes_in)); |
111 |
apr_table_setn(r->notes, "logio_bytes_out", |
112 |
apr_off_t_toa(r->pool, cf->bytes_out)); |
113 |
|
114 |
return OK; |
115 |
} |
116 |
|
117 |
|
88 |
/* |
118 |
/* |
89 |
* Reset counters after logging... |
119 |
* Reset counters after logging... |
90 |
*/ |
120 |
*/ |
Lines 167-176
Link Here
|
167 |
static void register_hooks(apr_pool_t *p) |
197 |
static void register_hooks(apr_pool_t *p) |
168 |
{ |
198 |
{ |
169 |
static const char *pre[] = { "mod_log_config.c", NULL }; |
199 |
static const char *pre[] = { "mod_log_config.c", NULL }; |
|
|
200 |
static const char *post[] = { "mod_log_config.c", NULL }; |
170 |
|
201 |
|
171 |
ap_hook_pre_connection(logio_pre_conn, NULL, NULL, APR_HOOK_MIDDLE); |
202 |
ap_hook_pre_connection(logio_pre_conn, NULL, NULL, APR_HOOK_MIDDLE); |
172 |
ap_hook_pre_config(logio_pre_config, NULL, NULL, APR_HOOK_REALLY_FIRST); |
203 |
ap_hook_pre_config(logio_pre_config, NULL, NULL, APR_HOOK_REALLY_FIRST); |
173 |
ap_hook_log_transaction(logio_transaction, pre, NULL, APR_HOOK_MIDDLE); |
204 |
ap_hook_log_transaction(logio_notes, NULL, post, APR_HOOK_FIRST); |
|
|
205 |
ap_hook_log_transaction(logio_transaction, pre, NULL, APR_HOOK_LAST); |
174 |
|
206 |
|
175 |
ap_register_input_filter(logio_filter_name, logio_in_filter, NULL, |
207 |
ap_register_input_filter(logio_filter_name, logio_in_filter, NULL, |
176 |
AP_FTYPE_NETWORK - 1); |
208 |
AP_FTYPE_NETWORK - 1); |