Mailing List Archive

[mod_backhand-users] unique log entries
Hi List

mod_backhand is working fine here.

Unfortunately, I still have a problem which is not related to mod_backhand
directly but still might be interesting for the list.

The apaches running backhand are (for many different reasons) writing their
own logfile each. Pity, our marketing stuff wants to have some sort of
access-statistics, and they love (for many different reasons i don't know)
webalizer.
I've noticed that when a client sends a request to one server, and that request
is backhanded to the second server, both write a log entry for that request.
So when webalizing the logs this request will be counted twice, and that's bad.

I've fiddled around a while with apache and tried to tell it not to log back-
handed requests, resulting in the following config snippet:


SetEnvIf Http_Backhandproxied "^10.*" backh
#SetEnvIf BackhandProxied "^10.*" backh
CustomLog /tmp/cluster2-access.log common env=!backh
CustomLog /tmp/cluster2-backh-access.log common env=backh


Doh, doesn't work. Neither using the Http_Backhandproxied nor the BackhandProxied
variable.
Does anyone have a suggestion or solution for me?

regards,
Martin
[mod_backhand-users] unique log entries [ In reply to ]
Martin Domig wrote:
> SetEnvIf Http_Backhandproxied "^10.*" backh
> #SetEnvIf BackhandProxied "^10.*" backh
> CustomLog /tmp/cluster2-access.log common env=!backh
> CustomLog /tmp/cluster2-backh-access.log common env=backh
>
> Doh, doesn't work. Neither using the Http_Backhandproxied nor the BackhandProxied
> variable.
> Does anyone have a suggestion or solution for me?

The concept is that BackhandProxied will *only* be set on the machined that is
being proxied to. Unfortunately, my code doesn't reflect that concept :-( A
one line patch fixes this -- it is in CVS and attached at the bottom of this
message. If the header exists at all, you know it was backhanded to you.
Otherwise, it originated from the client.

So you want something like this:

SetEnvIf BackhandProxied . bh
CustomLog /var/backhand/logs/frontend_access_log funky env=!bh
CustomLog /var/backhand/logs/backend_access_log funky env=bh

--- BEGIN PATCH ---
diff -u -r1.20 mod_backhand.c
--- mod_backhand.c 2001/02/05 04:27:23 1.20
+++ mod_backhand.c 2001/02/07 22:05:43
@@ -543,6 +543,7 @@
ap_table_setn(r->headers_in, "Connection", "Keep-Alive");
ap_table_setn(r->headers_in, "BackhandProxied", inet_ntoa(tempaddr));
ap_table_do(&build_request_headers, header, r->headers_in, NULL);
+ ap_table_unset(r->headers_in, "BackhandProxied");
strcat(header, "\n");

/* Get our socket */
--- END PATCH ---

--
Theo Schlossnagle
1024D/A8EBCF8F/13BD 8C08 6BE2 629A 527E 2DC2 72C2 AD05 A8EB CF8F
2047R/33131B65/71 F7 95 64 49 76 5D BA 3D 90 B9 9F BE 27 24 E7