diff options
Diffstat (limited to 'docs/node2.html')
| -rw-r--r-- | docs/node2.html | 276 |
1 files changed, 276 insertions, 0 deletions
diff --git a/docs/node2.html b/docs/node2.html new file mode 100644 index 0000000..33a2849 --- /dev/null +++ b/docs/node2.html | |||
| @@ -0,0 +1,276 @@ | |||
| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> | ||
| 2 | |||
| 3 | <!--Converted with LaTeX2HTML 2002-1 (1.68) | ||
| 4 | original version by: Nikos Drakos, CBLU, University of Leeds | ||
| 5 | * revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan | ||
| 6 | * with significant contributions from: | ||
| 7 | Jens Lippmann, Marek Rouchal, Martin Wilck and others --> | ||
| 8 | <HTML> | ||
| 9 | <HEAD> | ||
| 10 | <TITLE>1 Introduction</TITLE> | ||
| 11 | <META NAME="description" CONTENT="1 Introduction"> | ||
| 12 | <META NAME="keywords" CONTENT="documentation"> | ||
| 13 | <META NAME="resource-type" CONTENT="document"> | ||
| 14 | <META NAME="distribution" CONTENT="global"> | ||
| 15 | |||
| 16 | <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> | ||
| 17 | <META NAME="Generator" CONTENT="LaTeX2HTML v2002-1"> | ||
| 18 | <META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"> | ||
| 19 | |||
| 20 | <LINK REL="STYLESHEET" HREF="documentation.css"> | ||
| 21 | |||
| 22 | <LINK REL="next" HREF="node3.html"> | ||
| 23 | <LINK REL="previous" HREF="node1.html"> | ||
| 24 | <LINK REL="up" HREF="documentation.html"> | ||
| 25 | <LINK REL="next" HREF="node3.html"> | ||
| 26 | </HEAD> | ||
| 27 | |||
| 28 | <BODY > | ||
| 29 | <!--Navigation Panel--> | ||
| 30 | <A NAME="tex2html134" | ||
| 31 | HREF="node3.html"> | ||
| 32 | <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> | ||
| 33 | <A NAME="tex2html130" | ||
| 34 | HREF="documentation.html"> | ||
| 35 | <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> | ||
| 36 | <A NAME="tex2html124" | ||
| 37 | HREF="node1.html"> | ||
| 38 | <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> | ||
| 39 | <A NAME="tex2html132" | ||
| 40 | HREF="node1.html"> | ||
| 41 | <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> | ||
| 42 | <BR> | ||
| 43 | <B> Next:</B> <A NAME="tex2html135" | ||
| 44 | HREF="node3.html">2 Installation</A> | ||
| 45 | <B> Up:</B> <A NAME="tex2html131" | ||
| 46 | HREF="documentation.html">Installing and Running mod_log_sql</A> | ||
| 47 | <B> Previous:</B> <A NAME="tex2html125" | ||
| 48 | HREF="node1.html">Contents</A> | ||
| 49 | <B> <A NAME="tex2html133" | ||
| 50 | HREF="node1.html">Contents</A></B> | ||
| 51 | <BR> | ||
| 52 | <BR> | ||
| 53 | <!--End of Navigation Panel--> | ||
| 54 | <!--Table of Child-Links--> | ||
| 55 | <A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A> | ||
| 56 | |||
| 57 | <UL> | ||
| 58 | <LI><A NAME="tex2html136" | ||
| 59 | HREF="node2.html#SECTION00021000000000000000">1.1 Homepage </A> | ||
| 60 | <LI><A NAME="tex2html137" | ||
| 61 | HREF="node2.html#SECTION00022000000000000000">1.2 Summary</A> | ||
| 62 | <LI><A NAME="tex2html138" | ||
| 63 | HREF="node2.html#SECTION00023000000000000000">1.3 Approach</A> | ||
| 64 | <LI><A NAME="tex2html139" | ||
| 65 | HREF="node2.html#SECTION00024000000000000000">1.4 What gets logged by default? </A> | ||
| 66 | <LI><A NAME="tex2html140" | ||
| 67 | HREF="node2.html#SECTION00025000000000000000">1.5 Miscellaneous Notes</A> | ||
| 68 | <LI><A NAME="tex2html141" | ||
| 69 | HREF="node2.html#SECTION00026000000000000000">1.6 Author / Maintainer</A> | ||
| 70 | </UL> | ||
| 71 | <!--End of Table of Child-Links--> | ||
| 72 | <HR> | ||
| 73 | |||
| 74 | <H1><A NAME="SECTION00020000000000000000"> | ||
| 75 | 1 Introduction</A> | ||
| 76 | </H1> | ||
| 77 | |||
| 78 | <P> | ||
| 79 | |||
| 80 | <H2><A NAME="SECTION00021000000000000000"> | ||
| 81 | 1.1 Homepage </A> | ||
| 82 | </H2> | ||
| 83 | |||
| 84 | <P> | ||
| 85 | |||
| 86 | <DL COMPACT> | ||
| 87 | <DT> | ||
| 88 | <DD>http://www.grubbybaby.com/mod_log_sql/ | ||
| 89 | </DD> | ||
| 90 | </DL> | ||
| 91 | <P> | ||
| 92 | |||
| 93 | <H2><A NAME="SECTION00022000000000000000"> | ||
| 94 | 1.2 Summary</A> | ||
| 95 | </H2> | ||
| 96 | |||
| 97 | <P> | ||
| 98 | This Apache module will permit you to log to a SQL database; it can | ||
| 99 | log each access request as well as data associated with each request: | ||
| 100 | cookies, notes, and inbound/outbound headers. Unlike logging to a | ||
| 101 | flat text file - which is standard in Apache - a SQL-based log exhibits | ||
| 102 | tremendous flexibility and power of data extraction. (See section | ||
| 103 | <A HREF="node5.html#sub:why">4.1.1</A> in the FAQ for further discussion and examples of the | ||
| 104 | advantages to SQL.) | ||
| 105 | |||
| 106 | <P> | ||
| 107 | This module can either replace or happily coexist with mod_log_config, | ||
| 108 | Apache's text file logging facility. In addition to being more configurable | ||
| 109 | than the standard module, mod_log_sql is much more flexible. | ||
| 110 | |||
| 111 | <P> | ||
| 112 | |||
| 113 | <H2><A NAME="SECTION00023000000000000000"> | ||
| 114 | 1.3 Approach</A> | ||
| 115 | </H2> | ||
| 116 | |||
| 117 | <P> | ||
| 118 | This project was formerly known as ``mod_log_mysql.'' It was | ||
| 119 | renamed ``mod_log_sql'' in order to reflect the project goal | ||
| 120 | of database-inspecificity. The module currently supports MySQL, but | ||
| 121 | support for other database backends is underway. | ||
| 122 | |||
| 123 | <P> | ||
| 124 | In order to save speed and overhead, links are kept alive in between | ||
| 125 | queries. This module uses one dedicated SQL link per httpd child, | ||
| 126 | opened by each child process when it is born. Among other things, | ||
| 127 | this means that this module supports logging into only one MySQL server, | ||
| 128 | and for now, also, only one SQL database. But that's a small tradeoff | ||
| 129 | compared to the blinding speed of this module. Error reporting is | ||
| 130 | robust throughout the module and will inform the administrator of | ||
| 131 | database issues in the Apache E<SMALL>RROR</SMALL>L<SMALL>OG</SMALL> for the server/virtual | ||
| 132 | server. | ||
| 133 | |||
| 134 | <P> | ||
| 135 | Virtual hosts are supported in the same manner they are in the regular | ||
| 136 | logging modules. The administrator defines some basic 'global' directives | ||
| 137 | in the main server config, then defines more specific 'local' directives | ||
| 138 | inside each VirtualHost stanza. | ||
| 139 | |||
| 140 | <P> | ||
| 141 | A robust "preserve" capability has now been implemented. | ||
| 142 | This permits the module to preserve any failed INSERT commands to | ||
| 143 | a local file on its machine. In any situation that the database is | ||
| 144 | unavailable - e.g. the network fails or the database host is rebooted | ||
| 145 | - mod_log_sql will note this in the error log and begin appending | ||
| 146 | its log entries to the preserve file (which is created with the user | ||
| 147 | & group ID of the running Apache process, e.g. "nobody/nobody" | ||
| 148 | on many Linux installations). When database availablity returns, mod_log_sql | ||
| 149 | seamlessly resumes logging to it. When convenient for the sysadmin, | ||
| 150 | he/she can easily import the preserve file into the database because | ||
| 151 | it is simply a series of SQL insert statements. | ||
| 152 | |||
| 153 | <P> | ||
| 154 | |||
| 155 | <H2><A NAME="SECTION00024000000000000000"> | ||
| 156 | 1.4 What gets logged by default? </A> | ||
| 157 | </H2> | ||
| 158 | |||
| 159 | <P> | ||
| 160 | All the data that would be contained in the "Combined Log | ||
| 161 | Format" is logged by default, plus a little extra. Your best | ||
| 162 | bet is to begin by accepting this default, then later customize the | ||
| 163 | log configuration based on your needs. | ||
| 164 | |||
| 165 | <P> | ||
| 166 | The documentation of the run-time directives includes a full explanation | ||
| 167 | of what you can log, including examples - see section <A HREF="node4.html#sec:ConfRef">3.6</A>. | ||
| 168 | |||
| 169 | <P> | ||
| 170 | |||
| 171 | <H2><A NAME="SECTION00025000000000000000"> | ||
| 172 | 1.5 Miscellaneous Notes</A> | ||
| 173 | </H2> | ||
| 174 | |||
| 175 | <P> | ||
| 176 | |||
| 177 | <UL> | ||
| 178 | <LI>Note which directives go in the 'main server config' and which directives | ||
| 179 | apply to the 'virtual host config'. This is made clear in the directive | ||
| 180 | documentation. | ||
| 181 | </LI> | ||
| 182 | <LI>The 'time_stamp' field is stored in an UNSIGNED INTEGER column, in | ||
| 183 | the standard unix ``seconds since the epoch'' format. This is | ||
| 184 | superior to storing the access time as a string due to size requirements: | ||
| 185 | an UNSIGNED INT requires 4 bytes, whereas an Apache date string - | ||
| 186 | e.g. "18/Nov/2001:13:59:52 -0800" - requires 26 | ||
| 187 | bytes: those extra 22 bytes become significant when multiplied by | ||
| 188 | thousands of accesses on a busy server. Besides, an INT type is far | ||
| 189 | more flexible for comparisons, etc. | ||
| 190 | |||
| 191 | <P> | ||
| 192 | In MySQL 3.21 and above you can easily convert this to a human readable | ||
| 193 | format using from_unixtime(), e.g.: | ||
| 194 | |||
| 195 | <P> | ||
| 196 | |||
| 197 | <DL COMPACT> | ||
| 198 | <DT> | ||
| 199 | <DD>select remote_host,request_uri,from_unixtime(time_stamp) from access_log; | ||
| 200 | </DD> | ||
| 201 | </DL>The enclosed perl program ``make_combined_log.pl'' extracts | ||
| 202 | your access log in a format that is completely compatible with the | ||
| 203 | Combined Log Format. You can then feed this to your favorite web log | ||
| 204 | analysis tool. | ||
| 205 | |||
| 206 | <P> | ||
| 207 | </LI> | ||
| 208 | <LI>The table's string values can be CHAR or VARCHAR, at a length of your | ||
| 209 | choice. VARCHAR is superior because it truncates long strings; CHAR | ||
| 210 | types are fixed-length and will be padded with spaces, resulting in | ||
| 211 | waste. Just like the time_stamp issue described above, that kind | ||
| 212 | of space waste multiplies over thousands of records. | ||
| 213 | </LI> | ||
| 214 | <LI>Be careful not to go overboard setting fields to NOT NULL. If a field | ||
| 215 | is marked NOT NULL then it must contain data in the INSERT statement, | ||
| 216 | or the INSERT will fail. These mysterious failures can be quite frustrating | ||
| 217 | and difficult to debug. | ||
| 218 | </LI> | ||
| 219 | <LI>When Apache logs a numeric field, it uses a '-' character to mean | ||
| 220 | ``not applicable,'' e.g. the number of bytes returned on a 304 | ||
| 221 | (unchanged) request. Since '-' is an illegal character in an SQL numeric | ||
| 222 | field, such fields are assigned the value 0 instead of '-' which, | ||
| 223 | of course, makes perfect sense anyway. | ||
| 224 | </LI> | ||
| 225 | </UL> | ||
| 226 | |||
| 227 | <P> | ||
| 228 | |||
| 229 | <H2><A NAME="SECTION00026000000000000000"> | ||
| 230 | 1.6 Author / Maintainer</A> | ||
| 231 | </H2> | ||
| 232 | |||
| 233 | <P> | ||
| 234 | The actual logging code was taken from the already existing flat file | ||
| 235 | text modules, so all that credit goes to the Apache Server group. | ||
| 236 | |||
| 237 | <P> | ||
| 238 | The MySQL routines and directives were added by Zeev Suraski <bourbon@netvision.net.il>. | ||
| 239 | |||
| 240 | <P> | ||
| 241 | All changes from 1.06+ and the new documentation were added by Chris | ||
| 242 | Powell <chris@grubbybaby.com>. It seems that the module had fallen | ||
| 243 | into the "unmaintained" category - it hadn't been | ||
| 244 | updated since 1998 - so Chris adopted it as the new maintainer. | ||
| 245 | |||
| 246 | <P> | ||
| 247 | <HR> | ||
| 248 | <!--Navigation Panel--> | ||
| 249 | <A NAME="tex2html134" | ||
| 250 | HREF="node3.html"> | ||
| 251 | <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> | ||
| 252 | <A NAME="tex2html130" | ||
| 253 | HREF="documentation.html"> | ||
| 254 | <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> | ||
| 255 | <A NAME="tex2html124" | ||
| 256 | HREF="node1.html"> | ||
| 257 | <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> | ||
| 258 | <A NAME="tex2html132" | ||
| 259 | HREF="node1.html"> | ||
| 260 | <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> | ||
| 261 | <BR> | ||
| 262 | <B> Next:</B> <A NAME="tex2html135" | ||
| 263 | HREF="node3.html">2 Installation</A> | ||
| 264 | <B> Up:</B> <A NAME="tex2html131" | ||
| 265 | HREF="documentation.html">Installing and Running mod_log_sql</A> | ||
| 266 | <B> Previous:</B> <A NAME="tex2html125" | ||
| 267 | HREF="node1.html">Contents</A> | ||
| 268 | <B> <A NAME="tex2html133" | ||
| 269 | HREF="node1.html">Contents</A></B> | ||
| 270 | <!--End of Navigation Panel--> | ||
| 271 | <ADDRESS> | ||
| 272 | Chris Powell | ||
| 273 | 2002-12-18 | ||
| 274 | </ADDRESS> | ||
| 275 | </BODY> | ||
| 276 | </HTML> | ||
