summaryrefslogtreecommitdiffstatsabout
path: root/Documentation/documentation.lyx
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/documentation.lyx')
-rw-r--r--Documentation/documentation.lyx353
1 files changed, 261 insertions, 92 deletions
diff --git a/Documentation/documentation.lyx b/Documentation/documentation.lyx
index a678315..eeb6af5 100644
--- a/Documentation/documentation.lyx
+++ b/Documentation/documentation.lyx
@@ -1,5 +1,5 @@
1#LyX 1.2 created this file. For more info see http://www.lyx.org/ 1#LyX 1.3 created this file. For more info see http://www.lyx.org/
2\lyxformat 220 2\lyxformat 221
3\textclass article 3\textclass article
4\language english 4\language english
5\inputencoding default 5\inputencoding default
@@ -162,7 +162,7 @@ Note which directives go in the 'main server config' and which directives
162 This is made clear in the directive documentation. 162 This is made clear in the directive documentation.
163\layout Itemize 163\layout Itemize
164 164
165The 'time_stamp' field is stored in an UNSIGNED INTEGER column, in the standard 165The 'time_stamp' field is stored in an UNSIGNED INTEGER format, in the standard
166 unix 166 unix
167\begin_inset Quotes eld 167\begin_inset Quotes eld
168\end_inset 168\end_inset
@@ -173,9 +173,9 @@ seconds since the epoch
173 173
174 format. 174 format.
175 This is superior to storing the access time as a string due to size requirement 175 This is superior to storing the access time as a string due to size requirement
176s: an UNSIGNED INT requires 4 bytes, whereas an Apache date string -- e.g. 176s: an UNSIGNED INT requires 4 bytes, whereas an Apache date string (e.g.
177 "18/Nov/2001:13:59:52 -0800" -- requires 26 bytes: those extra 22 bytes 177 "18/Nov/2001:13:59:52 -0800") requires 26 bytes: those extra 22 bytes become
178 become significant when multiplied by thousands of accesses on a busy server. 178 significant when multiplied by thousands of accesses on a busy server.
179 Besides, an INT type is far more flexible for comparisons, etc. 179 Besides, an INT type is far more flexible for comparisons, etc.
180\begin_deeper 180\begin_deeper
181\layout Standard 181\layout Standard
@@ -301,6 +301,11 @@ These installation documents assume a relatively modern GNU/Linux scenario.
301 compiling the module for those platforms. 301 compiling the module for those platforms.
302\layout Subsubsection 302\layout Subsubsection
303 303
304
305\begin_inset LatexCommand \label{sub:Solaris}
306
307\end_inset
308
304Solaris 309Solaris
305\layout Standard 310\layout Standard
306 311
@@ -387,6 +392,143 @@ contact
387\end_inset 392\end_inset
388 393
389 and help fill in this section. 394 and help fill in this section.
395\layout Subsubsection
396
397OS X
398\layout Standard
399
400mod_log_sql should compile and work out-of-the-box on this platform.
401 Here are some notes from a user successfully running the module on OS X:
402\layout Quote
403
404
405\emph on
406The only changes I had to make were to where I had the various libraries
407 installed.
408\layout Quote
409
410
411\emph on
412Here are the changes I made to the head of the Makefile:
413\layout LyX-Code
414
415APACHESOURCE = /usr/local/src/apache_1.3.27
416\layout Quote
417
418
419\emph on
420(Wasn't sure if this was really needed or not, so I downloaded the Apache
421 source just in case)
422\layout LyX-Code
423
424APACHEINSTALLED = /usr/sbin
425\layout LyX-Code
426
427APACHEHEADERS = /usr/include/httpd
428\layout LyX-Code
429
430APXS = $(APACHEINSTALLED)/apxs
431\layout LyX-Code
432
433MYSQLLIBRARIES = /usr/local/mysql/lib
434\layout LyX-Code
435
436MYSQLHEADERS = /usr/local/mysql/include
437\layout Quote
438
439
440\emph on
441I'm using a binary installation of MySQL and the default apache installation
442 on OS X Client 10.2.3, the locations of these files may vary depending on
443 how you've installed MySQL and will almost certainly be different if you're
444 using OS X Server.
445\layout Standard
446
447My thanks to Tom Wiebe for being the first (to my knowlege) mod_log_sql
448 user on OS X and for providing these notes.
449\layout Subsubsection
450
451Digital Unix
452\layout Standard
453
454Digital Unix, like Solaris, needs to be linked against librt; see section
455
456\begin_inset LatexCommand \ref{sub:Solaris}
457
458\end_inset
459
460.
461 Here are further notes from a user successfully running the module on Digital
462 Unix:
463\layout Quote
464
465
466\emph on
467Instead of trying to get the module to remember where the MySQL libraries
468 were, I instead compiled apache with the information:
469\layout Quote
470
471
472\emph on
473LDFLAGS='-rpath /isp/mysql/lib/mysql' ./configure ...
474\layout Quote
475
476
477\emph on
478Everything worked as expected after that.
479 (The error I got without this was "/sbin/loader: Fatal Error: cannot map
480 libmysqlclient.so" )
481\layout Quote
482
483
484\emph on
485Digital Unix (v4.0f, at least ) appears to follow the same requirements needed
486 by Solaris, so simply adding librt to the module made it compile without
487 errors.
488\layout Quote
489
490
491\emph on
492As for the warnings, here's the text:
493\layout LyX-Code
494
495
496\emph on
497mod_log_sql.c: In function `extract_request_duration':
498\layout LyX-Code
499
500
501\emph on
502mod_log_sql.c:292: warning: long int format, different type arg (arg 4)
503\layout LyX-Code
504
505
506\emph on
507mod_log_sql.c: In function `extract_request_timestamp':
508\layout LyX-Code
509
510
511\emph on
512mod_log_sql.c:497: warning: long int format, different type arg (arg 4)
513\layout Quote
514
515
516\emph on
517Poking around in the code, it looks like the compiler was complaining that
518 what time() is returning doesn't play nicely with %ld by default.
519 I just typecast them as (long)'s and the warnings went away ( not that
520 the module wasn't working correctly without them ).
521\layout Quote
522
523
524\emph on
525The module works very well so far in testing...
526 hasn't dropped a single log entry yet.
527
528\layout Standard
529
530My thanks to Jim Turner for permitting me to quote him here, and for being
531 the first known user of mod_log_sql on Digital Unix.
390\layout Subsection 532\layout Subsection
391 533
392Do I want a DSO or a static module? 534Do I want a DSO or a static module?
@@ -919,10 +1061,24 @@ mysql> create database apachelogs;
919\end_inset 1061\end_inset
920 1062
921If you want to hand-create the tables, run the enclosed 'create-tables' 1063If you want to hand-create the tables, run the enclosed 'create-tables'
922 SQL script as follows: 1064 SQL script as follows (
1065\begin_inset Quotes eld
1066\end_inset
1067
1068create_tables.sql
1069\begin_inset Quotes erd
1070\end_inset
1071
1072 needs to be in your current working directory).
923\begin_deeper 1073\begin_deeper
924\layout LyX-Code 1074\layout LyX-Code
925 1075
1076mysql> use apachelogs
1077\layout LyX-Code
1078
1079Database changed
1080\layout LyX-Code
1081
926mysql> source create_tables.sql 1082mysql> source create_tables.sql
927\end_deeper 1083\end_deeper
928\layout Enumerate 1084\layout Enumerate
@@ -939,9 +1095,7 @@ Create a specific MySQL userid that httpd will use to authenticate and enter
939\layout LyX-Code 1095\layout LyX-Code
940 1096
941mysql> grant insert,create on apachelogs.* to loguser@my.apachemachine.com 1097mysql> grant insert,create on apachelogs.* to loguser@my.apachemachine.com
942\layout LyX-Code 1098 identified by 'l0gger';
943
944identified by 'l0gger';
945\end_deeper 1099\end_deeper
946\layout Enumerate 1100\layout Enumerate
947 1101
@@ -4817,24 +4971,29 @@ Context: virtual host
4817In HTTP, cookies have names to distinguish them from each other. 4971In HTTP, cookies have names to distinguish them from each other.
4818 Using mod_usertrack, for example, you can give your user-tracking cookies 4972 Using mod_usertrack, for example, you can give your user-tracking cookies
4819 a name with the CookieName directive. 4973 a name with the CookieName directive.
4974
4820\layout Standard 4975\layout Standard
4821 4976
4822You must include a 'c' character in 4977mod_log_sql allows you to log cookie information.
4823\noun on 4978
4824LogSQLTransferLogFormat
4825\noun default
4826 for this directive to take effect; once you specify 'c',
4827\noun on 4979\noun on
4828LogSQLWhichCookie 4980 LogSQLWhichCookie
4829\noun default 4981\noun default
4830 tells mod_log_sql which cookie to log. 4982 tells mod_log_sql which cookie to log.
4831 This is necessary because you will usually be setting and receiving more 4983 This is necessary because you will usually be setting and receiving more
4832 than one cookie from a client; this cookie designates which one to log. 4984 than one cookie from a client.
4985\layout Standard
4986
4987You must include a 'c' character in
4988\noun on
4989LogSQLTransferLogFormat
4990\noun default
4991 for this directive to take effect.
4833\layout Standard 4992\layout Standard
4834 4993
4835Note: although this was intended for people who are using mod_usertrack 4994Note: although this was origintally intended for people using mod_usertrack
4836 to set user-tracking cookies, you aren't restricted in any way. 4995 to create user-tracking cookies, you aren't restricted in any way.
4837 You can choose which cookie you wish to log to the database --any cookie 4996 You can choose which cookie you wish to log to the database -- any cookie
4838 at all -- and it doesn't necessarily have to have anything to do with mod_usert 4997 at all -- and it doesn't necessarily have to have anything to do with mod_usert
4839rack. 4998rack.
4840\layout Subsubsection 4999\layout Subsubsection
@@ -5742,7 +5901,7 @@ Please contact
5742Problems 5901Problems
5743\layout Subsubsection 5902\layout Subsubsection
5744 5903
5745Apache segfaults when using PHP and mod_log_sql 5904Apache segfaults or has other problems when using PHP and mod_log_sql
5746\layout Standard 5905\layout Standard
5747 5906
5748This occurs if you compiled PHP with MySQL database support. 5907This occurs if you compiled PHP with MySQL database support.
@@ -5759,8 +5918,9 @@ real
5759 5918
5760\layout Standard 5919\layout Standard
5761 5920
5762The solution is to configure PHP to link against the real MySQL libraries 5921PHP and mod_log_sql can be configured to happily coexist.
5763 and recompile mod_php. 5922 The solution is to configure PHP to link against the real MySQL libraries:
5923 recompile PHP using --with-mysql=/your/path.
5764 Apache will run properly once the modules are all using the same version 5924 Apache will run properly once the modules are all using the same version
5765 of the MySQL libraries. 5925 of the MySQL libraries.
5766\layout Subsubsection 5926\layout Subsubsection
@@ -5983,6 +6143,83 @@ Reference:
5983\end_inset 6143\end_inset
5984 6144
5985 6145
6146\layout Subsubsection
6147
6148Sometimes a single VirtualHost gets logged to two different tables (e.g.
6149 access_foo_com, access_www_foo_com).
6150 Or, accesses to an unqualified hostname (e.g.
6151
6152\begin_inset Quotes eld
6153\end_inset
6154
6155http://intranet/index.html
6156\begin_inset Quotes erd
6157\end_inset
6158
6159) get logged in separate tables.
6160\layout Standard
6161
6162Proper usage of the Apache runtime
6163\noun on
6164ServerName
6165\noun default
6166 directive and the directive
6167\noun on
6168UseCanonicalName On
6169\noun default
6170(or
6171\noun on
6172DNS
6173\noun default
6174) are necessary to prevent this problem.
6175
6176\begin_inset Quotes eld
6177\end_inset
6178
6179On
6180\begin_inset Quotes erd
6181\end_inset
6182
6183 is the default for
6184\noun on
6185UseCanonicalName
6186\noun default
6187, and specifies that self-referential URLs are generated from the
6188\noun on
6189ServerName
6190\noun default
6191part of your VirtualHost:
6192\layout Quote
6193
6194With UseCanonicalName on (and in all versions prior to 1.3) Apache will use
6195 the ServerName and Port directives to construct the canonical name for
6196 the server.
6197 With UseCanonicalName off Apache will form self-referential URLs using
6198 the hostname and port supplied by the client if any are supplied (otherwise
6199 it will use the canonical name, as defined above).
6200 [From
6201\begin_inset LatexCommand \url[the Apache documentation]{http://httpd.apache.org/docs/mod/core.html#usecanonicalname}
6202
6203\end_inset
6204
6205]
6206\layout Standard
6207
6208The module inherits Apache's
6209\begin_inset Quotes eld
6210\end_inset
6211
6212knowledge
6213\begin_inset Quotes erd
6214\end_inset
6215
6216 about the server name being accessed.
6217 As long as those two directives are properly configured, mod_log_sql will
6218 log to only one table per virtual host while using
6219\noun on
6220LogSQLMassVirtualHosting
6221\noun default
6222.
5986\layout Subsection 6223\layout Subsection
5987 6224
5988Performance and Tuning 6225Performance and Tuning
@@ -6236,7 +6473,7 @@ not
6236correct 6473correct
6237\series default 6474\series default
6238 to assume that 20 Apache children with a VSZ of 7MB each equals 6475 to assume that 20 Apache children with a VSZ of 7MB each equals
6239\begin_inset Formula $(20\times 7MB)$ 6476\begin_inset Formula $(20\times7MB)$
6240\end_inset 6477\end_inset
6241 6478
6242 of memory consumption -- the real answer is much, much lower. 6479 of memory consumption -- the real answer is much, much lower.
@@ -6359,74 +6596,6 @@ How do I...?
6359 -- accomplishing certain tasks 6596 -- accomplishing certain tasks
6360\layout Subsubsection 6597\layout Subsubsection
6361 6598
6362I am using LogSQLMassVirtualHosting, and sometimes a single VirtualHost
6363 gets logged to two different tables.
6364 How do I prevent that?
6365\layout Standard
6366
6367Proper usage of the Apache runtime
6368\noun on
6369ServerName
6370\noun default
6371 directive and the directive
6372\noun on
6373UseCanonicalName On
6374\noun default
6375(or
6376\noun on
6377DNS
6378\noun default
6379) are necessary to prevent this problem.
6380
6381\begin_inset Quotes eld
6382\end_inset
6383
6384On
6385\begin_inset Quotes erd
6386\end_inset
6387
6388 is the default for
6389\noun on
6390UseCanonicalName
6391\noun default
6392, and specifies that self-referential URLs are generated from the
6393\noun on
6394ServerName
6395\noun default
6396part of your VirtualHost:
6397\layout Quote
6398
6399With UseCanonicalName on (and in all versions prior to 1.3) Apache will use
6400 the ServerName and Port directives to construct the canonical name for
6401 the server.
6402 With UseCanonicalName off Apache will form self-referential URLs using
6403 the hostname and port supplied by the client if any are supplied (otherwise
6404 it will use the canonical name, as defined above).
6405 [From
6406\begin_inset LatexCommand \url[the Apache documentation]{http://httpd.apache.org/docs/mod/core.html#usecanonicalname}
6407
6408\end_inset
6409
6410]
6411\layout Standard
6412
6413The module inherits Apache's
6414\begin_inset Quotes eld
6415\end_inset
6416
6417knowledge
6418\begin_inset Quotes erd
6419\end_inset
6420
6421 about the server name being accessed.
6422 As long as those two directives are properly configured, mod_log_sql will
6423 log to only one table per virtual host while using
6424\noun on
6425LogSQLMassVirtualHosting
6426\noun default
6427.
6428\layout Subsubsection
6429
6430How do I extract the data in a format that my analysis tool can understand? 6599How do I extract the data in a format that my analysis tool can understand?
6431\layout Standard 6600\layout Standard
6432 6601