Wednesday, November 16, 2005

Optimize Apache 2.0 (Apache2) on RHEL - Track users using Clickstream

First, make a backup and then modify /etc/httpd.conf and change settings as follows



# change Timeout 300 to
Timeout 45
# change KeepAlive Off to
KeepAlive On
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
# -- change MaxKeepAliveRequests 100 to 500
MaxKeepAliveRequests 500
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
# change KeepAliveTimeout 15 to
KeepAliveTimeout 5
# Increase MaxClients after benchmarking. mine is
MaxClients 200
# Turn off ServerSignature
ServerSignature Off

#ServerTokens Product
ServerTokens ProductOnly




Turn on cookie tracking using usertrack module

CookieTracking on
#CookieStyle Cookie2
#CookieStyle Cookie
CookieStyle Cookie2
CookieName YourCookieName
CookieExpires "6 months 2 weeks 3 days 7 hours"
# h is included in cookie
# H is request protocol
#CustomLog logs/clickstream "%{cookie}n %r %h %H %m %t"
#CustomLog logs/clickstream "%{cookie}n %t %m %h %H %D %T %f %q %l \"%{Referer}i\" \"%{User-agent}i\""
CustomLog logs/clickstream "%{cookie}n %V %U %h %l %u %t %D %f \"%r\" %>s %b %q \"%{Referer}i\" \"%{User-agent}i\""
#CustomLog logs/clickstream.details "%{cookie}n %t %m %h %H %D %T %f %q %V %r --- %{Referer}i -> %U %l"
#CustomLog logs/clickstream.ua "%{cookie}n %{User-agent}i"
#CustomLog logs/clickstream.referers "%V %U <- %{Referer}i %t %D [%{cookie}n]" CustomLog logs/clickstream.referers "%{Referer}i -> %V %U %t %D [%{cookie}n]"

According to HTTPD.org


%%   The percent sign (Apache 2.0.44 and later)
%...a Remote IP-address
%...A Local IP-address
%...B Size of response in bytes, excluding HTTP headers.
%...b Size of response in bytes, excluding HTTP headers. In CLF format, i.e. a '-' rather than a 0 when no bytes are sent.
%...{Foobar}C The contents of cookie Foobar in the request sent to the server.
%...D The time taken to serve the request, in microseconds.
%...{FOOBAR}e The contents of the environment variable FOOBAR
%...f Filename
%...h Remote host
%...H The request protocol
%...{Foobar}i The contents of Foobar: header line(s) in the request sent to the server.
%...l Remote logname (from identd, if supplied). This will return a dash unless IdentityCheck is set On.
%...m The request method
%...{Foobar}n The contents of note Foobar from another module.
%...{Foobar}o The contents of Foobar: header line(s) in the reply.
%...p The canonical port of the server serving the request
%...P The process ID of the child that serviced the request.
%...{format}P The process ID or thread id of the child that serviced the request. Valid formats are pid and tid. (Apache 2.0.46 and later)
%...q The query string (prepended with a ? if a query string exists, otherwise an empty string)
%...r First line of request
%...s Status. For requests that got internally redirected, this is the status of the *original* request --- %...>s for the last.
%...t Time the request was received (standard english format)
%...{format}t The time, in the form given by format, which should be in strftime(3) format. (potentially localized)
%...T The time taken to serve the request, in seconds.
%...u Remote user (from auth; may be bogus if return status (%s) is 401)
%...U The URL path requested, not including any query string.
%...v The canonical ServerName of the server serving the request.
%...V The server name according to the UseCanonicalName setting.
%...X Connection status when response is completed:
X = connection aborted before the response completed.
+ = connection may be kept alive after the response is sent.
- = connection will be closed after the response is sent.

(This directive was %...c in late versions of Apache 1.3, but this conflicted with the historical ssl %...{var}c syntax.)
%...I Bytes received, including request and headers, cannot be zero. You need to enable mod_logio to use this.
%...O Bytes sent, including headers, cannot be zero. You need to enable mod_logio to use this.


Mod DEFLATE
Mod user track

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home