PageRenderTime 22ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/cherokee-1.2.101/doc/modules_loggers_custom.html

#
HTML | 202 lines | 202 code | 0 blank | 0 comment | 0 complexity | fa477eb5ffb4b773d7e594a4de873ecb MD5 | raw file
Possible License(s): GPL-2.0, BSD-3-Clause
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  4. <head>
  5. <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
  6. <meta http-equiv="Content-Language" content="en-us" />
  7. <meta name="ROBOTS" content="ALL" />
  8. <meta http-equiv="imagetoolbar" content="no" />
  9. <meta name="MSSmartTagsPreventParsing" content="true" />
  10. <meta name="Keywords" content="cherokee web server httpd http" />
  11. <meta name="Description" content="Cherokee is a flexible, very fast, lightweight Web server. It is implemented entirely in C, and has no dependencies beyond a standard C library. It is embeddable and extensible with plug-ins. It supports on-the-fly configuration by reading files or strings, TLS/SSL (via GNUTLS or OpenSSL), virtual hosts, authentication, cache friendly features, PHP, custom error management, and much more." />
  12. <link href="media/css/cherokee_doc.css" rel="stylesheet" type="text/css" media="all" />
  13. </head>
  14. <body>
  15. <h2 id="_a_href_index_html_index_a_8594_a_href_modules_html_modules_a_8594_a_href_modules_loggers_html_loggers_a"><a href="index.html">Index</a> &#8594; <a href="modules.html">Modules</a> &#8594; <a href="modules_loggers.html">Loggers</a></h2>
  16. <div class="sectionbody">
  17. <h3 id="_logger_custom">Logger: Custom</h3><div style="clear:left"></div>
  18. <div class="paragraph"><p>This module implements a flexible mechanism for logging requests made
  19. to the server, using a user-specified format.</p></div>
  20. <div class="paragraph"><p>The format in which the request will be logged is defined by a string.
  21. This string is used to log each request to the log. It can contain
  22. both literal characters and a set of variables. All the literal
  23. characters will be copied to the log. The following variables will be
  24. evaluated right before writing each log entry:</p></div>
  25. <div class="tableblock">
  26. <table rules="all"
  27. width="100%"
  28. frame="border"
  29. cellspacing="0" cellpadding="4">
  30. <col width="10%" />
  31. <col width="40%" />
  32. <col width="50%" />
  33. <thead>
  34. <tr>
  35. <th align="left" valign="top">Variable </th>
  36. <th align="left" valign="top">Example </th>
  37. <th align="left" valign="top">Description</th>
  38. </tr>
  39. </thead>
  40. <tbody>
  41. <tr>
  42. <td align="left" valign="top"><p class="table"><tt>${ip_remote}</tt></p></td>
  43. <td align="left" valign="top"><p class="table">74.125.67.100</p></td>
  44. <td align="left" valign="top"><p class="table">Remote IP-address</p></td>
  45. </tr>
  46. <tr>
  47. <td align="left" valign="top"><p class="table"><tt>${ip_local}</tt></p></td>
  48. <td align="left" valign="top"><p class="table">10.0.0.1</p></td>
  49. <td align="left" valign="top"><p class="table">Local IP-address</p></td>
  50. </tr>
  51. <tr>
  52. <td align="left" valign="top"><p class="table"><tt>${port_server}</tt></p></td>
  53. <td align="left" valign="top"><p class="table">80</p></td>
  54. <td align="left" valign="top"><p class="table">Port of the server serving the request</p></td>
  55. </tr>
  56. <tr>
  57. <td align="left" valign="top"><p class="table"><tt>${protocol}</tt></p></td>
  58. <td align="left" valign="top"><p class="table">http</p></td>
  59. <td align="left" valign="top"><p class="table">Request Protocol</p></td>
  60. </tr>
  61. <tr>
  62. <td align="left" valign="top"><p class="table"><tt>${query_string}</tt></p></td>
  63. <td align="left" valign="top"><p class="table">?bar=foo</p></td>
  64. <td align="left" valign="top"><p class="table">The query string, if exists</p></td>
  65. </tr>
  66. <tr>
  67. <td align="left" valign="top"><p class="table"><tt>${request}</tt></p></td>
  68. <td align="left" valign="top"><p class="table">/file.txt</p></td>
  69. <td align="left" valign="top"><p class="table">URL path requested</p></td>
  70. </tr>
  71. <tr>
  72. <td align="left" valign="top"><p class="table"><tt>${request_first_line}</tt></p></td>
  73. <td align="left" valign="top"><p class="table">GET / HTTP/1.0</p></td>
  74. <td align="left" valign="top"><p class="table">First line of HTTP request</p></td>
  75. </tr>
  76. <tr>
  77. <td align="left" valign="top"><p class="table"><tt>${request_original}</tt></p></td>
  78. <td align="left" valign="top"><p class="table">/file.txt</p></td>
  79. <td align="left" valign="top"><p class="table">URL path requested before any rewrite</p></td>
  80. </tr>
  81. <tr>
  82. <td align="left" valign="top"><p class="table"><tt>${response_size}</tt></p></td>
  83. <td align="left" valign="top"><p class="table">1234</p></td>
  84. <td align="left" valign="top"><p class="table">Size of the response in bytes</p></td>
  85. </tr>
  86. <tr>
  87. <td align="left" valign="top"><p class="table"><tt>${status}</tt></p></td>
  88. <td align="left" valign="top"><p class="table">200</p></td>
  89. <td align="left" valign="top"><p class="table">Response status code</p></td>
  90. </tr>
  91. <tr>
  92. <td align="left" valign="top"><p class="table"><tt>${now}</tt></p></td>
  93. <td align="left" valign="top"><p class="table">08/Apr/2009:12:02:11 +0200</p></td>
  94. <td align="left" valign="top"><p class="table">Time: in common log format time format</p></td>
  95. </tr>
  96. <tr>
  97. <td align="left" valign="top"><p class="table"><tt>${time_secs}</tt></p></td>
  98. <td align="left" valign="top"><p class="table">1239185281</p></td>
  99. <td align="left" valign="top"><p class="table">Time: seconds since Epoch</p></td>
  100. </tr>
  101. <tr>
  102. <td align="left" valign="top"><p class="table"><tt>${time_msecs}</tt></p></td>
  103. <td align="left" valign="top"><p class="table">18446744071655350332</p></td>
  104. <td align="left" valign="top"><p class="table">Time: milliseconds since Epoch</p></td>
  105. </tr>
  106. <tr>
  107. <td align="left" valign="top"><p class="table"><tt>${transport}</tt></p></td>
  108. <td align="left" valign="top"><p class="table">https</p></td>
  109. <td align="left" valign="top"><p class="table">Transport type: <tt>http</tt> or <tt>https</tt></p></td>
  110. </tr>
  111. <tr>
  112. <td align="left" valign="top"><p class="table"><tt>${user_remote}</tt></p></td>
  113. <td align="left" valign="top"><p class="table">guest</p></td>
  114. <td align="left" valign="top"><p class="table">Remote user (authentication)</p></td>
  115. </tr>
  116. <tr>
  117. <td align="left" valign="top"><p class="table"><tt>${vserver_name}</tt></p></td>
  118. <td align="left" valign="top"><p class="table">default</p></td>
  119. <td align="left" valign="top"><p class="table">Virtual Server nick name</p></td>
  120. </tr>
  121. <tr>
  122. <td align="left" valign="top"><p class="table"><tt>${vserver_name_req}</tt></p></td>
  123. <td align="left" valign="top"><p class="table">example.com</p></td>
  124. <td align="left" valign="top"><p class="table">Requested host (Host: header), or vserver nickname if absent</p></td>
  125. </tr>
  126. <tr>
  127. <td align="left" valign="top"><p class="table"><tt>${http_host}</tt></p></td>
  128. <td align="left" valign="top"><p class="table">example.com</p></td>
  129. <td align="left" valign="top"><p class="table">"Host:" header of the request</p></td>
  130. </tr>
  131. <tr>
  132. <td align="left" valign="top"><p class="table"><tt>${http_referrer}</tt></p></td>
  133. <td align="left" valign="top"><p class="table">example.com/page</p></td>
  134. <td align="left" valign="top"><p class="table">"Referrer:" header of the request</p></td>
  135. </tr>
  136. <tr>
  137. <td align="left" valign="top"><p class="table"><tt>${http_user_agent}</tt></p></td>
  138. <td align="left" valign="top"><p class="table">Mozilla/1.0.0</p></td>
  139. <td align="left" valign="top"><p class="table">"User-Agent:" header of the request</p></td>
  140. </tr>
  141. <tr>
  142. <td align="left" valign="top"><p class="table"><tt>${http_cokkie}</tt></p></td>
  143. <td align="left" valign="top"><p class="table">key=val</p></td>
  144. <td align="left" valign="top"><p class="table">"Cookie:" header of the request</p></td>
  145. </tr>
  146. </tbody>
  147. </table>
  148. </div>
  149. <div class="paragraph"><p>The templating subsystem provides slicing support in pretty much the
  150. same way that the Python strings do, allowing to use specific portions
  151. of any of these substitution macros. You can read more about this on
  152. the <a href="other_goodies.html#templating">Template Subsystem</a> section of
  153. the documentation.</p></div>
  154. <h3 id="examples">Example</h3><div style="clear:left"></div>
  155. <div class="paragraph"><p>For instance, the following format string:</p></div>
  156. <div class="listingblock">
  157. <div class="content">
  158. <pre><tt>[${now}] ${ip_remote}: ${request} (${status})</tt></pre>
  159. </div></div>
  160. <div class="paragraph"><p>would generate this entry in the log:</p></div>
  161. <div class="listingblock">
  162. <div class="content">
  163. <pre><tt>[08/Apr/2009:12:02:11 +0200] 74.125.67.100: /file.txt (200)</tt></pre>
  164. </div></div>
  165. <h3 id="_apache_8217_s_comined_format">Apache&#8217;s comined format</h3><div style="clear:left"></div>
  166. <div class="paragraph"><p>The following formats are all like Apache&#8217;s combined format, except the second field not being the client ident but the (way more interesting) HTTP host or vserver name.</p></div>
  167. <div class="ulist"><ul>
  168. <li>
  169. <p>
  170. Virtual server name
  171. </p>
  172. <div class="listingblock">
  173. <div class="content">
  174. <pre><tt>${ip_remote} ${vserver_name} ${user_remote} [${now}] "${request_first_line}" ${status} ${response_size} "${http_referrer}" "${http_user_agent}"</tt></pre>
  175. </div></div>
  176. </li>
  177. <li>
  178. <p>
  179. Host
  180. </p>
  181. <div class="listingblock">
  182. <div class="content">
  183. <pre><tt>${ip_remote} ${http_host} ${user_remote} [${now}] "${request_first_line}" ${status} ${response_size} "${http_referrer}" "${http_user_agent}"</tt></pre>
  184. </div></div>
  185. </li>
  186. <li>
  187. <p>
  188. Host if present, otherwise virtual serven name
  189. </p>
  190. <div class="listingblock">
  191. <div class="content">
  192. <pre><tt>${ip_remote} ${vserver_name_req} ${user_remote} [${now}] "${request_first_line}" ${status} ${response_size} "${http_referrer}" "${http_user_agent}"</tt></pre>
  193. </div></div>
  194. </li>
  195. </ul></div>
  196. </div>
  197. <div id="footer">
  198. <div id="footer-text">
  199. </div>
  200. </div>
  201. </body>
  202. </html>