summaryrefslogtreecommitdiffstats
path: root/docs/node2.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/node2.html')
-rw-r--r--docs/node2.html276
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)
4original 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 &nbsp; <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">
751 Introduction</A>
76</H1>
77
78<P>
79
80<H2><A NAME="SECTION00021000000000000000">
811.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">
941.2 Summary</A>
95</H2>
96
97<P>
98This Apache module will permit you to log to a SQL database; it can
99log each access request as well as data associated with each request:
100cookies, notes, and inbound/outbound headers. Unlike logging to a
101flat text file - which is standard in Apache - a SQL-based log exhibits
102tremendous 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
104advantages to SQL.)
105
106<P>
107This module can either replace or happily coexist with mod_log_config,
108Apache's text file logging facility. In addition to being more configurable
109than the standard module, mod_log_sql is much more flexible.
110
111<P>
112
113<H2><A NAME="SECTION00023000000000000000">
1141.3 Approach</A>
115</H2>
116
117<P>
118This project was formerly known as ``mod_log_mysql.'' It was
119renamed ``mod_log_sql'' in order to reflect the project goal
120of database-inspecificity. The module currently supports MySQL, but
121support for other database backends is underway.
122
123<P>
124In order to save speed and overhead, links are kept alive in between
125queries. This module uses one dedicated SQL link per httpd child,
126opened by each child process when it is born. Among other things,
127this means that this module supports logging into only one MySQL server,
128and for now, also, only one SQL database. But that's a small tradeoff
129compared to the blinding speed of this module. Error reporting is
130robust throughout the module and will inform the administrator of
131database issues in the Apache E<SMALL>RROR</SMALL>L<SMALL>OG</SMALL> for the server/virtual
132server.
133
134<P>
135Virtual hosts are supported in the same manner they are in the regular
136logging modules. The administrator defines some basic 'global' directives
137in the main server config, then defines more specific 'local' directives
138inside each VirtualHost stanza.
139
140<P>
141A robust &#34;preserve&#34; capability has now been implemented.
142This permits the module to preserve any failed INSERT commands to
143a local file on its machine. In any situation that the database is
144unavailable - 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
146its log entries to the preserve file (which is created with the user
147&amp; group ID of the running Apache process, e.g. &#34;nobody/nobody&#34;
148on many Linux installations). When database availablity returns, mod_log_sql
149seamlessly resumes logging to it. When convenient for the sysadmin,
150he/she can easily import the preserve file into the database because
151it is simply a series of SQL insert statements.
152
153<P>
154
155<H2><A NAME="SECTION00024000000000000000">
1561.4 What gets logged by default? </A>
157</H2>
158
159<P>
160All the data that would be contained in the &#34;Combined Log
161Format&#34; is logged by default, plus a little extra. Your best
162bet is to begin by accepting this default, then later customize the
163log configuration based on your needs.
164
165<P>
166The documentation of the run-time directives includes a full explanation
167of 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">
1721.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
179apply to the 'virtual host config'. This is made clear in the directive
180documentation.
181</LI>
182<LI>The 'time_stamp' field is stored in an UNSIGNED INTEGER column, in
183the standard unix ``seconds since the epoch'' format. This is
184superior to storing the access time as a string due to size requirements:
185an UNSIGNED INT requires 4 bytes, whereas an Apache date string -
186e.g. &#34;18/Nov/2001:13:59:52 -0800&#34; - requires 26
187bytes: those extra 22 bytes become significant when multiplied by
188thousands of accesses on a busy server. Besides, an INT type is far
189more flexible for comparisons, etc.
190
191<P>
192In MySQL 3.21 and above you can easily convert this to a human readable
193format using from_unixtime(), e.g.:
194
195<P>
196
197<DL COMPACT>
198<DT>
199<DD>select&nbsp;remote_host,request_uri,from_unixtime(time_stamp)&nbsp;from&nbsp;access_log;
200</DD>
201</DL>The enclosed perl program ``make_combined_log.pl'' extracts
202your access log in a format that is completely compatible with the
203Combined Log Format. You can then feed this to your favorite web log
204analysis tool.
205
206<P>
207</LI>
208<LI>The table's string values can be CHAR or VARCHAR, at a length of your
209choice. VARCHAR is superior because it truncates long strings; CHAR
210types are fixed-length and will be padded with spaces, resulting in
211waste. Just like the time_stamp issue described above, that kind
212of 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
215is marked NOT NULL then it must contain data in the INSERT statement,
216or the INSERT will fail. These mysterious failures can be quite frustrating
217and 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
222field, such fields are assigned the value 0 instead of '-' which,
223of course, makes perfect sense anyway.
224</LI>
225</UL>
226
227<P>
228
229<H2><A NAME="SECTION00026000000000000000">
2301.6 Author / Maintainer</A>
231</H2>
232
233<P>
234The actual logging code was taken from the already existing flat file
235text modules, so all that credit goes to the Apache Server group.
236
237<P>
238The MySQL routines and directives were added by Zeev Suraski &lt;bourbon@netvision.net.il&gt;.
239
240<P>
241All changes from 1.06+ and the new documentation were added by Chris
242Powell &lt;chris@grubbybaby.com&gt;. It seems that the module had fallen
243into the &#34;unmaintained&#34; category - it hadn't been
244updated 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 &nbsp; <B> <A NAME="tex2html133"
269 HREF="node1.html">Contents</A></B>
270<!--End of Navigation Panel-->
271<ADDRESS>
272Chris Powell
2732002-12-18
274</ADDRESS>
275</BODY>
276</HTML>