diff options
author | Edward Rudd | 2004-03-03 22:11:42 +0000 |
---|---|---|
committer | Edward Rudd | 2004-03-03 22:11:42 +0000 |
commit | d28237cd2fff1922f86fb7576c22625f067d24e7 (patch) | |
tree | e27e6ff72243319c83c6bc3cfffda221b2e0b02a /Documentation/manual.xml | |
parent | 1caf9013120e8df2d65a97c7216cefa58536f058 (diff) |
Documentation conversion complete
Diffstat (limited to 'Documentation/manual.xml')
-rw-r--r-- | Documentation/manual.xml | 381 |
1 files changed, 194 insertions, 187 deletions
diff --git a/Documentation/manual.xml b/Documentation/manual.xml index fe13daa..daafd69 100644 --- a/Documentation/manual.xml +++ b/Documentation/manual.xml | |||
@@ -1,6 +1,8 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <?xml-stylesheet href="file://localhost/home/urkle/Documents/DocBook/docbook.css" type="text/css"?> | 2 | <?xml-stylesheet href="file://localhost/home/urkle/Documents/DocBook/docbook.css" type="text/css"?> |
3 | <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "file:/usr/share/sgml/docbook/xml-dtd-4.1.2-1.0-8/docbookx.dtd"> | 3 | <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "file:/usr/share/sgml/docbook/xml-dtd-4.1.2-1.0-8/docbookx.dtd" [ |
4 | <!ENTITY MaintainerContact "the maintainer, Edward Rudd at <email>eddie <at> omegaware <dot> com</email>"> | ||
5 | ]> | ||
4 | <article> | 6 | <article> |
5 | <articleinfo> | 7 | <articleinfo> |
6 | <title>mod_log_sql Manual</title> | 8 | <title>mod_log_sql Manual</title> |
@@ -34,6 +36,11 @@ | |||
34 | </copyright> | 36 | </copyright> |
35 | <revhistory> | 37 | <revhistory> |
36 | <revision> | 38 | <revision> |
39 | <revnumber>1.1</revnumber> | ||
40 | <date>2004-03-02</date> | ||
41 | <revremark>Updated for mod_log_sql v1.96</revremark> | ||
42 | </revision> | ||
43 | <revision> | ||
37 | <revnumber>1.0</revnumber> | 44 | <revnumber>1.0</revnumber> |
38 | <date>2004-01-22</date> | 45 | <date>2004-01-22</date> |
39 | <revremark>Initial Conversion from Lyx to Docbook</revremark> | 46 | <revremark>Initial Conversion from Lyx to Docbook</revremark> |
@@ -44,7 +51,7 @@ | |||
44 | <title>Introduction</title> | 51 | <title>Introduction</title> |
45 | <sect2> | 52 | <sect2> |
46 | <title>Summary</title> | 53 | <title>Summary</title> |
47 | <para>This Apache module will permit you to log to a SQL database; it can log each access request as well as data associated with each request: cookies, notes, and inbound/outbound headers. Unlike logging to a flat text file -- which is standard in Apache -- a SQL-based log exhibits tremendous flexibility and power of data extraction. (See section [sub:why] in the FAQ for further discussion and examples of the advantages to SQL.)</para> | 54 | <para>This Apache module will permit you to log to a SQL database; it can log each access request as well as data associated with each request: cookies, notes, and inbound/outbound headers. Unlike logging to a flat text file -- which is standard in Apache -- a SQL-based log exhibits tremendous flexibility and power of data extraction. (See section <link linkend="WhyLogToSQL"></link> in the FAQ for further discussion and examples of the advantages to SQL.)</para> |
48 | <para>This module can either replace or happily coexist with mod_log_config, Apache's text file logging facility. In addition to being more configurable than the standard module, mod_log_sql is much more flexible.</para> | 55 | <para>This module can either replace or happily coexist with mod_log_config, Apache's text file logging facility. In addition to being more configurable than the standard module, mod_log_sql is much more flexible.</para> |
49 | </sect2> | 56 | </sect2> |
50 | <sect2 id="copyright"> | 57 | <sect2 id="copyright"> |
@@ -52,11 +59,11 @@ | |||
52 | <para>This project was formerly known as "mod_log_mysql." It was renamed "mod_log_sql" in order to reflect the project goal of database in-specificity. The module currently supports MySQL, but support for other database back-ends is underway.</para> | 59 | <para>This project was formerly known as "mod_log_mysql." It was renamed "mod_log_sql" in order to reflect the project goal of database in-specificity. The module currently supports MySQL, but support for other database back-ends is underway.</para> |
53 | <para>In order to save speed and overhead, links are kept alive in between queries. This module uses one dedicated SQL link per httpd child, opened by each child process when it is born. Among other things, this means that this module supports logging into only one MySQL server, and for now, also, only one SQL database. But that's a small tradeoff compared to the blinding speed of this module. Error reporting is robust throughout the module and will inform the administrator of database issues in the Apache ErrorLog for the server/virtual server.</para> | 60 | <para>In order to save speed and overhead, links are kept alive in between queries. This module uses one dedicated SQL link per httpd child, opened by each child process when it is born. Among other things, this means that this module supports logging into only one MySQL server, and for now, also, only one SQL database. But that's a small tradeoff compared to the blinding speed of this module. Error reporting is robust throughout the module and will inform the administrator of database issues in the Apache ErrorLog for the server/virtual server.</para> |
54 | <para>Virtual hosts are supported in the same manner they are in the regular logging modules. The administrator defines some basic 'global' directives in the main server config, then defines more specific 'local' directives inside each VirtualHost stanza.</para> | 61 | <para>Virtual hosts are supported in the same manner they are in the regular logging modules. The administrator defines some basic 'global' directives in the main server config, then defines more specific 'local' directives inside each VirtualHost stanza.</para> |
55 | <para>A robust "preserve" capability has now been implemented. This permits the module to preserve any failed INSERT commands to a local file on its machine. In any situation that the database is unavailable -- e.g. the network fails or the database host is rebooted -- mod_log_sql will note this in the error log and begin appending its log entries to the preserve file (which is created with the user & group ID of the running Apache process, e.g. "nobody/nobody" on many Linux installations). When database availability returns, mod_log_sql seamlessly resumes logging to it. When convenient for the sysadmin, he/she can easily import the preserve file into the database because it is simply a series of SQL insert statements.</para> | 62 | <para>A robust "preserve" capability has now been implemented. This permits the module to preserve any failed INSERT commands to a local file on its machine. In any situation that the database is unavailable -- e.g. the network fails or the database host is rebooted -- mod_log_sql will note this in the error log and begin appending its log entries to the preserve file (which is created with the user and group ID of the running Apache process, e.g. "nobody/nobody" on many Linux installations). When database availability returns, mod_log_sql seamlessly resumes logging to it. When convenient for the sysadmin, he/she can easily import the preserve file into the database because it is simply a series of SQL insert statements.</para> |
56 | </sect2> | 63 | </sect2> |
57 | <sect2> | 64 | <sect2> |
58 | <title>What gets logged by default?</title> | 65 | <title>What gets logged by default?</title> |
59 | <para>All the data that would be contained in the "Combined Log Format" is logged by default, plus a little extra. Your best bet is to begin by accepting this default, then later customize the log configuration based on your needs. The documentation of the run-time directives includes a full explanation of what you can log, including examples -- see section [sec:ConfRef].</para> | 66 | <para>All the data that would be contained in the "Combined Log Format" is logged by default, plus a little extra. Your best bet is to begin by accepting this default, then later customize the log configuration based on your needs. The documentation of the run-time directives includes a full explanation of what you can log, including examples -- see section <link endterm="Configuration.title" linkend="ConfigReference"></link>.</para> |
60 | </sect2> | 67 | </sect2> |
61 | <sect2> | 68 | <sect2> |
62 | <title>Miscellaneous Notes</title> | 69 | <title>Miscellaneous Notes</title> |
@@ -87,6 +94,7 @@ | |||
87 | <para>The MySQL routines and directives were added by Zeev Suraski <bourbon@netvision.net.il>. </para> | 94 | <para>The MySQL routines and directives were added by Zeev Suraski <bourbon@netvision.net.il>. </para> |
88 | <para>All changes from 1.06+ and the new documentation were added by Chris Powell <email>chris <at> grubbybaby <dot> com</email>. It seems that the module had fallen into the "un-maintained" category -- it had not been updated since 1998 -- so Chris adopted it as the new maintainer.</para> | 95 | <para>All changes from 1.06+ and the new documentation were added by Chris Powell <email>chris <at> grubbybaby <dot> com</email>. It seems that the module had fallen into the "un-maintained" category -- it had not been updated since 1998 -- so Chris adopted it as the new maintainer.</para> |
89 | <para>In December of 2003, Edward Rudd <email>eddie <at> omegaware <dot> com</email> porting the module to Apache 2.0, cleaning up the code, converting the documentation to DocBook, optimizing the main logging loop, and added the much anticipated database abstraction layer.</para> | 96 | <para>In December of 2003, Edward Rudd <email>eddie <at> omegaware <dot> com</email> porting the module to Apache 2.0, cleaning up the code, converting the documentation to DocBook, optimizing the main logging loop, and added the much anticipated database abstraction layer.</para> |
97 | <para>As of February 2004, Chris Powell handed over maintenance of the module over to Edward Rudd. So you should contact Edward Rudd about the module from now on.</para> | ||
90 | </sect2> | 98 | </sect2> |
91 | </sect1> | 99 | </sect1> |
92 | <sect1> | 100 | <sect1> |
@@ -113,9 +121,10 @@ | |||
113 | </sect2> | 121 | </sect2> |
114 | <sect2> | 122 | <sect2> |
115 | <title>Platform Specific Notes</title> | 123 | <title>Platform Specific Notes</title> |
116 | <para><remark>This section is currently not applicable as the new autoconf setup should autodetect everything for your server..Win32 system, however, need to be updated.</remark>These installation documents assume a relatively modern GNU/Linux scenario. mod_log_sql has been ported to other platforms; following are notes on compiling the module for those platforms.</para> | 124 | <remark>This section is currently not applicable as the new autoconf setup should auto-detect everything for your server. The win32 compilation, however, is still on my todo list. This section needs to be overhauled so do not rely completely on any information presented in it. And anyone who compiles the mod_log_sql on these platforms, please report any issues/resolutions to compiling the module.</remark> |
117 | <sect3> | 125 | <para>These installation documents assume a relatively modern GNU/Linux scenario. mod_log_sql has been ported to other platforms; following are notes on compiling the module for those platforms.</para> |
118 | <title><sub:Solaris>Solaris</title> | 126 | <sect3 id="Solaris"> |
127 | <title id="Solaris.title">Solaris</title> | ||
119 | <para>The nanosleep() function used in mod_log_sql relies on linking aginst the librt library. Make the following alterations before proceeding: </para> | 128 | <para>The nanosleep() function used in mod_log_sql relies on linking aginst the librt library. Make the following alterations before proceeding: </para> |
120 | <orderedlist> | 129 | <orderedlist> |
121 | <listitem> | 130 | <listitem> |
@@ -128,11 +137,11 @@ | |||
128 | </sect3> | 137 | </sect3> |
129 | <sect3> | 138 | <sect3> |
130 | <title>BSD</title> | 139 | <title>BSD</title> |
131 | <para>No notes are available at present, but they are desired. If you have successfully ported mod_log_sql to BSD, please contact [(chris@grubbybaby.com)||the maintaniner, Chris Powell] and help fill in this section.</para> | 140 | <para>No notes are available at present, but they are desired. If you have successfully ported mod_log_sql to BSD, please contact &MaintainerContact; and help fill in this section.</para> |
132 | </sect3> | 141 | </sect3> |
133 | <sect3> | 142 | <sect3> |
134 | <title>Win32</title> | 143 | <title>Win32</title> |
135 | <para>No notes are available at present, but they are desired. If you have successfully ported mod_log_sql to Win32, please contact [(chris@grubbybaby.com)||the maintaniner, Chris Powell] and help fill in this section.</para> | 144 | <para>No notes are available at present, but they are desired. If you have successfully ported mod_log_sql to Win32, please contact &MaintainerContact; and help fill in this section.</para> |
136 | </sect3> | 145 | </sect3> |
137 | <sect3> | 146 | <sect3> |
138 | <title>OS X</title> | 147 | <title>OS X</title> |
@@ -142,14 +151,15 @@ | |||
142 | </sect3> | 151 | </sect3> |
143 | <sect3> | 152 | <sect3> |
144 | <title>Digital Unix</title> | 153 | <title>Digital Unix</title> |
145 | <para>Digital Unix, like Solaris, needs to be linked against librt; see section [sub:Solaris]. Here are further notes from a user successfully running the module on Digital Unix:</para> | 154 | <para>Digital Unix, like Solaris, needs to be linked against librt; see section <link endterm="Solaris.title" linkend="Solaris"></link>. Here are further notes from a user successfully running the module on Digital Unix:</para> |
146 | <para>Instead of trying to get the module to remember where the MySQL libraries were, I instead compiled apache with the information: LDFLAGS='-rpath /isp/mysql/lib/mysql' ./configure ... Everything worked as expected after that. (The error I got without this was "/sbin/loader: Fatal Error: cannot map libmysqlclient.so" ) Digital Unix (v4.0f, at least ) appears to follow the same requirements needed by Solaris, so simply adding librt to the module made it compile without errors. As for the warnings, here's the text: mod_log_sql.c: In function `extract_request_duration': mod_log_sql.c:292: warning: long int format, different type arg (arg 4) mod_log_sql.c: In function `extract_request_timestamp': mod_log_sql.c:497: warning: long int format, different type arg (arg 4) Poking around in the code, it looks like the compiler was complaining that what time() is returning doesn't play nicely with %ld by default. I just typecast them as (long)'s and the warnings went away ( not that the module wasn't working correctly without them ). The module works very well so far in testing... hasn't dropped a single log entry yet. </para> | 155 | <para>Instead of trying to get the module to remember where the MySQL libraries were, I instead compiled apache with the information: LDFLAGS='-rpath /isp/mysql/lib/mysql' ./configure ... Everything worked as expected after that. (The error I got without this was "/sbin/loader: Fatal Error: cannot map libmysqlclient.so" ) Digital Unix (v4.0f, at least ) appears to follow the same requirements needed by Solaris, so simply adding librt to the module made it compile without errors. As for the warnings, here's the text: mod_log_sql.c: In function `extract_request_duration': mod_log_sql.c:292: warning: long int format, different type arg (arg 4) mod_log_sql.c: In function `extract_request_timestamp': mod_log_sql.c:497: warning: long int format, different type arg (arg 4) Poking around in the code, it looks like the compiler was complaining that what time() is returning doesn't play nicely with %ld by default. I just typecast them as (long)'s and the warnings went away ( not that the module wasn't working correctly without them ). The module works very well so far in testing... hasn't dropped a single log entry yet. </para> |
147 | <para>My thanks to Jim Turner for permitting me to quote him here, and for being the first known user of mod_log_sql on Digital Unix</para> | 156 | <para>My thanks to Jim Turner for permitting me to quote him here, and for being the first known user of mod_log_sql on Digital Unix</para> |
148 | </sect3> | 157 | </sect3> |
149 | </sect2> | 158 | </sect2> |
150 | <sect2> | 159 | <sect2> |
151 | <title>Do I want a DSO or a static module</title> | 160 | <title>Do I want a DSO or a static module</title> |
152 | <para><remark>This section is no longer applicable, as the new autoconf setup only allows DSO with Apache 1.3 and 2.0.</remark>You need to know the answer to this question before you proceed. The answer is pretty straightforward: what have you done in the past? If you like all your Apache modules to be dynamic, then you should keep doing that. If you're more of an old-school type and prefer to compile the modules right into apache, do that. Both methods work equally well. </para> | 161 | <remark>This section is no longer applicable, as the new autoconf setup only allows DSO with Apache 1.3 and 2.0. This section will be removed shortly.</remark> |
162 | <para>You need to know the answer to this question before you proceed. The answer is pretty straightforward: what have you done in the past? If you like all your Apache modules to be dynamic, then you should keep doing that. If you're more of an old-school type and prefer to compile the modules right into apache, do that. Both methods work equally well. </para> | ||
153 | <para>FWIW, the DSO method is more modern and increasing in popularity because apxs takes care of a lot of dirty little details for you. As you'll see below, the static-module method is a little more complex.</para> | 163 | <para>FWIW, the DSO method is more modern and increasing in popularity because apxs takes care of a lot of dirty little details for you. As you'll see below, the static-module method is a little more complex.</para> |
154 | </sect2> | 164 | </sect2> |
155 | <sect2> | 165 | <sect2> |
@@ -254,12 +264,12 @@ AddModule mod_log_sql_ssl.c | |||
254 | </orderedlist> | 264 | </orderedlist> |
255 | </sect2> | 265 | </sect2> |
256 | </sect1> | 266 | </sect1> |
257 | <sect1> | 267 | <sect1 id="Configuration"> |
258 | <title><sec:Configuration>Configuration</title> | 268 | <title id="Configuration.title">Configuration</title> |
259 | <sect2> | 269 | <sect2 id="Preperation"> |
260 | <title><sub:PrepDb>Preparing MySQL for logging</title> | 270 | <title id="Preperation.title">Preparing MySQL for logging</title> |
261 | <para>You have to prepare the database to receive data from <application>mod_log_sql</application>, and set up run-time directives in <filename>httpd.conf</filename> to control how and what <application>mod_log_sql</application> logs.</para> | 271 | <para>You have to prepare the database to receive data from <application>mod_log_sql</application>, and set up run-time directives in <filename>httpd.conf</filename> to control how and what <application>mod_log_sql</application> logs.</para> |
262 | <para>This section will discuss how to get started with a basic configuration. Full documentation of all available run-time directives is available in section [sec:ConfRef].</para> | 272 | <para>This section will discuss how to get started with a basic configuration. Full documentation of all available run-time directives is available in section <link endterm="ConfigReference.title" linkend="ConfigReference"></link>.</para> |
263 | <orderedlist> | 273 | <orderedlist> |
264 | <listitem> | 274 | <listitem> |
265 | <para>mod_log_sql can make its own tables on-the-fly, or you can pre-make the tables by hand. The advantage of letting the module make the tables is ease-of-use, but for raw performance you will want to pre-make the tables in order to save some overhead. In this basic setup we'll just let the module create tables for us.</para> | 275 | <para>mod_log_sql can make its own tables on-the-fly, or you can pre-make the tables by hand. The advantage of letting the module make the tables is ease-of-use, but for raw performance you will want to pre-make the tables in order to save some overhead. In this basic setup we'll just let the module create tables for us.</para> |
@@ -270,8 +280,8 @@ AddModule mod_log_sql_ssl.c | |||
270 | Enter password: | 280 | Enter password: |
271 | mysql> create database apachelogs;</screen> | 281 | mysql> create database apachelogs;</screen> |
272 | </listitem> | 282 | </listitem> |
273 | <listitem> | 283 | <listitem id="CreateTable"> |
274 | <para><part:CrTbl>If you want to hand-create the tables, run the enclosed 'create-tables' SQL script as follows ("create_tables.sql" needs to be in your current working directory).</para> | 284 | <para>If you want to hand-create the tables, run the enclosed 'create-tables' SQL script as follows ("create_tables.sql" needs to be in your current working directory).</para> |
275 | <screen>mysql> use apachelogs | 285 | <screen>mysql> use apachelogs |
276 | Database changed | 286 | Database changed |
277 | mysql> source create_tables.sql</screen> | 287 | mysql> source create_tables.sql</screen> |
@@ -281,11 +291,11 @@ mysql> source create_tables.sql</screen> | |||
281 | <screen>mysql> grant insert,create on apachelogs.* to loguser@my.apachemachine.com identified by 'l0gger';</screen> | 291 | <screen>mysql> grant insert,create on apachelogs.* to loguser@my.apachemachine.com identified by 'l0gger';</screen> |
282 | </listitem> | 292 | </listitem> |
283 | <listitem> | 293 | <listitem> |
284 | <para>You may be especially security-paranoid and want "loguser" to not have "create" capability within the "apachelogs" database. You can disable that privilege, but the cost is that you will not be able to use the module's on-the-fly table creation feature. If that cost is acceptable, hand-create the tables as described in step [part:CrTbl] and use the following GRANT statement instead of the one above:</para> | 294 | <para>You may be especially security-paranoid and want "loguser" to not have "create" capability within the "apachelogs" database. You can disable that privilege, but the cost is that you will not be able to use the module's on-the-fly table creation feature. If that cost is acceptable, hand-create the tables as described in step <link endterm="CreateTable" linkend="CreateTable"></link> and use the following GRANT statement instead of the one above:</para> |
285 | <screen>mysql> grant insert on apachelogs.* to loguser@my.apachemachine.com identified by 'l0gger';</screen> | 295 | <screen>mysql> grant insert on apachelogs.* to loguser@my.apachemachine.com identified by 'l0gger';</screen> |
286 | </listitem> | 296 | </listitem> |
287 | <listitem> | 297 | <listitem id="EnableLogging"> |
288 | <para><step:EnaLog>Enable full logging of your <application>MySQL</application> daemon (at least temporarily for debugging purposes) if you don't do this already. Edit /etc/my.cnf and add the following line to your [mysqld] section:</para> | 298 | <para>Enable full logging of your <application>MySQL</application> daemon (at least temporarily for debugging purposes) if you don't do this already. Edit /etc/my.cnf and add the following line to your [mysqld] section:</para> |
289 | <programlisting>log=/var/log/mysql-messages</programlisting> | 299 | <programlisting>log=/var/log/mysql-messages</programlisting> |
290 | <para>Then restart <application>MySQL</application></para> | 300 | <para>Then restart <application>MySQL</application></para> |
291 | <screen># /etc/rc.d/init.d/mysql restart</screen> | 301 | <screen># /etc/rc.d/init.d/mysql restart</screen> |
@@ -332,7 +342,7 @@ LogSQLCreateTables on</programlisting> | |||
332 | <para>Visit your web site in a browser to trigger some hits, then confirm that the entries are being successfully logged:</para> | 342 | <para>Visit your web site in a browser to trigger some hits, then confirm that the entries are being successfully logged:</para> |
333 | <screen># mysql -hdbmachine.foo.com -umysqladmin -p -e "select * from access_log" apachelogs | 343 | <screen># mysql -hdbmachine.foo.com -umysqladmin -p -e "select * from access_log" apachelogs |
334 | Enter password:</screen> | 344 | Enter password:</screen> |
335 | <para>Several lines of output should follow, corresponding to your hits on the site. You now have basic functionality. Don't disable your regular Apache logs until you feel comfortable that the database is behaving as you'd like and that things are going well. If you do not see any entries in the access_log, please consult section [faq:NothingLogged] of the FAQ on how to debug and fix the situation.</para> | 345 | <para>Several lines of output should follow, corresponding to your hits on the site. You now have basic functionality. Don't disable your regular Apache logs until you feel comfortable that the database is behaving as you'd like and that things are going well. If you do not see any entries in the access_log, please consult section <link linkend="NothingLogged"></link> of the FAQ on how to debug and fix the situation.</para> |
336 | </listitem> | 346 | </listitem> |
337 | <listitem> | 347 | <listitem> |
338 | <para>You can now activate the advanced features of mod_log_sql, which are described in the next section.</para> | 348 | <para>You can now activate the advanced features of mod_log_sql, which are described in the next section.</para> |
@@ -344,7 +354,7 @@ Enter password:</screen> | |||
344 | <sect3> | 354 | <sect3> |
345 | <title>Instructing the module what to log</title> | 355 | <title>Instructing the module what to log</title> |
346 | <para>The most basic directive for the module is LogSQLTransferLogFormat, which tells the module which information to send to the database; logging to the database will not take place without it. Place a LogSQLTransferLogFormat directive in the VirtualHost stanza of each virtual host that you want to activate.</para> | 356 | <para>The most basic directive for the module is LogSQLTransferLogFormat, which tells the module which information to send to the database; logging to the database will not take place without it. Place a LogSQLTransferLogFormat directive in the VirtualHost stanza of each virtual host that you want to activate.</para> |
347 | <para>After LogSQLTransferLogFormat you supply a string of characters that tell the module what information to log. In the configuration directive reference (section [sub:Frmat]) there is a table which clearly defines all the possible things to log. Let's say you want to log only the "request time," the "remote host," and the "request"; you'd use:</para> | 357 | <para>After LogSQLTransferLogFormat you supply a string of characters that tell the module what information to log. In the configuration directive reference (section <link endterm="TLogFormat.title" linkend="TLogFormat"></link>) there is a table which clearly defines all the possible things to log. Let's say you want to log only the "request time," the "remote host," and the "request"; you'd use:</para> |
348 | <programlisting>LogSQLTransferLogFormat hUS</programlisting> | 358 | <programlisting>LogSQLTransferLogFormat hUS</programlisting> |
349 | <para>But a more appropriate string to use is</para> | 359 | <para>But a more appropriate string to use is</para> |
350 | <programlisting>LogSQLTransferLogFormat AbHhmRSsTUuv</programlisting> | 360 | <programlisting>LogSQLTransferLogFormat AbHhmRSsTUuv</programlisting> |
@@ -360,8 +370,8 @@ Enter password:</screen> | |||
360 | </listitem> | 370 | </listitem> |
361 | </itemizedlist> | 371 | </itemizedlist> |
362 | </sect3> | 372 | </sect3> |
363 | <sect3> | 373 | <sect3 id="Ignore"> |
364 | <title><sub:Ignore>Instructing the module what NOT to log using filtering directives</title> | 374 | <title id="Ignore.title">Instructing the module what NOT to log using filtering directives</title> |
365 | <para>One "accept" and two "ignore" directives allow you to fine-tune what the module should not log. These are very handy for keeping your database as uncluttered as possible and keeping your statistics free of unneeded numbers. Think of each one as a gatekeeper.</para> | 375 | <para>One "accept" and two "ignore" directives allow you to fine-tune what the module should not log. These are very handy for keeping your database as uncluttered as possible and keeping your statistics free of unneeded numbers. Think of each one as a gatekeeper.</para> |
366 | <para><emphasis>It is important to remember that each of these three directives is purely optional. mod_log_sql's default is to log everything.</emphasis></para> | 376 | <para><emphasis>It is important to remember that each of these three directives is purely optional. mod_log_sql's default is to log everything.</emphasis></para> |
367 | <para>When a request comes in, the contents of LogSQLRequestAccept are evaluated first. This optional, "blanket" directive lets you specify that only certain things are to be accepted for logging, and everything else discarded. Because it is evaluated before LogSQLRequestIgnore and LogSQLRemhostIgnore it can halt logging before those two filtering directives "get their chance." </para> | 377 | <para>When a request comes in, the contents of LogSQLRequestAccept are evaluated first. This optional, "blanket" directive lets you specify that only certain things are to be accepted for logging, and everything else discarded. Because it is evaluated before LogSQLRequestIgnore and LogSQLRemhostIgnore it can halt logging before those two filtering directives "get their chance." </para> |
@@ -428,8 +438,8 @@ LogSQLRequestIgnore statistics.html bluedot.jpg</programlisting> | |||
428 | <para>There are numerous benefits. The admin will not need to create new tables for every new VirtualHost. (Although the admin will still need to drop the tables of virtual hosts that are removed.) The admin will not need to set LogSQLTransferLogTable for each virtual host -- it will be configured automatically based on the host's name. Because each virtual host will log to its own segregated table, data about one virtual server will segregate from others; an admin can grant users access to the tables they need, and they will be unable to view data about another user's virtual host.</para> | 438 | <para>There are numerous benefits. The admin will not need to create new tables for every new VirtualHost. (Although the admin will still need to drop the tables of virtual hosts that are removed.) The admin will not need to set LogSQLTransferLogTable for each virtual host -- it will be configured automatically based on the host's name. Because each virtual host will log to its own segregated table, data about one virtual server will segregate from others; an admin can grant users access to the tables they need, and they will be unable to view data about another user's virtual host.</para> |
429 | <para>In an ISP scenario the admin is likely to have a cluster of many front-end webservers logging to a back-end database. mod_log_sql has a feature that permits analysis of how well the web servers are loadbalancing: the LogSQLMachineID directive. The administrator uses this directive to assign a unique identifier to each machine in the web cluster, e.g. "LogSQLMachineID web01," "LogSQLMachineID web02," etc. Used in conjunction with the 'M' character in LogSQLTransferLogFormat, each entry in the SQL log will include the machine ID of the machine that created the entry. This permits the administrator to count the entries made by each particular machine and thereby analyze the front-end loadbalancing algorithm.</para> | 439 | <para>In an ISP scenario the admin is likely to have a cluster of many front-end webservers logging to a back-end database. mod_log_sql has a feature that permits analysis of how well the web servers are loadbalancing: the LogSQLMachineID directive. The administrator uses this directive to assign a unique identifier to each machine in the web cluster, e.g. "LogSQLMachineID web01," "LogSQLMachineID web02," etc. Used in conjunction with the 'M' character in LogSQLTransferLogFormat, each entry in the SQL log will include the machine ID of the machine that created the entry. This permits the administrator to count the entries made by each particular machine and thereby analyze the front-end loadbalancing algorithm.</para> |
430 | </sect3> | 440 | </sect3> |
431 | <sect3> | 441 | <sect3 id="MultiTable"> |
432 | <title><secMulTable>Logging many-to-one data in separate tables</title> | 442 | <title id="MultiTable.title">Logging many-to-one data in separate tables</title> |
433 | <para>A given HTTP request can have a one-to-many relationship with certain kinds of data. For example, a single HTTP request can have 4 cookies, 3 headers and 5 "mod_gzip" notes associated with it. mod_log_sql is capable of logging these relationships due to the elegance of SQL relational data.</para> | 443 | <para>A given HTTP request can have a one-to-many relationship with certain kinds of data. For example, a single HTTP request can have 4 cookies, 3 headers and 5 "mod_gzip" notes associated with it. mod_log_sql is capable of logging these relationships due to the elegance of SQL relational data.</para> |
434 | <para>You already have a single table containing access requests. One of the columns in that table is 'id' which is intended to contain the unique request ID supplied by the standard Apache module mod_unique_id -- all you need to do is compile in that module and employ the LogSQLTransferLogFormat character 'I'. Thereafter, each request gets a unique ID that can be thought of as a primary key within the database, useful for joining multiple tables. So let's envision several new tables: a notes table, a cookies table, and a table for inbound and outbound headers.</para> | 444 | <para>You already have a single table containing access requests. One of the columns in that table is 'id' which is intended to contain the unique request ID supplied by the standard Apache module mod_unique_id -- all you need to do is compile in that module and employ the LogSQLTransferLogFormat character 'I'. Thereafter, each request gets a unique ID that can be thought of as a primary key within the database, useful for joining multiple tables. So let's envision several new tables: a notes table, a cookies table, and a table for inbound and outbound headers.</para> |
435 | <table> | 445 | <table> |
@@ -593,8 +603,8 @@ where a.id=n.id and a.id='PPIDskBRH30AAGPtAsg';</screen> | |||
593 | <para>It is wasteful and potentially confusing to permit this internal test data to clutter the database, and a solution to the problem is the proper use of the LogSQLMachineID directive. Assume a scenario where the production webservers have IDs like "web01," "web02," and so on -- and the test webservers have IDs like "test01," "test02," etc. Because entries in the log database are distinguished by their source machine, an administrator may purge unneeded test data from the access log as follows:</para> | 603 | <para>It is wasteful and potentially confusing to permit this internal test data to clutter the database, and a solution to the problem is the proper use of the LogSQLMachineID directive. Assume a scenario where the production webservers have IDs like "web01," "web02," and so on -- and the test webservers have IDs like "test01," "test02," etc. Because entries in the log database are distinguished by their source machine, an administrator may purge unneeded test data from the access log as follows:</para> |
594 | <programlisting>delete from access_log where machine_id like 'test%';</programlisting> | 604 | <programlisting>delete from access_log where machine_id like 'test%';</programlisting> |
595 | </sect3> | 605 | </sect3> |
596 | <sect3> | 606 | <sect3 id="DelayedInsert"> |
597 | <title><sub:DelayedIns>Optimizing for a busy database</title> | 607 | <title id="DelayedInsert.title">Optimizing for a busy database</title> |
598 | <para>A busy MySQL database will have SELECT statements running concurrently with INSERT and UPDATE statements. A long-running SELECT can in certain circumstances block INSERTs and therefore block mod_log_sql. A workaround is to enable mod_log_sql for "delayed inserts," which are described as follows in the MySQL documentation.</para> | 608 | <para>A busy MySQL database will have SELECT statements running concurrently with INSERT and UPDATE statements. A long-running SELECT can in certain circumstances block INSERTs and therefore block mod_log_sql. A workaround is to enable mod_log_sql for "delayed inserts," which are described as follows in the MySQL documentation.</para> |
599 | <para>The DELAYED option for the INSERT statement is a MySQL-specific option that is very useful if you have clients that can't wait for the INSERT to complete. This is a common problem when you use MySQL for logging and you also periodically run SELECT and UPDATE statements that take a long time to complete. DELAYED was introduced in MySQL Version 3.22.15. It is a MySQL extension to ANSI SQL92.</para> | 609 | <para>The DELAYED option for the INSERT statement is a MySQL-specific option that is very useful if you have clients that can't wait for the INSERT to complete. This is a common problem when you use MySQL for logging and you also periodically run SELECT and UPDATE statements that take a long time to complete. DELAYED was introduced in MySQL Version 3.22.15. It is a MySQL extension to ANSI SQL92.</para> |
600 | <para>INSERT DELAYED only works with ISAM and MyISAM tables. Note that as MyISAM tables supports concurrent SELECT and INSERT, if there is no free blocks in the middle of the data file, you very seldom need to use INSERT DELAYED with MyISAM. </para> | 610 | <para>INSERT DELAYED only works with ISAM and MyISAM tables. Note that as MyISAM tables supports concurrent SELECT and INSERT, if there is no free blocks in the middle of the data file, you very seldom need to use INSERT DELAYED with MyISAM. </para> |
@@ -610,13 +620,13 @@ where a.id=n.id and a.id='PPIDskBRH30AAGPtAsg';</screen> | |||
610 | </listitem> | 620 | </listitem> |
611 | </orderedlist> | 621 | </orderedlist> |
612 | <warning> | 622 | <warning> |
613 | <para>The MySQL documentation concludes, "This means that you should only use INSERT DELAYED when you are really sure you need it!" Furthermore, the current state of error return from a failed INSERT DELAYED seems to be in flux, and may behave in unpredictable ways between different MySQL versions. See section [sub:DelayedInsFAQ] in the FAQ -- you have been warned.</para> | 623 | <para>The MySQL documentation concludes, "This means that you should only use INSERT DELAYED when you are really sure you need it!" Furthermore, the current state of error return from a failed INSERT DELAYED seems to be in flux, and may behave in unpredictable ways between different MySQL versions. See section <link linkend="DelayedInsertFAQ"></link> in the FAQ -- you have been warned.</para> |
614 | </warning> | 624 | </warning> |
615 | <para>If you are experiencing issues which could be solved by delayed inserts, then set LogSqlDelayedInserts On in the <filename>httpd.conf</filename>. All regular INSERT statements are now INSERT DELAYED, and you should see no more blocking of the module.</para> | 625 | <para>If you are experiencing issues which could be solved by delayed inserts, then set LogSqlDelayedInserts On in the <filename>httpd.conf</filename>. All regular INSERT statements are now INSERT DELAYED, and you should see no more blocking of the module.</para> |
616 | </sect3> | 626 | </sect3> |
617 | </sect2> | 627 | </sect2> |
618 | <sect2> | 628 | <sect2 id="ConfigReference"> |
619 | <title><sec:ConfRef>Configuration directive reference</title> | 629 | <title id="ConfigReference.title">Configuration Directive Reference</title> |
620 | <para>It is imperative that you understand which directives are used only once in the main server config, and which are used inside VirtualHost stanzas and therefore multiple times within httpd.conf. The "context" listed with each entry informs you of this.</para> | 630 | <para>It is imperative that you understand which directives are used only once in the main server config, and which are used inside VirtualHost stanzas and therefore multiple times within httpd.conf. The "context" listed with each entry informs you of this.</para> |
621 | <variablelist> | 631 | <variablelist> |
622 | <varlistentry> | 632 | <varlistentry> |
@@ -739,16 +749,14 @@ where a.id=n.id and a.id='PPIDskBRH30AAGPtAsg';</screen> | |||
739 | <term>LogSQLMachineID</term> | 749 | <term>LogSQLMachineID</term> |
740 | <listitem> | 750 | <listitem> |
741 | <cmdsynopsis> | 751 | <cmdsynopsis> |
742 | <command></command> | 752 | <command>LogSQLMachineID</command> |
743 | <arg></arg> | 753 | <arg choice="req">machineID</arg> |
744 | </cmdsynopsis> | 754 | </cmdsynopsis> |
745 | <simpara></simpara> | 755 | <simpara>Example: LogSQLMachineID web01</simpara> |
746 | <simpara></simpara> | 756 | <simpara>Context: main server config</simpara> |
747 | <simpara></simpara> | 757 | <para>If you have a farm of webservers then you may wish to know which particular machine made each entry; this is useful for analyzing your load-balancing methodology. LogSQLMachineID permits you to distinguish each machine's entries if you assign each machine its own LogSQLMachineID: for example, the first webserver gets ``LogSQLMachineID web01,'' the second gets ``LogSQLMachineID web02,'' etc.</para> |
748 | <para></para> | ||
749 | <para></para> | ||
750 | <note> | 758 | <note> |
751 | <para><filename></filename></para> | 759 | <para>This is defined only once in the <filename moreinfo="none">httpd.conf</filename> file.</para> |
752 | </note> | 760 | </note> |
753 | </listitem> | 761 | </listitem> |
754 | </varlistentry> | 762 | </varlistentry> |
@@ -756,16 +764,27 @@ where a.id=n.id and a.id='PPIDskBRH30AAGPtAsg';</screen> | |||
756 | <term>LogSQLMassVirtualHosting</term> | 764 | <term>LogSQLMassVirtualHosting</term> |
757 | <listitem> | 765 | <listitem> |
758 | <cmdsynopsis> | 766 | <cmdsynopsis> |
759 | <command></command> | 767 | <command>LogSQLMassVirtualHosting</command> |
760 | <arg></arg> | 768 | <arg choice="req">flag</arg> |
761 | </cmdsynopsis> | 769 | </cmdsynopsis> |
762 | <simpara></simpara> | 770 | <simpara>Example: LogSQLMassVirtualHosting On</simpara> |
763 | <simpara></simpara> | 771 | <simpara>Default: Off</simpara> |
764 | <simpara></simpara> | 772 | <simpara>Context: main server config</simpara> |
765 | <para></para> | 773 | <para>If you administer a site hosting many, many virtual hosts then this option will appeal to you. If you turn on LogSQLMassVirtualHosting then several things happen:</para> |
766 | <para></para> | 774 | <itemizedlist> |
775 | <listitem> | ||
776 | <para>the on-the-fly table creation feature is activated automatically</para> | ||
777 | </listitem> | ||
778 | <listitem> | ||
779 | <para>the transfer log table name is dynamically set from the virtual host's name after stripping out SQL-unfriendly characters (example: a virtual host www.grubbybaby.com gets logged to table access_www_grubbybaby_com)</para> | ||
780 | </listitem> | ||
781 | <listitem> | ||
782 | <para>which, in turn, means that each virtual host logs to its own segregated table. Because there is no data shared between virtual servers you can grant your users access to the tables they need; they will be unable to view others' data.</para> | ||
783 | </listitem> | ||
784 | </itemizedlist> | ||
785 | <para>This is a huge boost in convenience for sites with many virtual servers. Activating LogSQLMassVirtualHosting obviates the need to create every virtual server's table and provides more granular security possibilities.</para> | ||
767 | <note> | 786 | <note> |
768 | <para><filename></filename></para> | 787 | <para>This is defined only once in the <filename moreinfo="none">httpd.conf</filename> file.</para> |
769 | </note> | 788 | </note> |
770 | </listitem> | 789 | </listitem> |
771 | </varlistentry> | 790 | </varlistentry> |
@@ -773,16 +792,15 @@ where a.id=n.id and a.id='PPIDskBRH30AAGPtAsg';</screen> | |||
773 | <term>LogSQLNotesLogTable</term> | 792 | <term>LogSQLNotesLogTable</term> |
774 | <listitem> | 793 | <listitem> |
775 | <cmdsynopsis> | 794 | <cmdsynopsis> |
776 | <command></command> | 795 | <command>LogSQLNotesLogTable</command> |
777 | <arg></arg> | 796 | <arg choice="req"><replaceable>table-name</replaceable></arg> |
778 | </cmdsynopsis> | 797 | </cmdsynopsis> |
779 | <simpara></simpara> | 798 | <simpara>Example: LogSQLNotesLogTable notes-log</simpara> |
780 | <simpara></simpara> | 799 | <simpara>Default: notes</simpara> |
781 | <simpara></simpara> | 800 | <simpara>Context: virtual_host</simpara> |
782 | <para></para> | 801 | <para>Defines which table is used for logging of notes. Working in conjunction with LogSQLWhichNotes, you can log many of each request's associated notes to a separate table. For meaningful data retrieval the notes table is keyed to the access table by the unique request ID supplied by the standard Apache module mod_unique_id.</para> |
783 | <para></para> | ||
784 | <note> | 802 | <note> |
785 | <para><filename></filename></para> | 803 | <para>This table must be created (see create-tables.sql included in the package), or LogSQLCreateTables must be set to 'On'.</para> |
786 | </note> | 804 | </note> |
787 | </listitem> | 805 | </listitem> |
788 | </varlistentry> | 806 | </varlistentry> |
@@ -790,84 +808,75 @@ where a.id=n.id and a.id='PPIDskBRH30AAGPtAsg';</screen> | |||
790 | <term>LogSQlPreserveFile</term> | 808 | <term>LogSQlPreserveFile</term> |
791 | <listitem> | 809 | <listitem> |
792 | <cmdsynopsis> | 810 | <cmdsynopsis> |
793 | <command></command> | 811 | <command>LogSQLPreserveFile</command> |
794 | <arg></arg> | 812 | <arg choice="req"><replaceable>filename</replaceable></arg> |
795 | </cmdsynopsis> | 813 | </cmdsynopsis> |
796 | <simpara></simpara> | 814 | <simpara>Example: LogSQLPreserveFile offline-preserve</simpara> |
797 | <simpara></simpara> | 815 | <simpara>Default: /tmp/sql-preserve</simpara> |
798 | <simpara></simpara> | 816 | <simpara>Context: virtual host</simpara> |
799 | <para></para> | 817 | <para>mod_log_sql writes queries to this local preserve file in the event that it cannot reach the database, and thus ensures that your high-availability web frontend does not lose logs during a temporary database outage. This could happen for a number of reasons: the database goes offline, the network breaks, etc. You will not lose entries since the module has this backup. The file consists of a series of SQL statements that can be imported into your database at your convenience; furthermore, because the SQL queries contain the access timestamps you do not need to worry about out-of-order data after the import, which is done in a simple manner:</para> |
800 | <para></para> | 818 | <screen># mysql -uadminuser -p mydbname < /tmp/sql-preserve</screen> |
801 | <note> | 819 | <para>If you do not define LogSQLPreserveFile then all virtual servers will log to the same default preserve file (<filename>/tmp/sql-preserve</filename>). You can redefine this on a virtual-host basis in order to segregate your preserve files if you desire. Note that segregation is not usually necessary, as the SQL statements that are written to the preserve file already distinguish between different virtual hosts if you include the 'v' character in your LogSQLTransferLogFormat directive. It is only necessary to segregate preserve-files by virualhost if you also segregate access logs by virtualhost.</para> |
802 | <para><filename></filename></para> | 820 | <para>The module will log to Apache's ErrorLog when it notices a database outage, and upon database return. You will therefore know when the preserve file is being used, although it is your responsibility to import the file.</para> |
803 | </note> | 821 | <para>The file does not need to be created in advance. It is safe to remove or rename the file without interrupting Apache, as the module closes the filehandle immediately after completing the write. The file is created with the user & group ID of the running Apache process (e.g. 'nobody' on many Linux distributions).</para> |
804 | </listitem> | 822 | </listitem> |
805 | </varlistentry> | 823 | </varlistentry> |
806 | <varlistentry> | 824 | <varlistentry> |
807 | <term>LogSQLRemhostIgnore</term> | 825 | <term>LogSQLRemhostIgnore</term> |
808 | <listitem> | 826 | <listitem> |
809 | <cmdsynopsis> | 827 | <cmdsynopsis> |
810 | <command></command> | 828 | <command>LogSQLRemhostIgnore</command> |
811 | <arg></arg> | 829 | <arg choice="req" rep="repeat"><replaceable>hostname</replaceable></arg> |
812 | </cmdsynopsis> | 830 | </cmdsynopsis> |
813 | <simpara></simpara> | 831 | <simpara>Example: LogSQLRemhostIgnore localnet.com</simpara> |
814 | <simpara></simpara> | 832 | <simpara>Context: virtual host</simpara> |
815 | <simpara></simpara> | 833 | <para>Lists a series of strings that, if present in the REMOTE_HOST, will cause that request to <emphasis>not</emphasis> be logged. This directive is useful for cutting down on log clutter when you are certain that you want to ignore requests from certain hosts, such as your own internal network machines. See section <link endterm="Ignore.title" linkend="Ignore"></link> for some tips for using this directive.</para> |
816 | <para></para> | 834 | <para>Each string is separated by a space, and no regular expressions or globbing are allowed. Each string is evaluated as a substring of the REMOTE_HOST using strstr(). The comparison is case sensitive.</para> |
817 | <para></para> | ||
818 | <note> | ||
819 | <para><filename></filename></para> | ||
820 | </note> | ||
821 | </listitem> | 835 | </listitem> |
822 | </varlistentry> | 836 | </varlistentry> |
823 | <varlistentry> | 837 | <varlistentry> |
824 | <term>LogSQLRequestAccept</term> | 838 | <term>LogSQLRequestAccept</term> |
825 | <listitem> | 839 | <listitem> |
826 | <cmdsynopsis> | 840 | <cmdsynopsis> |
827 | <command></command> | 841 | <command>LogSQLRequestAccept</command> |
828 | <arg></arg> | 842 | <arg choice="req" rep="repeat"><replaceable>hostname</replaceable></arg> |
829 | </cmdsynopsis> | 843 | </cmdsynopsis> |
830 | <simpara></simpara> | 844 | <simpara>Example: LogSQLRequestAccept .html .php .jpg</simpara> |
831 | <simpara></simpara> | 845 | <simpara>Default: if not specified, all requests are 'accepted'</simpara> |
832 | <simpara></simpara> | 846 | <simpara>Context: virtual host</simpara> |
833 | <para></para> | 847 | <para>Lists a series of strings that, if present in the URI, will permit that request to be considered for logging (depending on additional filtering by the "ignore" directives). Any request that fails to match one of the LogSQLRequestAccept entries will be discarded.</para> |
834 | <para></para> | 848 | <para>This directive is useful for cutting down on log clutter when you are certain that you only want to log certain kinds of requests, and just blanket-ignore everything else. See section <link endterm="Ignore.title" linkend="Ignore"></link> for some tips for using this directive.</para> |
835 | <note> | 849 | <para>Each string is separated by a space, and no regular expressions or globbing are allowed. Each string is evaluated as a substring of the URI using strstr(). The comparison is case sensitive.</para> |
836 | <para><filename></filename></para> | 850 | <para>This directive is completely optional. It is more general than LogSQLRequestIgnore and is evaluated before LogSQLRequestIgnore . If this directive is not used, <emphasis>all</emphasis> requests are accepted and passed on to the other filtering directives. Therefore, only use this directive if you have a specific reason to do so.</para> |
837 | </note> | ||
838 | </listitem> | 851 | </listitem> |
839 | </varlistentry> | 852 | </varlistentry> |
840 | <varlistentry> | 853 | <varlistentry> |
841 | <term>LogSQLRequestIgnore</term> | 854 | <term>LogSQLRequestIgnore</term> |
842 | <listitem> | 855 | <listitem> |
843 | <cmdsynopsis> | 856 | <cmdsynopsis> |
844 | <command></command> | 857 | <command>LogSQLRequestIgnore</command> |
845 | <arg></arg> | 858 | <arg choice="req" rep="repeat"><replaceable>hostname</replaceable></arg> |
846 | </cmdsynopsis> | 859 | </cmdsynopsis> |
847 | <simpara></simpara> | 860 | <simpara>Example: LogSQLRequestIgnore root.exe cmd.exe default.ida favicon.ico</simpara> |
848 | <simpara></simpara> | 861 | <simpara>Context: virtual host</simpara> |
849 | <simpara></simpara> | 862 | <para>Lists a series of strings that, if present in the URI, will cause that request to <emphasis>NOT</emphasis> be logged. This directive is useful for cutting down on log clutter when you are certain that you want to ignore requests for certain objects. See section <link endterm="Ignore.title" linkend="Ignore"></link> for some tips for using this directive.</para> |
850 | <para></para> | 863 | <para>Each string is separated by a space, and no regular expressions or globbing are allowed. Each string is evaluated as a substring of the URI using strstr(). The comparison is case sensitive.</para> |
851 | <para></para> | ||
852 | <note> | ||
853 | <para><filename></filename></para> | ||
854 | </note> | ||
855 | </listitem> | 864 | </listitem> |
856 | </varlistentry> | 865 | </varlistentry> |
857 | <varlistentry> | 866 | <varlistentry> |
858 | <term>LogSQLSocketFile</term> | 867 | <term>LogSQLSocketFile</term> |
859 | <listitem> | 868 | <listitem> |
860 | <cmdsynopsis> | 869 | <cmdsynopsis> |
861 | <command></command> | 870 | <command>LogSQlSocketFile</command> |
862 | <arg></arg> | 871 | <arg choice="req"><replaceable>filename</replaceable></arg> |
863 | </cmdsynopsis> | 872 | </cmdsynopsis> |
864 | <simpara></simpara> | 873 | <simpara>Example: LogSQLSocketFile /tmp/mysql.sock</simpara> |
865 | <simpara></simpara> | 874 | <simpara>Default: /var/lib/mysql/mysql.sock</simpara> |
866 | <simpara></simpara> | 875 | <simpara>Context: main server config</simpara> |
867 | <para></para> | 876 | <para>At Apache runtime you can specify the MySQL socket file to use. Set this once in your main server config to override the default value. This value is irrelevant if your database resides on a separate machine.</para> |
868 | <para></para> | 877 | <para>mod_log_sql will automatically employ the socket for db communications if the database resides on the local host. If the db resides on a separate host the module will automatically use TCP/IP. This is a function of the MySQL API and is not user-configurable.</para> |
869 | <note> | 878 | <note> |
870 | <para><filename></filename></para> | 879 | <para>This is defined only once in the <filename moreinfo="none">httpd.conf</filename> file.</para> |
871 | </note> | 880 | </note> |
872 | </listitem> | 881 | </listitem> |
873 | </varlistentry> | 882 | </varlistentry> |
@@ -875,50 +884,45 @@ where a.id=n.id and a.id='PPIDskBRH30AAGPtAsg';</screen> | |||
875 | <term>LogSQLTCPPort</term> | 884 | <term>LogSQLTCPPort</term> |
876 | <listitem> | 885 | <listitem> |
877 | <cmdsynopsis> | 886 | <cmdsynopsis> |
878 | <command></command> | 887 | <command>LogSQLTCPPort</command> |
879 | <arg></arg> | 888 | <arg choice="req"><replaceable>port-number</replaceable></arg> |
880 | </cmdsynopsis> | 889 | </cmdsynopsis> |
881 | <simpara></simpara> | 890 | <simpara>Example: LogSQLTCPPort 3309</simpara> |
882 | <simpara></simpara> | 891 | <simpara>Default: 3306</simpara> |
883 | <simpara></simpara> | 892 | <simpara>Context: main server config</simpara> |
884 | <para></para> | 893 | <para>Your database may listen on a different port than the default. If so, use this directive to instruct the module which port to use. This directive only applies if the database is on a different machine connected via TCP/IP.</para> |
885 | <para></para> | ||
886 | <note> | 894 | <note> |
887 | <para><filename></filename></para> | 895 | <para>This is defined only once in the <filename moreinfo="none">httpd.conf</filename> file.</para> |
888 | </note> | 896 | </note> |
889 | </listitem> | 897 | </listitem> |
890 | </varlistentry> | 898 | </varlistentry> |
891 | <varlistentry> | 899 | <varlistentry id="TLogFormat"> |
892 | <term><sub:Frmat>LogSQLTransferLogFormat </term> | 900 | <term id="TLogFormat.title">LogSQLTransferLogFormat </term> |
893 | <listitem> | 901 | <listitem> |
894 | <cmdsynopsis> | 902 | <cmdsynopsis> |
895 | <command></command> | 903 | <command>LogSQLTransferLogFormat</command> |
896 | <arg></arg> | 904 | <arg choice="req"><replaceable>format-string</replaceable></arg> |
897 | </cmdsynopsis> | 905 | </cmdsynopsis> |
898 | <simpara></simpara> | 906 | <simpara>Example: LogSQLTransferLogFormat huSUTv</simpara> |
899 | <simpara></simpara> | 907 | <simpara>Default: AbHhmRSsTUuv</simpara> |
900 | <simpara></simpara> | 908 | <simpara>Context: virtual host</simpara> |
901 | <para></para> | 909 | <para>Each character in the format-string defines an attribute of the request that you wish to log. The default logs the information required to create Combined Log Format logs, plus several extras. Here is the full list of allowable keys, which sometimes resemble their Apache counterparts, but do not always:</para> |
902 | <para></para> | 910 | <para>TODO: Insert Log Format Types Table</para> |
903 | <note> | ||
904 | <para><filename></filename></para> | ||
905 | </note> | ||
906 | </listitem> | 911 | </listitem> |
907 | </varlistentry> | 912 | </varlistentry> |
908 | <varlistentry> | 913 | <varlistentry> |
909 | <term>LogSQLTransferLogTable</term> | 914 | <term>LogSQLTransferLogTable</term> |
910 | <listitem> | 915 | <listitem> |
911 | <cmdsynopsis> | 916 | <cmdsynopsis> |
912 | <command></command> | 917 | <command>LogSQLTransferLogTable</command> |
913 | <arg></arg> | 918 | <arg choice="req"><replaceable>table-name</replaceable></arg> |
914 | </cmdsynopsis> | 919 | </cmdsynopsis> |
915 | <simpara></simpara> | 920 | <simpara>Example: LogSQLTransferLogTable access_log_table</simpara> |
916 | <simpara></simpara> | 921 | <simpara>Context: virtual host</simpara> |
917 | <simpara></simpara> | 922 | <para>Defines which table is used for logging of Apache's transfers; this is analogous to Apache's TransferLog directive. table-name must be a valid table within the database defined in LogSQLDatabase.</para> |
918 | <para></para> | 923 | <para>This directive is <emphasis>not</emphasis> necessary if you declare LogSQLMassVirtualHosting On, since that directive activates dynamically-named tables. If you attempt to use LogSqlTransferlogTable at the same time a warning will be logged and it will be ignored, since LogSQLMassVirtualHosting takes priority.</para> |
919 | <para></para> | ||
920 | <note> | 924 | <note> |
921 | <para><filename></filename></para> | 925 | <para>Requires unless LogSQLMassVirtualHosting is set to On</para> |
922 | </note> | 926 | </note> |
923 | </listitem> | 927 | </listitem> |
924 | </varlistentry> | 928 | </varlistentry> |
@@ -926,16 +930,16 @@ where a.id=n.id and a.id='PPIDskBRH30AAGPtAsg';</screen> | |||
926 | <term>LogSQLWhichCookie</term> | 930 | <term>LogSQLWhichCookie</term> |
927 | <listitem> | 931 | <listitem> |
928 | <cmdsynopsis> | 932 | <cmdsynopsis> |
929 | <command></command> | 933 | <command>LogSQLWhichCookie</command> |
930 | <arg></arg> | 934 | <arg choice="req"><replaceable>cookiename</replaceable></arg> |
931 | </cmdsynopsis> | 935 | </cmdsynopsis> |
932 | <simpara></simpara> | 936 | <simpara>Example; LogSQLWhichCookie Clicks</simpara> |
933 | <simpara></simpara> | 937 | <simpara>Context: virtual host</simpara> |
934 | <simpara></simpara> | 938 | <para>In HTTP, cookies have names to distinguish them from each other. Using mod_usertrack, for example, you can give your user-tracking cookies a name with the CookieName directive.</para> |
935 | <para></para> | 939 | <para>mod_log_sql allows you to log cookie information. LogSQL_WhichCookie tells mod_log_sql which cookie to log. This is necessary because you will usually be setting and receiving more than one cookie from a client.</para> |
936 | <para></para> | ||
937 | <note> | 940 | <note> |
938 | <para><filename></filename></para> | 941 | <para>You must include a 'c' character in LogSQLTransferLogFormat for this directive to take effect.</para> |
942 | <para>although this was origintally intended for people using mod_usertrack to create user-tracking cookies, you are not restricted in any way. You can choose which cookie you wish to log to the database - any cookie at all - and it does not necessarily have to have anything to do with mod_usertrack.</para> | ||
939 | </note> | 943 | </note> |
940 | </listitem> | 944 | </listitem> |
941 | </varlistentry> | 945 | </varlistentry> |
@@ -943,16 +947,14 @@ where a.id=n.id and a.id='PPIDskBRH30AAGPtAsg';</screen> | |||
943 | <term>LogSQLWhichCookies</term> | 947 | <term>LogSQLWhichCookies</term> |
944 | <listitem> | 948 | <listitem> |
945 | <cmdsynopsis> | 949 | <cmdsynopsis> |
946 | <command></command> | 950 | <command>LogSQLWhichCookies</command> |
947 | <arg></arg> | 951 | <arg choice="req" rep="repeat"><replaceable>cookie-name</replaceable></arg> |
948 | </cmdsynopsis> | 952 | </cmdsynopsis> |
949 | <simpara></simpara> | 953 | <simpara>Example: logSQLWhichCookies userlogin cookie1 cookie2</simpara> |
950 | <simpara></simpara> | 954 | <simpara>Context: virtual host</simpara> |
951 | <simpara></simpara> | 955 | <para>Defines the list of cookies you would like logged. This works in conjunction with LogSQLCookieLogTable. This directive does <emphasis>not</emphasis> require any additional characters to be added to the LogSQLTransferLogFormat string. The feature is activated simply by including this directive, upon which you will begin populating the separate cookie table with data.</para> |
952 | <para></para> | ||
953 | <para></para> | ||
954 | <note> | 956 | <note> |
955 | <para><filename></filename></para> | 957 | <para>The table must be created (see create-tables.sql, included in the package), or LogSQLCreateTables must be set to 'On'.</para> |
956 | </note> | 958 | </note> |
957 | </listitem> | 959 | </listitem> |
958 | </varlistentry> | 960 | </varlistentry> |
@@ -960,16 +962,14 @@ where a.id=n.id and a.id='PPIDskBRH30AAGPtAsg';</screen> | |||
960 | <term>LogSQLWhichHeadersIn</term> | 962 | <term>LogSQLWhichHeadersIn</term> |
961 | <listitem> | 963 | <listitem> |
962 | <cmdsynopsis> | 964 | <cmdsynopsis> |
963 | <command></command> | 965 | <command>LogSQLWhichHeadersIn</command> |
964 | <arg></arg> | 966 | <arg choice="req" rep="repeat"><replaceable>header-name</replaceable></arg> |
965 | </cmdsynopsis> | 967 | </cmdsynopsis> |
966 | <simpara></simpara> | 968 | <simpara>Example: LogSQLWhichHeadersIn UserAgent Accept-Encodeing Host</simpara> |
967 | <simpara></simpara> | 969 | <simpara>Context: virtual host</simpara> |
968 | <simpara></simpara> | 970 | <para>Defines the list of inbound headers you would like logged. This works in conjunction with LogSQLHeadersInLogTable. This directive does not require any additional characters to be added to the LogSQLTransferLogFormat string. The feature is activated simply by including this directive, upon which you will begin populating the separate inbound-headers table with data.</para> |
969 | <para></para> | ||
970 | <para></para> | ||
971 | <note> | 971 | <note> |
972 | <para><filename></filename></para> | 972 | <para>The table must be created (see create-tables.sql, included in the package), or LogSQLCreateTables must be set to 'On'.</para> |
973 | </note> | 973 | </note> |
974 | </listitem> | 974 | </listitem> |
975 | </varlistentry> | 975 | </varlistentry> |
@@ -977,16 +977,14 @@ where a.id=n.id and a.id='PPIDskBRH30AAGPtAsg';</screen> | |||
977 | <term>LogSQLWhichHeadersOut</term> | 977 | <term>LogSQLWhichHeadersOut</term> |
978 | <listitem> | 978 | <listitem> |
979 | <cmdsynopsis> | 979 | <cmdsynopsis> |
980 | <command></command> | 980 | <command>LogSQLWhichHeadersOut</command> |
981 | <arg></arg> | 981 | <arg choice="req" rep="repeat"><replaceable>header-name</replaceable></arg> |
982 | </cmdsynopsis> | 982 | </cmdsynopsis> |
983 | <simpara></simpara> | 983 | <simpara>Example: LogSQLWhichHeadersOut Expires Content-Type Cache-Control</simpara> |
984 | <simpara></simpara> | 984 | <simpara>Context: virtual host</simpara> |
985 | <simpara></simpara> | 985 | <para>Defines the list of outbound headers you would like logged. This works in conjunction with LogSQLHeadersOutLogTable. This directive does not require any additional characters to be added to the LogSQLTransferLogFormat string. The feature is activated simply by including this directive, upon which you will begin populating the separate outbound-headers table with data.</para> |
986 | <para></para> | ||
987 | <para></para> | ||
988 | <note> | 986 | <note> |
989 | <para><filename></filename></para> | 987 | <para>The table must be created (see create-tables.sql, included in the package), or LogSQLCreateTables must be set to 'On'.</para> |
990 | </note> | 988 | </note> |
991 | </listitem> | 989 | </listitem> |
992 | </varlistentry> | 990 | </varlistentry> |
@@ -994,20 +992,29 @@ where a.id=n.id and a.id='PPIDskBRH30AAGPtAsg';</screen> | |||
994 | <term>LogSQLWhichNotes</term> | 992 | <term>LogSQLWhichNotes</term> |
995 | <listitem> | 993 | <listitem> |
996 | <cmdsynopsis> | 994 | <cmdsynopsis> |
997 | <command></command> | 995 | <command>LogSQLWhichNotes</command> |
998 | <arg></arg> | 996 | <arg choice="req" rep="repeat"><replaceable>note-name</replaceable></arg> |
999 | </cmdsynopsis> | 997 | </cmdsynopsis> |
1000 | <simpara></simpara> | 998 | <simpara>Example: LogSQLWhichNotes mod_gzip_result mod_gzip_ompression_ratio</simpara> |
1001 | <simpara></simpara> | 999 | <simpara>Context: virtual host</simpara> |
1002 | <simpara></simpara> | 1000 | <para>Defines the list of notes you would like logged. This works in conjunction with LogSQLNotesLogTable. This directive does not require any additional characters to be added to the LogSQLTransferLogFormat string. The feature is activated simply by including this directive, upon which you will begin populating the separate notes table with data.</para> |
1003 | <para></para> | ||
1004 | <para></para> | ||
1005 | <note> | 1001 | <note> |
1006 | <para><filename></filename></para> | 1002 | <para>The table must be created (see create-tables.sql, included in the package), or LogSQLCreateTables must be set to 'On'.</para> |
1007 | </note> | 1003 | </note> |
1008 | </listitem> | 1004 | </listitem> |
1009 | </varlistentry> | 1005 | </varlistentry> |
1010 | </variablelist> | 1006 | </variablelist> |
1007 | <sect3> | ||
1008 | <title>DataBase Configuration</title> | ||
1009 | <variablelist> | ||
1010 | <varlistentry> | ||
1011 | <term></term> | ||
1012 | <listitem> | ||
1013 | <para></para> | ||
1014 | </listitem> | ||
1015 | </varlistentry> | ||
1016 | </variablelist> | ||
1017 | </sect3> | ||
1011 | </sect2> | 1018 | </sect2> |
1012 | </sect1> | 1019 | </sect1> |
1013 | <sect1> | 1020 | <sect1> |
@@ -1015,7 +1022,7 @@ where a.id=n.id and a.id='PPIDskBRH30AAGPtAsg';</screen> | |||
1015 | <qandaset> | 1022 | <qandaset> |
1016 | <qandadiv> | 1023 | <qandadiv> |
1017 | <title>General module questions</title> | 1024 | <title>General module questions</title> |
1018 | <qandaentry> | 1025 | <qandaentry id="WhyLogToSQL"> |
1019 | <question> | 1026 | <question> |
1020 | <para>Why log to an SQL database?</para> | 1027 | <para>Why log to an SQL database?</para> |
1021 | </question> | 1028 | </question> |
@@ -1183,7 +1190,7 @@ where a.id=n.id and a.id='PPIDskBRH30AAGPtAsg';</screen> | |||
1183 | <para>Who's using mod_log_sql?</para> | 1190 | <para>Who's using mod_log_sql?</para> |
1184 | </question> | 1191 | </question> |
1185 | <answer> | 1192 | <answer> |
1186 | <para>Good question! It would be great to find out! If you are a production-level mod_log_sql user, please contact [(chris@grubbybaby.com)||the maintainer, Chris Powell] so that you can be mentioned here.</para> | 1193 | <para>Good question! It would be great to find out! If you are a production-level mod_log_sql user, please contact &MaintainerContact; so that you can be mentioned here.</para> |
1187 | </answer> | 1194 | </answer> |
1188 | </qandaentry> | 1195 | </qandaentry> |
1189 | <qandaentry> | 1196 | <qandaentry> |
@@ -1233,7 +1240,7 @@ where a.id=n.id and a.id='PPIDskBRH30AAGPtAsg';</screen> | |||
1233 | <para>I have discovered a bug. Who can I contact?</para> | 1240 | <para>I have discovered a bug. Who can I contact?</para> |
1234 | </question> | 1241 | </question> |
1235 | <answer> | 1242 | <answer> |
1236 | <para>Please contact [(chris@grubbybaby.com)||the maintainer], or post a message to the mod_log_sql mailing list. Your comments, suggestions, bugfixes, bug catches, and usage testimonials are always welcome. As free software, mod_log_sql is intended to be a community effort -- any code contributions or other ideas will be fully and openly credited, of course.</para> | 1243 | <para>Please contact &MaintainerContact;, or post a message to the mod_log_sql mailing list. Your comments, suggestions, bugfixes, bug catches, and usage testimonials are always welcome. As free software, mod_log_sql is intended to be a community effort -- any code contributions or other ideas will be fully and openly credited, of course.</para> |
1237 | </answer> | 1244 | </answer> |
1238 | </qandaentry> | 1245 | </qandaentry> |
1239 | </qandadiv> | 1246 | </qandadiv> |
@@ -1248,9 +1255,9 @@ where a.id=n.id and a.id='PPIDskBRH30AAGPtAsg';</screen> | |||
1248 | <para>PHP and mod_log_sql can be configured to happily coexist. The solution is to configure PHP to link against the real MySQL libraries: recompile PHP using --with-mysql=/your/path. Apache will run properly once the modules are all using the same version of the MySQL libraries.</para> | 1255 | <para>PHP and mod_log_sql can be configured to happily coexist. The solution is to configure PHP to link against the real MySQL libraries: recompile PHP using --with-mysql=/your/path. Apache will run properly once the modules are all using the same version of the MySQL libraries.</para> |
1249 | </answer> | 1256 | </answer> |
1250 | </qandaentry> | 1257 | </qandaentry> |
1251 | <qandaentry> | 1258 | <qandaentry id="NothingLogged"> |
1252 | <question> | 1259 | <question> |
1253 | <para><faq:NothingLogged>Apache appears to start up fine, but nothing is getting logged in the database</para> | 1260 | <para>Apache appears to start up fine, but nothing is getting logged in the database</para> |
1254 | </question> | 1261 | </question> |
1255 | <answer> | 1262 | <answer> |
1256 | <para>If you do not see any entries in the access_log, then something is preventing the inserts from happening. This could be caused by several things:</para> | 1263 | <para>If you do not see any entries in the access_log, then something is preventing the inserts from happening. This could be caused by several things:</para> |
@@ -1269,7 +1276,7 @@ where a.id=n.id and a.id='PPIDskBRH30AAGPtAsg';</screen> | |||
1269 | </listitem> | 1276 | </listitem> |
1270 | </itemizedlist> | 1277 | </itemizedlist> |
1271 | <remark>It is improper to ask for help before you have followed these steps.</remark> | 1278 | <remark>It is improper to ask for help before you have followed these steps.</remark> |
1272 | <para>First examine the MySQL log that you established in step [step:EnaLog] of section [sub:PrepDb]. Ensure that the INSERT statements are not being rejected because of a malformed table name or other typographical error. By enabling that log, you instructed MySQL to log every connection and command it receives -- if you see no INSERT attempts in the log, the module isn't successfully connecting to the database. If you see nothing at all in the log -- not even a record of your administrative connection attempts, then you did not enable the log correctly. If you do see INSERT attempts but they are failing, the log should tell you why.</para> | 1279 | <para>First examine the MySQL log that you established in step <link linkend="EnableLogging"></link> of section <link linkend="Preperation"></link>. Ensure that the INSERT statements are not being rejected because of a malformed table name or other typographical error. By enabling that log, you instructed MySQL to log every connection and command it receives -- if you see no INSERT attempts in the log, the module isn't successfully connecting to the database. If you see nothing at all in the log -- not even a record of your administrative connection attempts, then you did not enable the log correctly. If you do see INSERT attempts but they are failing, the log should tell you why.</para> |
1273 | <para>Second, confirm that your LogSQL* directives are all correct.</para> | 1280 | <para>Second, confirm that your LogSQL* directives are all correct.</para> |
1274 | <para>Third, examine the Apache error logs for messages from mod_log_sql; the module will offer hints as to why it cannot connect, etc. </para> | 1281 | <para>Third, examine the Apache error logs for messages from mod_log_sql; the module will offer hints as to why it cannot connect, etc. </para> |
1275 | <para>The next thing to do is to change the LogLevel directive <emphasis>in the main server config as well as in each VirtualHost config:</emphasis></para> | 1282 | <para>The next thing to do is to change the LogLevel directive <emphasis>in the main server config as well as in each VirtualHost config:</emphasis></para> |
@@ -1422,9 +1429,9 @@ mysql> optimize table access_log; </screen> | |||
1422 | <para>If you have exhausted all the tuning possibilities on your existing server, it is probably time you evaluated the benefits of clustering two or more webservers together in a load-balanced fashion. In fact, users of such a setup are mod_log_sql's target audience!</para> | 1429 | <para>If you have exhausted all the tuning possibilities on your existing server, it is probably time you evaluated the benefits of clustering two or more webservers together in a load-balanced fashion. In fact, users of such a setup are mod_log_sql's target audience!</para> |
1423 | </answer> | 1430 | </answer> |
1424 | </qandaentry> | 1431 | </qandaentry> |
1425 | <qandaentry> | 1432 | <qandaentry id="DelayedInsertFAQ"> |
1426 | <question> | 1433 | <question id="DelayedInsertFAQ.title"> |
1427 | <para><sub:DelayedInsFAQ>What is the issue with activating delayed inserts?</para> | 1434 | <para>What is the issue with activating delayed inserts?</para> |
1428 | </question> | 1435 | </question> |
1429 | <answer> | 1436 | <answer> |
1430 | <para>INSERT DELAYED is a specific syntax to MySQL and is not supported by any other database. Ergo, why is it needed, and what MySQL deficiency is it working around? INSERT DELAYED is a kluge.</para> | 1437 | <para>INSERT DELAYED is a specific syntax to MySQL and is not supported by any other database. Ergo, why is it needed, and what MySQL deficiency is it working around? INSERT DELAYED is a kluge.</para> |
@@ -1442,7 +1449,7 @@ mysql> optimize table access_log; </screen> | |||
1442 | <para>Instead of delayed inserts, you may wish to utilize InnoDB tables (instead of the standard MyISAM tables). InnoDB tables suppot row-level locking and are recommended for high-volume databases.</para> | 1449 | <para>Instead of delayed inserts, you may wish to utilize InnoDB tables (instead of the standard MyISAM tables). InnoDB tables suppot row-level locking and are recommended for high-volume databases.</para> |
1443 | </answer> | 1450 | </answer> |
1444 | <answer> | 1451 | <answer> |
1445 | <para>If after understanding these problems you still wish to enable delayed inserts, section [sub:DelayedIns] discusses how.</para> | 1452 | <para>If after understanding these problems you still wish to enable delayed inserts, section <link linkend="DelayedInsert"></link> discusses how.</para> |
1446 | </answer> | 1453 | </answer> |
1447 | </qandaentry> | 1454 | </qandaentry> |
1448 | </qandadiv> | 1455 | </qandadiv> |
@@ -1467,9 +1474,9 @@ rm -f /var/log/httpd/templog</programlisting> | |||
1467 | <para>See? Easy.</para> | 1474 | <para>See? Easy.</para> |
1468 | </answer> | 1475 | </answer> |
1469 | </qandaentry> | 1476 | </qandaentry> |
1470 | <qandaentry> | 1477 | <qandaentry id="QnACookie"> |
1471 | <question> | 1478 | <question> |
1472 | <para><sec:cookie>How can I log mod_usertrack cookies?</para> | 1479 | <para>How can I log mod_usertrack cookies?</para> |
1473 | </question> | 1480 | </question> |
1474 | <answer> | 1481 | <answer> |
1475 | <para>A number of people like to log mod_usertrack cookies in their Apache TransferLog to aid in understanding their visitors' clickstreams. This is accomplished, for example, with a statement as follows:</para> | 1482 | <para>A number of people like to log mod_usertrack cookies in their Apache TransferLog to aid in understanding their visitors' clickstreams. This is accomplished, for example, with a statement as follows:</para> |
@@ -1525,8 +1532,8 @@ rm -f /var/log/httpd/templog</programlisting> | |||
1525 | </question> | 1532 | </question> |
1526 | <answer> | 1533 | <answer> |
1527 | <para>As of version 1.17, you have a choice in how you want cookie logging handled.</para> | 1534 | <para>As of version 1.17, you have a choice in how you want cookie logging handled.</para> |
1528 | <para>If you are interested in logging only one cookie per request, follow the instructions in section [sec:cookie] above. That cookie will be logged to a column in the regular access_log table, and the actual cookie you want to log is specified with LogSQLWhichCookie. Don't forget to specify the 'c' character in LogSQLTransferLogFormat.</para> | 1535 | <para>If you are interested in logging only one cookie per request, follow the instructions in section <link endterm="QnACookie" linkend="QnACookie"></link> above. That cookie will be logged to a column in the regular access_log table, and the actual cookie you want to log is specified with LogSQLWhichCookie. Don't forget to specify the 'c' character in LogSQLTransferLogFormat.</para> |
1529 | <para>If, however, you need to log multiple cookies per request, you must employ the LogSQLWhichCookies (note the plural) directive. The cookies you specify will be logged to a separate table (as discussed in section [secMulTable]), and entries in that table will be linked to the regular access_log entries via the unique ID that is supplied by mod_unique_id. Without mod_unique_id the information will still be logged but you will be unable to correlate which cookies go with which access-requests. Furthermore, with LogSQLWhichCookies, you do not need to include the 'c' character in LogSQLTransferLogFormat.</para> | 1536 | <para>If, however, you need to log multiple cookies per request, you must employ the LogSQLWhichCookies (note the plural) directive. The cookies you specify will be logged to a separate table (as discussed in section <link endterm="MultiTable.title" linkend="MultiTable"></link>), and entries in that table will be linked to the regular access_log entries via the unique ID that is supplied by mod_unique_id. Without mod_unique_id the information will still be logged but you will be unable to correlate which cookies go with which access-requests. Furthermore, with LogSQLWhichCookies, you do not need to include the 'c' character in LogSQLTransferLogFormat.</para> |
1530 | <para>LogSQLWhichCookie and LogSQLWhichCookies can coexist without conflict because they operate on entireley different tables, but you're better off choosing the one you need.</para> | 1537 | <para>LogSQLWhichCookie and LogSQLWhichCookies can coexist without conflict because they operate on entireley different tables, but you're better off choosing the one you need.</para> |
1531 | </answer> | 1538 | </answer> |
1532 | </qandaentry> | 1539 | </qandaentry> |
@@ -1549,7 +1556,7 @@ mysql> alter table access_log add column ssl_maxkeysize smallint unsigned;</s | |||
1549 | LogSQLTransferLogFormat AbHhmRSsTUuvcQqz | 1556 | LogSQLTransferLogFormat AbHhmRSsTUuvcQqz |
1550 | </VirtualHost></programlisting> | 1557 | </VirtualHost></programlisting> |
1551 | <para>You also need to make sure you have the mod_log_sql_ssl module loaded as well.</para> | 1558 | <para>You also need to make sure you have the mod_log_sql_ssl module loaded as well.</para> |
1552 | <para>The last three characters (Qqz) in the directive are the SSL ones; see section [sub:Frmat] in the directives documentation for details of the LogSQLTransferLogFormat directive.</para> | 1559 | <para>The last three characters (Qqz) in the directive are the SSL ones; see section <link linkend="TLogFormat"></link> in the directives documentation for details of the LogSQLTransferLogFormat directive.</para> |
1553 | <para>Restart Apache, then perform some hits on your server. Then run the following select statement:</para> | 1560 | <para>Restart Apache, then perform some hits on your server. Then run the following select statement:</para> |
1554 | <screen>mysql> select remote_host,request_uri,ssl_cipher,ssl_keysize,ssl_maxkeysize from access_log where ssl_cipher is not null;</screen> | 1561 | <screen>mysql> select remote_host,request_uri,ssl_cipher,ssl_keysize,ssl_maxkeysize from access_log where ssl_cipher is not null;</screen> |
1555 | <table> | 1562 | <table> |