diff options
Diffstat (limited to '')
-rw-r--r-- | docs/manual/logs.html | 21 | ||||
-rw-r--r-- | docs/manual/logs.html.en | 713 | ||||
-rw-r--r-- | docs/manual/logs.html.fr.utf8 | 763 | ||||
-rw-r--r-- | docs/manual/logs.html.ja.utf8 | 604 | ||||
-rw-r--r-- | docs/manual/logs.html.ko.euc-kr | 550 | ||||
-rw-r--r-- | docs/manual/logs.html.tr.utf8 | 685 |
6 files changed, 3336 insertions, 0 deletions
diff --git a/docs/manual/logs.html b/docs/manual/logs.html new file mode 100644 index 0000000..931829a --- /dev/null +++ b/docs/manual/logs.html @@ -0,0 +1,21 @@ +# GENERATED FROM XML -- DO NOT EDIT + +URI: logs.html.en +Content-Language: en +Content-type: text/html; charset=ISO-8859-1 + +URI: logs.html.fr.utf8 +Content-Language: fr +Content-type: text/html; charset=UTF-8 + +URI: logs.html.ja.utf8 +Content-Language: ja +Content-type: text/html; charset=UTF-8 + +URI: logs.html.ko.euc-kr +Content-Language: ko +Content-type: text/html; charset=EUC-KR + +URI: logs.html.tr.utf8 +Content-Language: tr +Content-type: text/html; charset=UTF-8 diff --git a/docs/manual/logs.html.en b/docs/manual/logs.html.en new file mode 100644 index 0000000..4eafe18 --- /dev/null +++ b/docs/manual/logs.html.en @@ -0,0 +1,713 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head> +<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type" /> +<!-- + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + This file is generated from xml source: DO NOT EDIT + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + --> +<title>Log Files - Apache HTTP Server Version 2.4</title> +<link href="./style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" /> +<link href="./style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" /> +<link href="./style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="./style/css/prettify.css" /> +<script src="./style/scripts/prettify.min.js" type="text/javascript"> +</script> + +<link href="./images/favicon.ico" rel="shortcut icon" /></head> +<body id="manual-page"><div id="page-header"> +<p class="menu"><a href="./mod/">Modules</a> | <a href="./mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="./glossary.html">Glossary</a> | <a href="./sitemap.html">Sitemap</a></p> +<p class="apache">Apache HTTP Server Version 2.4</p> +<img alt="" src="./images/feather.png" /></div> +<div class="up"><a href="./"><img title="<-" alt="<-" src="./images/left.gif" /></a></div> +<div id="path"> +<a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="./">Version 2.4</a></div><div id="page-content"><div id="preamble"><h1>Log Files</h1> +<div class="toplang"> +<p><span>Available Languages: </span><a href="./en/logs.html" title="English"> en </a> | +<a href="./fr/logs.html" hreflang="fr" rel="alternate" title="Franais"> fr </a> | +<a href="./ja/logs.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> | +<a href="./ko/logs.html" hreflang="ko" rel="alternate" title="Korean"> ko </a> | +<a href="./tr/logs.html" hreflang="tr" rel="alternate" title="Trke"> tr </a></p> +</div> + + <p>In order to effectively manage a web server, it is necessary + to get feedback about the activity and performance of the + server as well as any problems that may be occurring. The Apache HTTP Server + provides very comprehensive and flexible logging + capabilities. This document describes how to configure its + logging capabilities, and how to understand what the logs + contain.</p> + </div> +<div id="quickview"><a href="https://www.apache.org/foundation/contributing.html" class="badge"><img src="https://www.apache.org/images/SupportApache-small.png" alt="Support Apache!" /></a><ul id="toc"><li><img alt="" src="./images/down.gif" /> <a href="#overview">Overview</a></li> +<li><img alt="" src="./images/down.gif" /> <a href="#security">Security Warning</a></li> +<li><img alt="" src="./images/down.gif" /> <a href="#errorlog">Error Log</a></li> +<li><img alt="" src="./images/down.gif" /> <a href="#permodule">Per-module logging</a></li> +<li><img alt="" src="./images/down.gif" /> <a href="#accesslog">Access Log</a></li> +<li><img alt="" src="./images/down.gif" /> <a href="#rotation">Log Rotation</a></li> +<li><img alt="" src="./images/down.gif" /> <a href="#piped">Piped Logs</a></li> +<li><img alt="" src="./images/down.gif" /> <a href="#virtualhost">Virtual Hosts</a></li> +<li><img alt="" src="./images/down.gif" /> <a href="#other">Other Log Files</a></li> +</ul><h3>See also</h3><ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div> +<div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="overview" id="overview">Overview</a></h2> + + + <table class="related"><tr><th>Related Modules</th><th>Related Directives</th></tr><tr><td><ul><li><code class="module"><a href="./mod/mod_log_config.html">mod_log_config</a></code></li><li><code class="module"><a href="./mod/mod_log_forensic.html">mod_log_forensic</a></code></li><li><code class="module"><a href="./mod/mod_logio.html">mod_logio</a></code></li><li><code class="module"><a href="./mod/mod_cgi.html">mod_cgi</a></code></li></ul></td><td /></tr></table> + + <p> + The Apache HTTP Server provides a variety of different mechanisms for + logging everything that happens on your server, from the initial + request, through the URL mapping process, to the final resolution of + the connection, including any errors that may have occurred in the + process. In addition to this, third-party modules may provide logging + capabilities, or inject entries into the existing log files, and + applications such as CGI programs, or PHP scripts, or other handlers, + may send messages to the server error log. + </p> + + <p> + In this document we discuss the logging modules that are a standard + part of the http server. + </p> + + </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="security" id="security">Security Warning</a></h2> + + + <p>Anyone who can write to the directory where Apache httpd is + writing a log file can almost certainly gain access to the uid + that the server is started as, which is normally root. Do + <em>NOT</em> give people write access to the directory the logs + are stored in without being aware of the consequences; see the + <a href="misc/security_tips.html">security tips</a> document + for details.</p> + + <p>In addition, log files may contain information supplied + directly by the client, without escaping. Therefore, it is + possible for malicious clients to insert control-characters in + the log files, so care must be taken in dealing with raw + logs.</p> + </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="errorlog" id="errorlog">Error Log</a></h2> + + + <table class="related"><tr><th>Related Modules</th><th>Related Directives</th></tr><tr><td><ul><li><code class="module"><a href="./mod/core.html">core</a></code></li></ul></td><td><ul><li><code class="directive"><a href="./mod/core.html#errorlog">ErrorLog</a></code></li><li><code class="directive"><a href="./mod/core.html#errorlogformat">ErrorLogFormat</a></code></li><li><code class="directive"><a href="./mod/core.html#loglevel">LogLevel</a></code></li></ul></td></tr></table> + + <p>The server error log, whose name and location is set by the + <code class="directive"><a href="./mod/core.html#errorlog">ErrorLog</a></code> directive, is the + most important log file. This is the place where Apache httpd + will send diagnostic information and record any errors that it + encounters in processing requests. It is the first place to + look when a problem occurs with starting the server or with the + operation of the server, since it will often contain details of + what went wrong and how to fix it.</p> + + <p>The error log is usually written to a file (typically + <code>error_log</code> on Unix systems and + <code>error.log</code> on Windows and OS/2). On Unix systems it + is also possible to have the server send errors to + <code>syslog</code> or <a href="#piped">pipe them to a + program</a>.</p> + + <p>The format of the error log is defined by the <code class="directive"><a href="./mod/core.html#errorlogformat">ErrorLogFormat</a></code> directive, with which you + can customize what values are logged. A default is format defined + if you don't specify one. A typical log message follows:</p> + + <div class="example"><p><code> + [Fri Sep 09 10:42:29.902022 2011] [core:error] [pid 35708:tid 4328636416] + [client 72.15.99.187] File does not exist: /usr/local/apache2/htdocs/favicon.ico + </code></p></div> + + <p>The first item in the log entry is the date and time of the + message. The next is the module producing the message (core, in this + case) and the severity level of that message. This is followed by + the process ID and, if appropriate, the thread ID, of the process + that experienced the condition. Next, we have the client address + that made the request. And finally is the detailed error message, + which in this case indicates a request for a file that did not + exist.</p> + + <p>A very wide variety of different messages can appear in the + error log. Most look similar to the example above. The error + log will also contain debugging output from CGI scripts. Any + information written to <code>stderr</code> by a CGI script will + be copied directly to the error log.</p> + + <p>Putting a <code>%L</code> token in both the error log and the access + log will produce a log entry ID with which you can correlate the entry + in the error log with the entry in the access log. If + <code class="module"><a href="./mod/mod_unique_id.html">mod_unique_id</a></code> is loaded, its unique request ID will be + used as the log entry ID, too.</p> + + <p>During testing, it is often useful to continuously monitor + the error log for any problems. On Unix systems, you can + accomplish this using:</p> + + <div class="example"><p><code> + tail -f error_log + </code></p></div> + </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="permodule" id="permodule">Per-module logging</a></h2> + + + <p>The <code class="directive"><a href="./mod/core.html#loglevel">LogLevel</a></code> directive + allows you to specify a log severity level on a per-module basis. In + this way, if you are troubleshooting a problem with just one + particular module, you can turn up its logging volume without also + getting the details of other modules that you're not interested in. + This is particularly useful for modules such as + <code class="module"><a href="./mod/mod_proxy.html">mod_proxy</a></code> or <code class="module"><a href="./mod/mod_rewrite.html">mod_rewrite</a></code> where you + want to know details about what it's trying to do.</p> + + <p>Do this by specifying the name of the module in your + <code class="directive">LogLevel</code> directive:</p> + + <pre class="prettyprint lang-config">LogLevel info rewrite:trace5</pre> + + + <p>This sets the main <code class="directive">LogLevel</code> to info, but + turns it up to <code>trace5</code> for + <code class="module"><a href="./mod/mod_rewrite.html">mod_rewrite</a></code>.</p> + + <div class="note">This replaces the per-module logging directives, such as + <code>RewriteLog</code>, that were present in earlier versions of + the server.</div> + </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="accesslog" id="accesslog">Access Log</a></h2> + + + <table class="related"><tr><th>Related Modules</th><th>Related Directives</th></tr><tr><td><ul><li><code class="module"><a href="./mod/mod_log_config.html">mod_log_config</a></code></li><li><code class="module"><a href="./mod/mod_setenvif.html">mod_setenvif</a></code></li></ul></td><td><ul><li><code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code></li><li><code class="directive"><a href="./mod/mod_log_config.html#logformat">LogFormat</a></code></li><li><code class="directive"><a href="./mod/mod_setenvif.html#setenvif">SetEnvIf</a></code></li></ul></td></tr></table> + + <p>The server access log records all requests processed by the + server. The location and content of the access log are + controlled by the <code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code> + directive. The <code class="directive"><a href="./mod/mod_log_config.html#logformat">LogFormat</a></code> + directive can be used to simplify the selection of + the contents of the logs. This section describes how to configure the server + to record information in the access log.</p> + + <p>Of course, storing the information in the access log is only + the start of log management. The next step is to analyze this + information to produce useful statistics. Log analysis in + general is beyond the scope of this document, and not really + part of the job of the web server itself. For more information + about this topic, and for applications which perform log + analysis, check the <a href="http://dmoz.org/Computers/Software/Internet/Site_Management/Log_Analysis/"> + Open Directory</a>. + </p> + + <p>Various versions of Apache httpd have used other modules and + directives to control access logging, including + mod_log_referer, mod_log_agent, and the + <code>TransferLog</code> directive. The <code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code> directive now subsumes + the functionality of all the older directives.</p> + + <p>The format of the access log is highly configurable. The format + is specified using a format string that looks much like a C-style + printf(1) format string. Some examples are presented in the next + sections. For a complete list of the possible contents of the + format string, see the <code class="module"><a href="./mod/mod_log_config.html">mod_log_config</a></code> <a href="mod/mod_log_config.html#formats">format strings</a>.</p> + + <h3><a name="common" id="common">Common Log Format</a></h3> + + + <p>A typical configuration for the access log might look as + follows.</p> + + <pre class="prettyprint lang-config">LogFormat "%h %l %u %t \"%r\" %>s %b" common +CustomLog logs/access_log common</pre> + + + <p>This defines the <em>nickname</em> <code>common</code> and + associates it with a particular log format string. The format + string consists of percent directives, each of which tell the + server to log a particular piece of information. Literal + characters may also be placed in the format string and will be + copied directly into the log output. The quote character + (<code>"</code>) must be escaped by placing a backslash before + it to prevent it from being interpreted as the end of the + format string. The format string may also contain the special + control characters "<code>\n</code>" for new-line and + "<code>\t</code>" for tab.</p> + + <p>The <code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code> + directive sets up a new log file using the defined + <em>nickname</em>. The filename for the access log is relative to + the <code class="directive"><a href="./mod/core.html#serverroot">ServerRoot</a></code> unless it + begins with a slash.</p> + + <p>The above configuration will write log entries in a format + known as the Common Log Format (CLF). This standard format can + be produced by many different web servers and read by many log + analysis programs. The log file entries produced in CLF will + look something like this:</p> + + <div class="example"><p><code> + 127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET + /apache_pb.gif HTTP/1.0" 200 2326 + </code></p></div> + + <p>Each part of this log entry is described below.</p> + + <dl> + <dt><code>127.0.0.1</code> (<code>%h</code>)</dt> + + <dd>This is the IP address of the client (remote host) which + made the request to the server. If <code class="directive"><a href="./mod/core.html#hostnamelookups">HostnameLookups</a></code> is + set to <code>On</code>, then the server will try to determine + the hostname and log it in place of the IP address. However, + this configuration is not recommended since it can + significantly slow the server. Instead, it is best to use a + log post-processor such as <code class="program"><a href="./programs/logresolve.html">logresolve</a></code> to determine + the hostnames. The IP address reported here is not + necessarily the address of the machine at which the user is + sitting. If a proxy server exists between the user and the + server, this address will be the address of the proxy, rather + than the originating machine.</dd> + + <dt><code>-</code> (<code>%l</code>)</dt> + + <dd>The "hyphen" in the output indicates that the requested + piece of information is not available. In this case, the + information that is not available is the RFC 1413 identity of + the client determined by <code>identd</code> on the clients + machine. This information is highly unreliable and should + almost never be used except on tightly controlled internal + networks. Apache httpd will not even attempt to determine + this information unless <code class="directive"><a href="./mod/mod_ident.html#identitycheck">IdentityCheck</a></code> is set + to <code>On</code>.</dd> + + <dt><code>frank</code> (<code>%u</code>)</dt> + + <dd>This is the userid of the person requesting the document + as determined by HTTP authentication. The same value is + typically provided to CGI scripts in the + <code>REMOTE_USER</code> environment variable. If the status + code for the request (see below) is 401, then this value + should not be trusted because the user is not yet + authenticated. If the document is not password protected, + this part will be "<code>-</code>" just like the previous + one.</dd> + + <dt><code>[10/Oct/2000:13:55:36 -0700]</code> + (<code>%t</code>)</dt> + + <dd> + The time that the request was received. + The format is: + + <p class="indent"> + <code>[day/month/year:hour:minute:second zone]<br /> + day = 2*digit<br /> + month = 3*letter<br /> + year = 4*digit<br /> + hour = 2*digit<br /> + minute = 2*digit<br /> + second = 2*digit<br /> + zone = (`+' | `-') 4*digit</code> + </p> + <p>It is possible to have the time displayed in another format + by specifying <code>%{format}t</code> in the log format + string, where <code>format</code> is either as in + <code>strftime(3)</code> from the C standard library, + or one of the supported special tokens. For details see + the <code class="module"><a href="./mod/mod_log_config.html">mod_log_config</a></code> <a href="mod/mod_log_config.html#formats">format strings</a>.</p> + </dd> + + <dt><code>"GET /apache_pb.gif HTTP/1.0"</code> + (<code>\"%r\"</code>)</dt> + + <dd>The request line from the client is given in double + quotes. The request line contains a great deal of useful + information. First, the method used by the client is + <code>GET</code>. Second, the client requested the resource + <code>/apache_pb.gif</code>, and third, the client used the + protocol <code>HTTP/1.0</code>. It is also possible to log + one or more parts of the request line independently. For + example, the format string "<code>%m %U%q %H</code>" will log + the method, path, query-string, and protocol, resulting in + exactly the same output as "<code>%r</code>".</dd> + + <dt><code>200</code> (<code>%>s</code>)</dt> + + <dd>This is the status code that the server sends back to the + client. This information is very valuable, because it reveals + whether the request resulted in a successful response (codes + beginning in 2), a redirection (codes beginning in 3), an + error caused by the client (codes beginning in 4), or an + error in the server (codes beginning in 5). The full list of + possible status codes can be found in the <a href="http://www.w3.org/Protocols/rfc2616/rfc2616.txt">HTTP + specification</a> (RFC2616 section 10).</dd> + + <dt><code>2326</code> (<code>%b</code>)</dt> + + <dd>The last part indicates the size of the object returned + to the client, not including the response headers. If no + content was returned to the client, this value will be + "<code>-</code>". To log "<code>0</code>" for no content, use + <code>%B</code> instead.</dd> + </dl> + + + <h3><a name="combined" id="combined">Combined Log Format</a></h3> + + + <p>Another commonly used format string is called the Combined + Log Format. It can be used as follows.</p> + + <pre class="prettyprint lang-config">LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" combined +CustomLog log/access_log combined</pre> + + + <p>This format is exactly the same as the Common Log Format, + with the addition of two more fields. Each of the additional + fields uses the percent-directive + <code>%{<em>header</em>}i</code>, where <em>header</em> can be + any HTTP request header. The access log under this format will + look like:</p> + + <div class="example"><p><code> + 127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET + /apache_pb.gif HTTP/1.0" 200 2326 + "http://www.example.com/start.html" "Mozilla/4.08 [en] + (Win98; I ;Nav)" + </code></p></div> + + <p>The additional fields are:</p> + + <dl> + <dt><code>"http://www.example.com/start.html"</code> + (<code>\"%{Referer}i\"</code>)</dt> + + <dd>The "Referer" (sic) HTTP request header. This gives the + site that the client reports having been referred from. (This + should be the page that links to or includes + <code>/apache_pb.gif</code>).</dd> + + <dt><code>"Mozilla/4.08 [en] (Win98; I ;Nav)"</code> + (<code>\"%{User-agent}i\"</code>)</dt> + + <dd>The User-Agent HTTP request header. This is the + identifying information that the client browser reports about + itself.</dd> + </dl> + + + <h3><a name="multiple" id="multiple">Multiple Access Logs</a></h3> + + + <p>Multiple access logs can be created simply by specifying + multiple <code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code> + directives in the configuration + file. For example, the following directives will create three + access logs. The first contains the basic CLF information, + while the second and third contain referer and browser + information. The last two <code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code> lines show how + to mimic the effects of the <code>ReferLog</code> and <code>AgentLog</code> directives.</p> + + <pre class="prettyprint lang-config">LogFormat "%h %l %u %t \"%r\" %>s %b" common +CustomLog logs/access_log common +CustomLog logs/referer_log "%{Referer}i -> %U" +CustomLog logs/agent_log "%{User-agent}i"</pre> + + + <p>This example also shows that it is not necessary to define a + nickname with the <code class="directive"><a href="./mod/mod_log_config.html#logformat">LogFormat</a></code> directive. Instead, + the log format can be specified directly in the <code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code> directive.</p> + + + <h3><a name="conditional" id="conditional">Conditional Logs</a></h3> + + + <p>There are times when it is convenient to exclude certain + entries from the access logs based on characteristics of the + client request. This is easily accomplished with the help of <a href="env.html">environment variables</a>. First, an + environment variable must be set to indicate that the request + meets certain conditions. This is usually accomplished with + <code class="directive"><a href="./mod/mod_setenvif.html#setenvif">SetEnvIf</a></code>. Then the + <code>env=</code> clause of the <code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code> directive is used to + include or exclude requests where the environment variable is + set. Some examples:</p> + + <pre class="prettyprint lang-config"># Mark requests from the loop-back interface +SetEnvIf Remote_Addr "127\.0\.0\.1" dontlog +# Mark requests for the robots.txt file +SetEnvIf Request_URI "^/robots\.txt$" dontlog +# Log what remains +CustomLog logs/access_log common env=!dontlog</pre> + + + <p>As another example, consider logging requests from + english-speakers to one log file, and non-english speakers to a + different log file.</p> + + <pre class="prettyprint lang-config">SetEnvIf Accept-Language "en" english +CustomLog logs/english_log common env=english +CustomLog logs/non_english_log common env=!english</pre> + + + <p>In a caching scenario one would want to know about + the efficiency of the cache. A very simple method to + find this out would be:</p> + + <pre class="prettyprint lang-config">SetEnv CACHE_MISS 1 +LogFormat "%h %l %u %t "%r " %>s %b %{CACHE_MISS}e" common-cache +CustomLog logs/access_log common-cache</pre> + + + <p><code class="module"><a href="./mod/mod_cache.html">mod_cache</a></code> will run before + <code class="module"><a href="./mod/mod_env.html">mod_env</a></code> and, when successful, will deliver the + content without it. In that case a cache hit will log + <code>-</code>, while a cache miss will log <code>1</code>.</p> + + <p>In addition to the <code>env=</code> syntax, <code class="directive"><a href="./mod/mod_log_config.html#logformat">LogFormat</a></code> supports logging values + conditional upon the HTTP response code:</p> + + <pre class="prettyprint lang-config">LogFormat "%400,501{User-agent}i" browserlog +LogFormat "%!200,304,302{Referer}i" refererlog</pre> + + + <p>In the first example, the <code>User-agent</code> will be + logged if the HTTP status code is 400 or 501. In other cases, a + literal "-" will be logged instead. Likewise, in the second + example, the <code>Referer</code> will be logged if the HTTP + status code is <strong>not</strong> 200, 204, or 302. (Note the + "!" before the status codes.</p> + + <p>Although we have just shown that conditional logging is very + powerful and flexible, it is not the only way to control the + contents of the logs. Log files are more useful when they + contain a complete record of server activity. It is often + easier to simply post-process the log files to remove requests + that you do not want to consider.</p> + + </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="rotation" id="rotation">Log Rotation</a></h2> + + + <p>On even a moderately busy server, the quantity of + information stored in the log files is very large. The access + log file typically grows 1 MB or more per 10,000 requests. It + will consequently be necessary to periodically rotate the log + files by moving or deleting the existing logs. This cannot be + done while the server is running, because Apache httpd will continue + writing to the old log file as long as it holds the file open. + Instead, the server must be <a href="stopping.html">restarted</a> after the log files are + moved or deleted so that it will open new log files.</p> + + <p>By using a <em>graceful</em> restart, the server can be + instructed to open new log files without losing any existing or + pending connections from clients. However, in order to + accomplish this, the server must continue to write to the old + log files while it finishes serving old requests. It is + therefore necessary to wait for some time after the restart + before doing any processing on the log files. A typical + scenario that simply rotates the logs and compresses the old + logs to save space is:</p> + + <div class="example"><p><code> + mv access_log access_log.old<br /> + mv error_log error_log.old<br /> + apachectl graceful<br /> + sleep 600<br /> + gzip access_log.old error_log.old + </code></p></div> + + <p>Another way to perform log rotation is using <a href="#piped">piped logs</a> as discussed in the next + section.</p> + </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="piped" id="piped">Piped Logs</a></h2> + + + <p>Apache httpd is capable of writing error and access log + files through a pipe to another process, rather than directly + to a file. This capability dramatically increases the + flexibility of logging, without adding code to the main server. + In order to write logs to a pipe, simply replace the filename + with the pipe character "<code>|</code>", followed by the name + of the executable which should accept log entries on its + standard input. The server will start the piped-log process when + the server starts, and will restart it if it crashes while the + server is running. (This last feature is why we can refer to + this technique as "reliable piped logging".)</p> + + <p>Piped log processes are spawned by the parent Apache httpd + process, and inherit the userid of that process. This means + that piped log programs usually run as root. It is therefore + very important to keep the programs simple and secure.</p> + + <p>One important use of piped logs is to allow log rotation + without having to restart the server. The Apache HTTP Server + includes a simple program called <code class="program"><a href="./programs/rotatelogs.html">rotatelogs</a></code> + for this purpose. For example, to rotate the logs every 24 hours, you + can use:</p> + + <pre class="prettyprint lang-config">CustomLog "|/usr/local/apache/bin/rotatelogs /var/log/access_log 86400" common</pre> + + + <p>Notice that quotes are used to enclose the entire command + that will be called for the pipe. Although these examples are + for the access log, the same technique can be used for the + error log.</p> + + <p>As with conditional logging, piped logs are a very powerful + tool, but they should not be used where a simpler solution like + off-line post-processing is available.</p> + + <p>By default the piped log process is spawned without invoking + a shell. Use "<code>|$</code>" instead of "<code>|</code>" + to spawn using a shell (usually with <code>/bin/sh -c</code>):</p> + + <pre class="prettyprint lang-config"># Invoke "rotatelogs" using a shell +CustomLog "|$/usr/local/apache/bin/rotatelogs /var/log/access_log 86400" common</pre> + + + <p>This was the default behaviour for Apache 2.2. + Depending on the shell specifics this might lead to + an additional shell process for the lifetime of the logging + pipe program and signal handling problems during restart. + For compatibility reasons with Apache 2.2 the notation + "<code>||</code>" is also supported and equivalent to using + "<code>|</code>".</p> + + <div class="note"><h3>Windows note</h3> + <p>Note that on Windows, you may run into problems when running many piped + logger processes, especially when HTTPD is running as a service. This is + caused by running out of desktop heap space. The desktop heap space given + to each service is specified by the third argument to the + <code>SharedSection</code> parameter in the + HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\SessionManager\SubSystems\Windows + registry value. <strong>Change this value with care</strong>; the normal + caveats for changing the Windows registry apply, but you might also exhaust + the desktop heap pool if the number is adjusted too high.</p> + </div> + </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="virtualhost" id="virtualhost">Virtual Hosts</a></h2> + + + <p>When running a server with many <a href="vhosts/">virtual + hosts</a>, there are several options for dealing with log + files. First, it is possible to use logs exactly as in a + single-host server. Simply by placing the logging directives + outside the <code class="directive"><a href="./mod/core.html#virtualhost"><VirtualHost></a></code> sections in the + main server context, it is possible to log all requests in the + same access log and error log. This technique does not allow + for easy collection of statistics on individual virtual + hosts.</p> + + <p>If <code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code> + or <code class="directive"><a href="./mod/core.html#errorlog">ErrorLog</a></code> + directives are placed inside a + <code class="directive"><a href="./mod/core.html#virtualhost"><VirtualHost></a></code> + section, all requests or errors for that virtual host will be + logged only to the specified file. Any virtual host which does + not have logging directives will still have its requests sent + to the main server logs. This technique is very useful for a + small number of virtual hosts, but if the number of hosts is + very large, it can be complicated to manage. In addition, it + can often create problems with <a href="vhosts/fd-limits.html">insufficient file + descriptors</a>.</p> + + <p>For the access log, there is a very good compromise. By + adding information on the virtual host to the log format + string, it is possible to log all hosts to the same log, and + later split the log into individual files. For example, + consider the following directives.</p> + + <pre class="prettyprint lang-config">LogFormat "%v %l %u %t \"%r\" %>s %b" comonvhost +CustomLog logs/access_log comonvhost</pre> + + + <p>The <code>%v</code> is used to log the name of the virtual + host that is serving the request. Then a program like <a href="programs/split-logfile.html">split-logfile</a> can be used to + post-process the access log in order to split it into one file + per virtual host.</p> + </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="other" id="other">Other Log Files</a></h2> + + + <table class="related"><tr><th>Related Modules</th><th>Related Directives</th></tr><tr><td><ul><li><code class="module"><a href="./mod/mod_logio.html">mod_logio</a></code></li><li><code class="module"><a href="./mod/mod_log_config.html">mod_log_config</a></code></li><li><code class="module"><a href="./mod/mod_log_forensic.html">mod_log_forensic</a></code></li><li><code class="module"><a href="./mod/mod_cgi.html">mod_cgi</a></code></li></ul></td><td><ul><li><code class="directive"><a href="./mod/mod_log_config.html#logformat">LogFormat</a></code></li><li><code class="directive"><a href="./mod/mod_log_config.html#bufferedlogs">BufferedLogs</a></code></li><li><code class="directive"><a href="./mod/mod_log_forensic.html#forensiclog">ForensicLog</a></code></li><li><code class="directive"><a href="./mod/mpm_common.html#pidfile">PidFile</a></code></li><li><code class="directive"><a href="./mod/mod_cgi.html#scriptlog">ScriptLog</a></code></li><li><code class="directive"><a href="./mod/mod_cgi.html#scriptlogbuffer">ScriptLogBuffer</a></code></li><li><code class="directive"><a href="./mod/mod_cgi.html#scriptloglength">ScriptLogLength</a></code></li></ul></td></tr></table> + + <h3>Logging actual bytes sent and received</h3> + + + <p><code class="module"><a href="./mod/mod_logio.html">mod_logio</a></code> adds in two additional + <code class="directive"><a href="./mod/mod_log_config.html#logformat">LogFormat</a></code> fields + (%I and %O) that log the actual number of bytes received and sent + on the network.</p> + + + <h3>Forensic Logging</h3> + + + <p><code class="module"><a href="./mod/mod_log_forensic.html">mod_log_forensic</a></code> provides for forensic logging of + client requests. Logging is done before and after processing a + request, so the forensic log contains two log lines for each + request. The forensic logger is very strict with no customizations. + It can be an invaluable debugging and security tool.</p> + + + <h3><a name="pidfile" id="pidfile">PID File</a></h3> + + + <p>On startup, Apache httpd saves the process id of the parent + httpd process to the file <code>logs/httpd.pid</code>. This + filename can be changed with the <code class="directive"><a href="./mod/mpm_common.html#pidfile">PidFile</a></code> directive. The + process-id is for use by the administrator in restarting and + terminating the daemon by sending signals to the parent + process; on Windows, use the -k command line option instead. + For more information see the <a href="stopping.html">Stopping + and Restarting</a> page.</p> + + + <h3><a name="scriptlog" id="scriptlog">Script Log</a></h3> + + + <p>In order to aid in debugging, the + <code class="directive"><a href="./mod/mod_cgi.html#scriptlog">ScriptLog</a></code> directive + allows you to record the input to and output from CGI scripts. + This should only be used in testing - not for live servers. + More information is available in the <a href="mod/mod_cgi.html">mod_cgi</a> documentation.</p> + + + </div></div> +<div class="bottomlang"> +<p><span>Available Languages: </span><a href="./en/logs.html" title="English"> en </a> | +<a href="./fr/logs.html" hreflang="fr" rel="alternate" title="Franais"> fr </a> | +<a href="./ja/logs.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> | +<a href="./ko/logs.html" hreflang="ko" rel="alternate" title="Korean"> ko </a> | +<a href="./tr/logs.html" hreflang="tr" rel="alternate" title="Trke"> tr </a></p> +</div><div class="top"><a href="#page-header"><img src="./images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div> +<script type="text/javascript"><!--//--><![CDATA[//><!-- +var comments_shortname = 'httpd'; +var comments_identifier = 'http://httpd.apache.org/docs/2.4/logs.html'; +(function(w, d) { + if (w.location.hostname.toLowerCase() == "httpd.apache.org") { + d.write('<div id="comments_thread"><\/div>'); + var s = d.createElement('script'); + s.type = 'text/javascript'; + s.async = true; + s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier; + (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s); + } + else { + d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>'); + } +})(window, document); +//--><!]]></script></div><div id="footer"> +<p class="apache">Copyright 2019 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p> +<p class="menu"><a href="./mod/">Modules</a> | <a href="./mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="./glossary.html">Glossary</a> | <a href="./sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!-- +if (typeof(prettyPrint) !== 'undefined') { + prettyPrint(); +} +//--><!]]></script> +</body></html>
\ No newline at end of file diff --git a/docs/manual/logs.html.fr.utf8 b/docs/manual/logs.html.fr.utf8 new file mode 100644 index 0000000..9462b5a --- /dev/null +++ b/docs/manual/logs.html.fr.utf8 @@ -0,0 +1,763 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" lang="fr" xml:lang="fr"><head> +<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" /> +<!-- + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + This file is generated from xml source: DO NOT EDIT + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + --> +<title>Fichiers journaux - Serveur HTTP Apache Version 2.4</title> +<link href="./style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" /> +<link href="./style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" /> +<link href="./style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="./style/css/prettify.css" /> +<script src="./style/scripts/prettify.min.js" type="text/javascript"> +</script> + +<link href="./images/favicon.ico" rel="shortcut icon" /></head> +<body id="manual-page"><div id="page-header"> +<p class="menu"><a href="./mod/">Modules</a> | <a href="./mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="./glossary.html">Glossaire</a> | <a href="./sitemap.html">Plan du site</a></p> +<p class="apache">Serveur HTTP Apache Version 2.4</p> +<img alt="" src="./images/feather.png" /></div> +<div class="up"><a href="./"><img title="<-" alt="<-" src="./images/left.gif" /></a></div> +<div id="path"> +<a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">Serveur HTTP</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="./">Version 2.4</a></div><div id="page-content"><div id="preamble"><h1>Fichiers journaux</h1> +<div class="toplang"> +<p><span>Langues Disponibles: </span><a href="./en/logs.html" hreflang="en" rel="alternate" title="English"> en </a> | +<a href="./fr/logs.html" title="Français"> fr </a> | +<a href="./ja/logs.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> | +<a href="./ko/logs.html" hreflang="ko" rel="alternate" title="Korean"> ko </a> | +<a href="./tr/logs.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p> +</div> + + <p>Pour véritablement gérer un serveur web, + il est nécessaire de disposer d'un + retour d'informations à propos de l'activité et des performances du + serveur, ainsi que de tout problème qui pourrait survenir. Le serveur HTTP + Apache propose des fonctionnalités de journalisation souples et très + complètes. Ce document décrit comment configurer ces fonctionnalités de + journalisation et interpréter le contenu des journaux.</p> + </div> +<div id="quickview"><a href="https://www.apache.org/foundation/contributing.html" class="badge"><img src="https://www.apache.org/images/SupportApache-small.png" alt="Support Apache!" /></a><ul id="toc"><li><img alt="" src="./images/down.gif" /> <a href="#overview">Vue d'ensemble</a></li> +<li><img alt="" src="./images/down.gif" /> <a href="#security">Avertissement à propos de la sécurité</a></li> +<li><img alt="" src="./images/down.gif" /> <a href="#errorlog">Journal des erreurs</a></li> +<li><img alt="" src="./images/down.gif" /> <a href="#permodule">Journalisation par module</a></li> +<li><img alt="" src="./images/down.gif" /> <a href="#accesslog">Journal des accès</a></li> +<li><img alt="" src="./images/down.gif" /> <a href="#rotation">Rotation des journaux</a></li> +<li><img alt="" src="./images/down.gif" /> <a href="#piped">Journaux redirigés</a></li> +<li><img alt="" src="./images/down.gif" /> <a href="#virtualhost">Hôtes virtuels</a></li> +<li><img alt="" src="./images/down.gif" /> <a href="#other">Autres fichiers journaux</a></li> +</ul><h3>Voir aussi</h3><ul class="seealso"><li><a href="#comments_section">Commentaires</a></li></ul></div> +<div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="overview" id="overview">Vue d'ensemble</a></h2> + + + <table class="related"><tr><th>Modules Apparentés</th><th>Directives Apparentées</th></tr><tr><td><ul><li><code class="module"><a href="./mod/mod_log_config.html">mod_log_config</a></code></li><li><code class="module"><a href="./mod/mod_log_forensic.html">mod_log_forensic</a></code></li><li><code class="module"><a href="./mod/mod_logio.html">mod_logio</a></code></li><li><code class="module"><a href="./mod/mod_cgi.html">mod_cgi</a></code></li></ul></td><td /></tr></table> + + <p> + Le serveur HTTP Apache fournit toute une variété de mécanismes + différents pour la journalisation de tout ce qui peut se passer au + sein de votre serveur, depuis la requête initiale, en passant par le + processus de mise en correspondance des URLs, et jusqu'à la fermeture + de la connexion, y compris toute erreur pouvant survenir au cours du + traitement. De plus, certains modules tiers fournissent des + fonctionnalités de journalisation ou insèrent des entrées dans les + fichiers journaux existants, et les applications comme les programmes + CGI, les scripts PHP ou autres gestionnaires peuvent envoyer des + messages vers le journal des erreurs du serveur. + </p> + + <p> + Ce document décrit le fonctionnement des modules de journalisation + fournis en standard avec le serveur httpd. + </p> + + </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="security" id="security">Avertissement à propos de la sécurité</a></h2> + + + <p>Tout utilisateur qui a les droits en écriture sur le répertoire dans + lequel Apache httpd écrit ses journaux pourra quasi + certainement avoir accès à l'uid sous lequel le serveur est démarré, en + l'occurrence habituellement root. N'accordez <em>PAS</em> aux utilisateurs + l'accès en écriture au répertoire dans lequel les journaux sont stockés + sans savoir exactement quelles en seraient les conséquences ; voir le + document <a href="misc/security_tips.html">conseils sur la sécurité</a> + pour plus de détails.</p> + + <p>En outre, les journaux peuvent contenir des informations fournies + directement par un client, sans caractères d'échappement. Des clients mal + intentionnés peuvent donc insérer des caractères de contrôle dans les + journaux, et il convient par conséquent d'être très prudent lors de la + manipulation des journaux bruts.</p> + </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="errorlog" id="errorlog">Journal des erreurs</a></h2> + + + <table class="related"><tr><th>Modules Apparentés</th><th>Directives Apparentées</th></tr><tr><td><ul><li><code class="module"><a href="./mod/core.html">core</a></code></li></ul></td><td><ul><li><code class="directive"><a href="./mod/core.html#errorlog">ErrorLog</a></code></li><li><code class="directive"><a href="./mod/core.html#loglevel">LogLevel</a></code></li></ul></td></tr></table> + + <p>Le journal des erreurs du serveur, dont le nom et la localisation sont + définis par la directive <code class="directive"><a href="./mod/core.html#errorlog">ErrorLog</a></code>, + est le journal le plus important. C'est dans celui-ci + que le démon Apache httpd va envoyer les informations de diagnostic et + enregistrer toutes les erreurs qui surviennent lors du traitement des + requêtes. Lorsqu'un problème survient au démarrage du serveur ou pendant + son fonctionnement, la première chose à faire est de regarder dans ce + journal, car il vous renseignera souvent sur le problème rencontré et + la manière d'y remédier.</p> + + <p>Le journal des erreurs est habituellement enregistré dans un fichier + (en général <code>error_log</code> sur les systèmes de type Unix et + <code>error.log</code> sur Windows et OS/2). Sur les systèmes de type Unix, + le serveur peut aussi enregistrer ses erreurs dans + <code>syslog</code> ou les + <a href="#piped">rediriger vers un programme</a> par l'intermédiaire d'un + tube de communication (pipe).</p> + + <p>Le format par défaut du journal des erreurs est descriptif et de forme + relativement libre. Certaines informations apparaissent cependant dans la + plupart des entrées du journal. Voici un message typique + à titre d'exemple : </p> + + <div class="example"><p><code> + [Wed Oct 11 14:32:52 2000] [error] [client 127.0.0.1] + client denied by server configuration: + /export/home/live/ap/htdocs/test + </code></p></div> + + <p>Le premier champ de l'entrée du journal est la date et l'heure du + message. Le second champ indique la sévérité de l'erreur rapportée. La + directive <code class="directive"><a href="./mod/core.html#loglevel">LogLevel</a></code> permet de + restreindre le type des erreurs qui doivent être enregistrées + dans le journal des erreurs en définissant leur niveau de sévérité. Le + troisième champ contient l'adresse IP du client qui a généré l'erreur. + Vient ensuite le message proprement dit, qui indique dans ce cas que le + serveur a été configuré pour interdire l'accès au client. Le serveur + indique le chemin système du document requis (et non + son chemin web).</p> + + <p>Une grande variété de messages différents peuvent apparaître dans le + journal des erreurs. La plupart d'entre eux sont similaires à l'exemple + ci-dessus. Le journal des erreurs peut aussi contenir des informations de + débogage en provenance de scripts CGI. Toute information qu'un script CGI + écrit sur la sortie d'erreurs standard <code>stderr</code> sera recopiée + telle quelle dans le journal des erreurs.</p> + + <p>La directive <code class="directive"><a href="./mod/core.html#errorlogformat">ErrorLogFormat</a></code> + vous permet de personnaliser le format du journal des erreurs, et de + définir les informations à journaliser. Si + <code class="module"><a href="./mod/mod_unique_id.html">mod_unique_id</a></code> est présent, vous pouvez utiliser le + drapeau <code>%L</code> à la fois dans le journal des erreurs et + dans le + journal des accès, ce qui aura pour effet de générer un identifiant + d'entrée qui vous permettra de corréler les entrées du journal des + erreurs avec celles du journal des accès.</p> + + <p>Pendant la phase de test, il est souvent utile de visualiser en continu + le journal des erreurs afin de détecter tout problème éventuel. Sur les + systèmes de type Unix, ceci s'effectue à l'aide de la commande :</p> + + <div class="example"><p><code> + tail -f error_log + </code></p></div> + </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="permodule" id="permodule">Journalisation par module</a></h2> + + + <p>La directive <code class="directive"><a href="./mod/core.html#loglevel">LogLevel</a></code> permet + de spécifier un niveau de sévérité de journalisation pour chaque + module. Vous pouvez ainsi résoudre un problème propre à un module particulier + en augmentant son volume de journalisation sans augmenter ce volume + pour les autres modules. Ceci est particulièrement utile lorsque + vous voulez obtenir des détails sur le fonctionnement de modules + comme <code class="module"><a href="./mod/mod_proxy.html">mod_proxy</a></code> ou <code class="module"><a href="./mod/mod_rewrite.html">mod_rewrite</a></code>.</p> + + <p>Pour ce faire, vous devez spécifier le nom du module dans votre + directive <code class="directive">LogLevel</code> :</p> + + <pre class="prettyprint lang-config">LogLevel info rewrite:trace5</pre> + + + <p>Dans cet exemple, le niveau de journalisation général est défini + à info, et à <code>trace5</code> pour <code class="module"><a href="./mod/mod_rewrite.html">mod_rewrite</a></code>.</p> + + <div class="note">Cette directive remplace les directives de journalisation par + module des versions précédentes du serveur, comme + <code>RewriteLog</code>.</div> + </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="accesslog" id="accesslog">Journal des accès</a></h2> + + + <table class="related"><tr><th>Modules Apparentés</th><th>Directives Apparentées</th></tr><tr><td><ul><li><code class="module"><a href="./mod/mod_log_config.html">mod_log_config</a></code></li><li><code class="module"><a href="./mod/mod_setenvif.html">mod_setenvif</a></code></li></ul></td><td><ul><li><code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code></li><li><code class="directive"><a href="./mod/mod_log_config.html#logformat">LogFormat</a></code></li><li><code class="directive"><a href="./mod/mod_setenvif.html#setenvif">SetEnvIf</a></code></li></ul></td></tr></table> + + <p>Le journal des accès au serveur + enregistre toutes les requêtes que traite + ce dernier. La localisation et le contenu du journal des accès sont définis + par la directive <code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code>. + La directive <code class="directive"><a href="./mod/mod_log_config.html#logformat">LogFormat</a></code> + permet de simplifier la sélection du contenu du journal. Cette section + décrit comment configurer le serveur pour l'enregistrement des informations + dans le journal des accès.</p> + + <p>Bien évidemment, le stockage d'informations dans le journal des accès + n'est que le point de départ de la gestion de la journalisation. L'étape + suivante consiste à analyser ces informations de façon à pouvoir en + extraire des statistiques utiles. L'analyse de journaux en général est en + dehors du sujet de ce document et ne fait pas vraiment partie intégrante + du travail du serveur web lui-même. Pour plus d'informations à propos de ce + sujet et des applications dédiées à l'analyse de journaux, vous pouvez vous + référer à <a href="http://dmoz.org/Computers/Software/Internet/ Site_Management/Log_Analysis/">Open Directory</a>.</p> + + <p>Différentes versions du démon Apache httpd utilisaient d'autres modules + et directives pour contrôler la journalisation des accès, à l'instar de + mod_log_referer, mod_log_agent, et de la directive + <code>TransferLog</code>. La directive + <code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code> rassemble + désormais les fonctionnalités de toutes les anciennes directives.</p> + + <p>Le format du journal des accès est hautement configurable. Il est + défini à l'aide d'une chaîne de format qui ressemble sensiblement à la + chaîne de format de style langage C de printf(1). Vous trouverez quelques + exemples dans les sections suivantes. Pour une liste exhaustive de ce que + peut contenir une chaîne de format, vous pouvez vous référer au chapitre + <a href="mod/mod_log_config.html#formats">chaînes de format</a> de la + documentation du module <code class="module"><a href="./mod/mod_log_config.html">mod_log_config</a></code>.</p> + + <h3><a name="common" id="common">Format habituel du journal</a></h3> + + + <p>Voici une configuration typique pour le journal des accès :</p> + + <pre class="prettyprint lang-config">LogFormat "%h %l %u %t \"%r\" %>s %b" common +CustomLog logs/access_log common</pre> + + + <p>Ici est définie l'<em>identité</em> <code>common</code> qui est + ensuite associée à une chaîne de format de journalisation particulière. + La chaîne de format est constituée de directives débutant par le + caractère %, chacune d'entre elles indiquant au serveur d'enregistrer + un élément particulier d'information. Des caractères littéraux peuvent + aussi être insérés dans la chaîne de format ; il seront copiés tels + quels dans le flux de sortie destiné à la journalisation. + Les guillemets (<code>"</code>) doivent être échappées en les faisant + précéder d'un anti-slash (<code>\</code>) afin qu'elles ne soient pas + interprétées comme la fin de la chaîne de format. La chaîne de format + peut aussi contenir les caractères de contrôle spéciaux + "<code>\n</code>" et "<code>\t</code>" pour insérer respectivement + un passage à la ligne et une tabulation.</p> + + <p>La directive <code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code> + définit un nouveau fichier journal en l'associant à l'identité + précédemment définie. Le chemin du nom de fichier associé au journal + des accès est relatif au chemin défini par la directive + <code class="directive"><a href="./mod/core.html#serverroot">ServerRoot</a></code>, sauf s'il + débute par un slash.</p> + + <p>La configuration ci-dessus va enregistrer les entrées de + journalisation selon un format connu sous le nom de + Common Log Format (CLF) pour "Format de journalisation standard". + Ce format standard peut être produit par de nombreux serveurs web + différents et lu par de nombreux programmes d'analyse de journaux. + Les entrées de fichier journal générées selon le format CLF + ressemblent à ceci :</p> + + <div class="example"><p><code> + 127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET + /apache_pb.gif HTTP/1.0" 200 2326 + </code></p></div> + + <p>Chaque partie de cette entrée de journal est décrite + dans ce qui suit.</p> + + <dl> + <dt><code>127.0.0.1</code> (<code>%h</code>)</dt> + + <dd>Il s'agit de l'adresse IP du client (l'hôte distant) qui a envoyé + la requête au serveur. Si la directive + <code class="directive"><a href="./mod/core.html#hostnamelookups">HostnameLookups</a></code> est positionnée à + <code>On</code>, le serveur va essayer de déterminer le nom de l'hôte + et de l'enregistrer à la place de l'adresse IP. Cette configuration + n'est cependant pas recommandée car elle peut ralentir le serveur de + manière significative. Il est par conséquent préférable d'utiliser un + processeur d'analyse de journaux a posteriori + tel que <code class="program"><a href="./programs/logresolve.html">logresolve</a></code> + pour déterminer les noms d'hôte. L'adresse IP indiquée ici n'est pas + nécessairement l'adresse IP de la machine devant laquelle se trouve + l'utilisateur. Si un serveur mandataire s'intercale entre le serveur + et l'utilisateur, l'adresse indiquée sera celle du mandataire et non + celle de la machine à l'origine de la requête.</dd> + + <dt><code>-</code> (<code>%l</code>)</dt> + + <dd>Le "trait d'union" indique que la portion d'information + correspondante n'est pas disponible. Dans le cas présent, l'information + non disponible est l'identité (RFC 1413) du client telle que déterminée + par <code>identd</code> sur la machine cliente. Cette information est + très peu fiable et ne devrait jamais être utilisée, sauf dans le cas + de réseaux internes étroitement contrôlés. Le démon httpd ne cherchera + d'ailleurs à obtenir cette information que si la directive + <code class="directive"><a href="./mod/mod_ident.html#identitycheck">IdentityCheck</a></code> est positionnée + à <code>On</code>.</dd> + + <dt><code>frank</code> (<code>%u</code>)</dt> + + <dd>Il s'agit de l'identifiant utilisateur de la personne qui a + demandé le document, issu d'une authentification HTTP. + Ce même identifiant est en général fourni aux scripts CGI par + l'intermédiaire de la valeur de la variable d'environnement + <code>REMOTE_USER</code>. Si le statut de la requête (voir plus loin) + est 401, cette identifiant n'est pas fiable car l'utilisateur n'est + pas encore authentifié. Si le document n'est pas protégé par + mot de passe, cette partie d'information sera représentée par + "<code>-</code>", comme la partie précédente.</dd> + + <dt><code>[10/Oct/2000:13:55:36 -0700]</code> + (<code>%t</code>)</dt> + + <dd> + L'heure à laquelle la requête a été reçue. + Le format est le suivant : + + <p class="indent"> + <code>[jour/mois/année:heure:minutes:secondes zone]<br /> + jour = 2*chiffre<br /> + mois = 3*lettre<br /> + année = 4*chiffre<br /> + heure = 2*chiffre<br /> + minutes = 2*chiffre<br /> + secondes = 2*chiffre<br /> + zone = (`+' | `-') 4*chiffre</code> + </p>Il est possible de modifier le format d'affichage de l'heure + en spécifiant <code>%{format}t</code> dans la chaîne de format du + journal, où <code>format</code> est une chaîne de format + de la forme de celle de la fonction <code>strftime(3)</code> + de la bibliothèque C standard, ou choisie parmi les + formats spéciaux supportés. Pour plus de détails, + reportez-vous aux. <a href="mod/mod_log_config.html#formats">chaînes de format</a> + de <code class="module"><a href="./mod/mod_log_config.html">mod_log_config</a></code>. + </dd> + + <dt><code>"GET /apache_pb.gif HTTP/1.0"</code> + (<code>\"%r\"</code>)</dt> + + <dd>La ligne de la requête du client est placée entre guillemets. + Elle contient de nombreuses informations utiles. Tout d'abord, la + méthode utilisée par le client est <code>GET</code>. Ensuite, le + client a demandé la ressource <code>/apache_pb.gif</code>, et enfin, + le client a utilisé le protocole <code>HTTP/1.0</code>. Il est aussi + possible d'enregistrer séparément une ou plusieurs parties de la + requête. Par exemple, la chaîne de format "<code>%m %U %q %H</code>" + va enregistrer la méthode, le chemin, la chaîne de la requête et le + protocole, ce qui donnera le même résultat que + "<code>%r</code>".</dd> + + <dt><code>200</code> (<code>%>s</code>)</dt> + + <dd>C'est le code de statut que le serveur retourne au client. Cette + information est très importante car elle indique si la requête a fait + l'objet d'une réponse positive (codes commençant par 2), une + redirection (codes commençant par 3), une erreur due au client (codes + commençant par 4), ou une erreur due au serveur (codes commençant + par 5). Vous trouverez la liste complète des codes de statut possibles + dans la <a href="http://www.w3.org/Protocols/rfc2616/ rfc2616.txt">specification HTTP</a> (RFC2616 section 10).</dd> + + <dt><code>2326</code> (<code>%b</code>)</dt> + + <dd>La dernière partie indique la taille de l'objet retourné au client, + en-têtes non compris. Si aucun contenu n'a été retourné au client, cette + partie contiendra "<code>-</code>". Pour indiquer l'absence de contenu + par "<code>0</code>", utilisez <code>%B</code> au lieu de + <code>%b</code>.</dd> + </dl> + + + <h3><a name="combined" id="combined">Combined Log Format (Format de journalisation combiné)</a></h3> + + + <p>Une autre chaîne de format couramment utilisée est le + "Combined Log Format" (Format de journalisation combiné). Il s'utilise + comme suit :</p> + + <pre class="prettyprint lang-config">LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" combined +CustomLog log/access_log combined</pre> + + + <p>Ce format est identique au Common Log Format, avec deux champs + supplémentaires. Chacun de ces deux champs utilise la directive + commençant par le caractère "%" <code>%{<em>header</em>}i</code>, + où <em>header</em> peut être n'importe quel en-tête de requête HTTP. + Avec ce format, le journal des accès se présentera comme suit :</p> + + <div class="example"><p><code> + 127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET + /apache_pb.gif HTTP/1.0" 200 2326 + "http://www.example.com/start.html" "Mozilla/4.08 [en] + (Win98; I ;Nav)" + </code></p></div> + + <p>Les champs supplémentaires sont :</p> + + <dl> + <dt><code>"http://www.example.com/start.html"</code> + (<code>\"%{Referer}i\"</code>)</dt> + + <dd>L'en-tête "Referer" (sic) de la requête HTTP. Il indique le site + depuis lequel le client prétend avoir lancé sa requête. (Ce doit être + la page qui contient un lien vers <code>/apache_pb.gif</code> ou + inclut ce dernier fichier).</dd> + + <dt><code>"Mozilla/4.08 [en] (Win98; I ;Nav)"</code> + (<code>\"%{User-agent}i\"</code>)</dt> + + <dd>L'en-tête User-Agent de la requête HTTP. C'est une information + d'identification que le navigateur du client envoie à propos + de lui-même.</dd> + </dl> + + + <h3><a name="multiple" id="multiple">Journaux d'accès multiples</a></h3> + + + <p>Plusieurs journaux d'accès peuvent être créés en spécifiant tout + simplement plusieurs directives + <code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code> dans le + fichier de configuration. Par exemple, les directives suivantes vont + créer trois journaux d'accès. Le premier contiendra les informations + de base CLF, le second les informations du Referer, et le troisième + les informations sur le navigateur. Les deux dernières directives + <code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code> montrent + comment simuler les effets des directives <code>ReferLog</code> et + <code>AgentLog</code>.</p> + + <pre class="prettyprint lang-config">LogFormat "%h %l %u %t \"%r\" %>s %b" common +CustomLog logs/access_log common +CustomLog logs/referer_log "%{Referer}i -> %U" +CustomLog logs/agent_log "%{User-agent}i"</pre> + + + <p>Cet exemple montre aussi qu'il n'est pas obligatoire d'associer + une chaîne de format à un alias au moyen de la directive + <code class="directive"><a href="./mod/mod_log_config.html#logformat">LogFormat</a></code>. Elle peut + être définie directement dans la ligne de la directive + <code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code>.</p> + + + <h3><a name="conditional" id="conditional">Journalisation conditionnelle</a></h3> + + + <p>Il est parfois souhaitable d'exclure certaines entrées des journaux + d'accès en fonction des caractéristiques de la requête du client. On + peut aisément accomplir ceci à l'aide des + <a href="env.html">variables d'environnement</a>. Tout d'abord, une + variable d'environnement doit être définie pour indiquer que la + requête remplit certaines conditions. Pour ceci, on utilise en général + la directive <code class="directive"><a href="./mod/mod_setenvif.html#setenvif">SetEnvIf</a></code>, + puis la clause <code>env=</code> de la directive + <code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code> pour inclure + ou exclure les requêtes pour lesquelles + la variable d'environnement est définie. + Quelques exemples :</p> + + <pre class="prettyprint lang-config"># Marque les requêtes en provenance de l'interface loop-back +SetEnvIf Remote_Addr "127\.0\.0\.1" dontlog +# Marque les requêtes pour le fichier robots.txt +SetEnvIf Request_URI "^/robots\.txt$" dontlog +# Journalise toutes les autres requêtes +CustomLog logs/access_log common env=!dontlog</pre> + + + <p>Autre exemple, imaginons l'enregistrement des requêtes en provenance + d'utilisateurs de langue anglaise dans un journal, et celles des autres + utilisateurs dans un autre journal.</p> + + <pre class="prettyprint lang-config"> SetEnvIf Accept-Language "en" english + CustomLog logs/english_log common env=english + CustomLog logs/non_english_log common env=!english</pre> + + + <p>Dans le contexte d'une mise en cache, il peut être + intéressant de connaître l'efficacité du cache. Pour y parvenir, + on pourrait utiliser cette méthode simple :</p> + + <pre class="prettyprint lang-config">SetEnv CACHE_MISS 1 +LogFormat "%h %l %u %t "%r " %>s %b %{CACHE_MISS}e" common-cache +CustomLog logs/access_log common-cache</pre> + + + <p><code class="module"><a href="./mod/mod_cache.html">mod_cache</a></code> va s'exécuter avant + <code class="module"><a href="./mod/mod_env.html">mod_env</a></code>, et si son action est couronnée de + succès, il délivrera le contenu sans faire appel à ce dernier. Si + l'URL se trouve dans le cache, la valeur journalisée sera alors + <code>-</code>, tandis que dans le cas contraire elle sera + <code>1</code>.</p> + + <p>En plus de la syntaxe <code>env=</code>, la directive <code class="directive"><a href="./mod/mod_log_config.html#logformat">LogFormat</a></code> supporte les + valeurs de journalisation conditionnelles basées sur le code de la + réponse HTTP :</p> + + <pre class="prettyprint lang-config">LogFormat "%400,501{User-agent}i" browserlog +LogFormat "%!200,304,302{Referer}i" refererlog</pre> + + + <p>Dans le premier exemple, le <code>User-agent</code> sera + enregistré si le code d'état HTTP est 400 ou 501. Dans le cas + contraire, c'est un caractère "-" qui sera enregistré à la place. + Dans le second exemple, le <code>Referer</code> sera enregistré si + le code d'état HTTP n'est <strong>pas</strong> 200, 204, ou 302 + (remarquez le caractère "!" avant les codes d'état).</p> + + <p>Bien que nous venions de montrer que la journalisation conditionnelle + est souple et très puissante, cette méthode de contrôle du contenu des + journaux n'est pas la seule. Les fichiers journaux sont plus utiles + quand ils contiennent un enregistrement complet de l'activité du serveur, + et il est souvent plus aisé de simplement traiter à posteriori les fichiers + journaux pour supprimer les requêtes que vous ne voulez pas y voir + apparaître.</p> + + </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="rotation" id="rotation">Rotation des journaux</a></h2> + + + <p>Même dans le cas d'un serveur modérément sollicité, la quantité + d'informations stockées dans les fichiers journaux est très importante. + Le fichier journal des accès grossit en général d'1 Mo ou plus toutes + les 10000 requêtes. Il est par conséquent nécessaire d'effectuer + périodiquement la rotation des journaux en déplaçant ou supprimant les + fichiers correspondants. On ne peut pas le faire pendant que le serveur + est en cours d'exécution, car Apache httpd va continuer à écrire dans l'ancien + fichier journal aussi longtemps qu'il le maintiendra ouvert. + C'est pourquoi le serveur doit être + <a href="stopping.html">redémarré</a> après le déplacement ou la + suppression des fichiers journaux de façon à ce qu'il en ouvre + de nouveaux.</p> + + <p>Avec un redémarrage <em>graceful</em>, on peut faire en sorte que le + serveur ouvre de nouveaux fichiers journaux sans perdre de connexions + existantes ou en cours avec les clients. Cependant, pour que ceci soit + possible, le serveur doit continuer à écrire dans les anciens fichiers + journaux pendant qu'il termine le traitement des requêtes en cours. + Il est donc nécessaire d'attendre un certain temps après le rédémarrage + avant d'effectuer tout traitement sur les fichiers journaux. Voici un + scénario typique dans lequel on effectue une simple rotation des + journaux en compressant les anciens fichiers correspondants afin + de gagner de l'espace disque :</p> + + <div class="example"><p><code> + mv access_log access_log.old<br /> + mv error_log error_log.old<br /> + apachectl graceful<br /> + sleep 600<br /> + gzip access_log.old error_log.old + </code></p></div> + + <p>La section suivante présente une autre méthode de rotation des journaux + qui consiste à utiliser les + <a href="#piped">journaux redirigés</a>.</p> + </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="piped" id="piped">Journaux redirigés</a></h2> + + + <p>Nous avons vu que le démon httpd écrivait les informations de + journalisation des erreurs et des accès dans un fichier journal ; + il peut aussi + rediriger ces informations vers un autre processus par l'intermédiaire d'un + tube de communication (pipe). Cette fonctionnalité améliore + considérablement la souplesse de la journalisation, sans ajouter de code + au serveur principal. Pour rediriger les informations de journalisation + vers un tube de communication, remplacez simplement le nom de fichier + journal par + le caractère pipe "<code>|</code>", suivi du nom de l'exécutable qui va + recueillir les entrées de journal sur son entrée + standard. Le serveur va + lancer le processus de redirection des journaux au moment du démarrage du + serveur, et le relancera s'il cesse de fonctionner + pendant l'exécution du serveur. + (Nous dénommons cette technique "journalisation + redirigée fiable" grâce à cette dernière fonctionnalité.)</p> + + <p>Les processus de journalisation redirigée sont lancés par le processus + httpd parent, et héritent de l'UID de ce dernier. Cela signifie que les + programmes de journalisation dirigée s'exécutent généralement en tant que + root. Il est donc très important que ces programmes soient simples et + sécurisés.</p> + + <p>Un des grands avantages de la journalisation redirigée est la possibilité + d'effectuer la rotation des journaux sans avoir à redémarrer le serveur. Pour + accomplir cette tâche, le serveur HTTP Apache fournit un programme simple + appelé <code class="program"><a href="./programs/rotatelogs.html">rotatelogs</a></code>. Par exemple, pour une rotation des + journaux toutes les 24 heures, ajoutez ces lignes :</p> + + <pre class="prettyprint lang-config">CustomLog "|/usr/local/apache/bin/rotatelogs /var/log/access_log 86400" common</pre> + + + <p>Notez que l'ensemble de la commande qui sera appelée par le tube de + communication a été placée entre guillemets. Bien que cet exemple + concerne le journal des accès, la même technique peut être utilisée + pour le journal des erreurs.</p> + + <p>Comme la journalisation conditionnelle, la journalisation redirigée est + un outil très puissant, mais si elle existe, il est préférable d'utiliser + une solution plus simple comme le traitement à posteriori hors ligne.</p> + + + <p>Par défaut, le processus de redirection du journal est lancé sans + invoquer un shell. Pour invoquer un shell, utilisez "<code>|$</code>" + au lieu de "<code>|</code>" (en général avec <code>/bin/sh -c</code>) + :</p> + + <pre class="prettyprint lang-config"># Invocation de "rotatelogs" en utilisant un shell +CustomLog "|$/usr/local/apache/bin/rotatelogs /var/log/access_log 86400" common</pre> + + + + <p>Il s'agissait du comportement par défaut sous Apache 2.2. Selon + les spécificités du shell, ceci peut générer un processus shell + supplémentaire pour toute la durée du programme de redirection du + journal, et induire des problèmes de gestion de signaux au cours du + redémarrage. La notation "<code>||</code>" est aussi supportée pour + des raisons de compatibilité avec Apache 2.2 et est équivalente à + "<code>|</code>".</p> + + <div class="note"><h3>Note à propos de la plateforme Windows</h3> + <p>Notez que sous Windows, la mémoire allouée au bureau (desktop + heap) peut devenir insuffisante si vous utilisez de nombreux + processus vers lesquels sont redirigés des journaux via un pipe, et + ceci particulièrement si httpd s'exécute en tant que service. La + quantité de mémoire du bureau allouée à chaque service est spécifiée + dans le troisième argument du paramètre <code>SharedSection</code> + de la clé de registre + HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\SessionManager\SubSystems\Windows. + <strong>Modifiez cette valeur avec prudence</strong> ; les + précautions d'usage s'imposent lorsqu'on modifie la base de registre, + mais vous pouvez aussi saturer la mémoire du bureau si vous + spécifiez une valeur trop élevée.</p> + </div> + </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="virtualhost" id="virtualhost">Hôtes virtuels</a></h2> + + + <p>Lorsqu'un serveur possède plusieurs <a href="vhosts/">hôtes virtuels</a>, il existe de nombreuses solutions pour gérer + les fichiers journaux. Par exemple, on peut utiliser les journaux comme + s'il s'agissait d'un serveur avec un seul hôte. Il suffit pour cela de + placer les directives de journalisation en dehors des sections + <code class="directive"><a href="./mod/core.html#virtualhost"><VirtualHost></a></code> au niveau + du serveur principal, ce qui a pour effet de journaliser toutes les + requêtes dans le même journal des accès et des erreurs. Cette technique + est cependant inappropriée pour recueillir des statistiques sur chaque + hôte virtuel individuellement.</p> + + <p>Si des directives <code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code> ou + <code class="directive"><a href="./mod/core.html#errorlog">ErrorLog</a></code> sont placées dans une section + <code class="directive"><a href="./mod/core.html#virtualhost"><VirtualHost></a></code>, toutes les + requêtes ou erreurs pour cet hôte virtuel ne seront enregistrées que dans + le fichier spécifié. Tout hôte virtuel qui ne possède pas de directives de + journalisation verra ses requêtes enregistrées dans le journal du serveur + principal. Cette technique est appropriée pour un petit nombre d'hôtes + virtuels, mais si ce nombre est important, elle peut devenir compliquée à + gérer. En outre, des problèmes de <a href="vhosts/fd-limits.html">nombre de descripteurs + de fichiers insuffisant</a> peuvent rapidement apparaître.</p> + + <p>Il existe un très bon compromis pour le journal des accès. En intégrant + les informations à propos de l'hôte virtuel à la chaîne de format du + journal, il est possible de journaliser tous les hôtes dans le même + journal, puis de séparer ultérieurement le journal en plusieurs journaux + individuels. Considérons par exemple les directives suivantes :</p> + + <pre class="prettyprint lang-config">LogFormat "%v %l %u %t \"%r\" %>s %b" comonvhost +CustomLog logs/access_log comonvhost</pre> + + + <p>Le champ <code>%v</code> sert à enregistrer le nom de l'hôte virtuel qui + traite la requête. Un programme tel que <a href="programs/split-logfile.html">split-logfile</a> peut ensuite être utilisé + pour générer "à froid" autant de journaux que d'hôtes virtuels.</p> + </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="other" id="other">Autres fichiers journaux</a></h2> + + + <table class="related"><tr><th>Modules Apparentés</th><th>Directives Apparentées</th></tr><tr><td><ul><li><code class="module"><a href="./mod/mod_logio.html">mod_logio</a></code></li><li><code class="module"><a href="./mod/mod_log_config.html">mod_log_config</a></code></li><li><code class="module"><a href="./mod/mod_log_forensic.html">mod_log_forensic</a></code></li><li><code class="module"><a href="./mod/mod_cgi.html">mod_cgi</a></code></li></ul></td><td><ul><li><code class="directive"><a href="./mod/mod_log_config.html#logformat">LogFormat</a></code></li><li><code class="directive"><a href="./mod/mod_log_config.html#bufferedlogs">BufferedLogs</a></code></li><li><code class="directive"><a href="./mod/mod_log_forensic.html#forensiclog">ForensicLog</a></code></li><li><code class="directive"><a href="./mod/mpm_common.html#pidfile">PidFile</a></code></li><li><code class="directive"><a href="./mod/mod_cgi.html#scriptlog">ScriptLog</a></code></li><li><code class="directive"><a href="./mod/mod_cgi.html#scriptlogbuffer">ScriptLogBuffer</a></code></li><li><code class="directive"><a href="./mod/mod_cgi.html#scriptloglength">ScriptLogLength</a></code></li></ul></td></tr></table> + + <h3>Enregistrement du nombre réel d'octets envoyés et reçus</h3> + + + <p>Le module <code class="module"><a href="./mod/mod_logio.html">mod_logio</a></code> fournit deux champs + <code class="directive"><a href="./mod/mod_log_config.html#logformat">LogFormat</a></code> supplémentaires + (%I et %O) qui permettent d'enregistrer le nombre réel d'octets reçus et + envoyés sur le réseau.</p> + + + <h3>Journalisation de style investigation judiciaire (forensic logging)</h3> + + + <p>Le module <code class="module"><a href="./mod/mod_log_forensic.html">mod_log_forensic</a></code> permet la journalisation + à des fins d'investigation judiciaire des requêtes des clients. La + journalisation est effectuée avant et après le traitement de la requête, + qui fait donc l'objet de deux entrées dans le journal. Le générateur de + journaux d'investigation est très strict et ne permet aucune + personnalisation. C'est un inestimable outil de débogage et de sécurité.</p> + + + <h3><a name="pidfile" id="pidfile">Fichier PID</a></h3> + + + <p>Au démarrage, le démon httpd Apache enregistre l'identifiant du + processus httpd parent dans le fichier <code>logs/httpd.pid</code>. + Le nom de ce fichier peut être modifié à l'aide de la directive + <code class="directive"><a href="./mod/mpm_common.html#pidfile">PidFile</a></code>. Cet identifiant + permet à l'administrateur de redémarrer et arrêter le démon en + envoyant des signaux au processus parent ; sous Windows, vous devez + utiliser l'option de ligne de commande -k. Pour plus de détails, + consulter la page <a href="stopping.html">Arrêt et redémarrage</a>.</p> + + + <h3><a name="scriptlog" id="scriptlog">Journal des scripts</a></h3> + + + <p>Afin de faciliter le débogage, la directive + <code class="directive"><a href="./mod/mod_cgi.html#scriptlog">ScriptLog</a></code> vous permet + d'enregistrer les entrées et sorties des scripts CGI. Elle ne doit être + utilisée que pendant la phase de test, et en aucun cas sur un + serveur en production. Vous trouverez plus d'informations dans la + documentation du module <a href="mod/mod_cgi.html">mod_cgi</a>.</p> + + + </div></div> +<div class="bottomlang"> +<p><span>Langues Disponibles: </span><a href="./en/logs.html" hreflang="en" rel="alternate" title="English"> en </a> | +<a href="./fr/logs.html" title="Français"> fr </a> | +<a href="./ja/logs.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> | +<a href="./ko/logs.html" hreflang="ko" rel="alternate" title="Korean"> ko </a> | +<a href="./tr/logs.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p> +</div><div class="top"><a href="#page-header"><img src="./images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Commentaires</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div> +<script type="text/javascript"><!--//--><![CDATA[//><!-- +var comments_shortname = 'httpd'; +var comments_identifier = 'http://httpd.apache.org/docs/2.4/logs.html'; +(function(w, d) { + if (w.location.hostname.toLowerCase() == "httpd.apache.org") { + d.write('<div id="comments_thread"><\/div>'); + var s = d.createElement('script'); + s.type = 'text/javascript'; + s.async = true; + s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier; + (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s); + } + else { + d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>'); + } +})(window, document); +//--><!]]></script></div><div id="footer"> +<p class="apache">Copyright 2019 The Apache Software Foundation.<br />Autorisé sous <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p> +<p class="menu"><a href="./mod/">Modules</a> | <a href="./mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="./glossary.html">Glossaire</a> | <a href="./sitemap.html">Plan du site</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!-- +if (typeof(prettyPrint) !== 'undefined') { + prettyPrint(); +} +//--><!]]></script> +</body></html>
\ No newline at end of file diff --git a/docs/manual/logs.html.ja.utf8 b/docs/manual/logs.html.ja.utf8 new file mode 100644 index 0000000..e720f38 --- /dev/null +++ b/docs/manual/logs.html.ja.utf8 @@ -0,0 +1,604 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja"><head> +<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" /> +<!-- + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + This file is generated from xml source: DO NOT EDIT + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + --> +<title>ログファイル - Apache HTTP サーバ バージョン 2.4</title> +<link href="./style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" /> +<link href="./style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" /> +<link href="./style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="./style/css/prettify.css" /> +<script src="./style/scripts/prettify.min.js" type="text/javascript"> +</script> + +<link href="./images/favicon.ico" rel="shortcut icon" /></head> +<body id="manual-page"><div id="page-header"> +<p class="menu"><a href="./mod/">モジュール</a> | <a href="./mod/directives.html">ディレクティブ</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="./glossary.html">用語</a> | <a href="./sitemap.html">サイトマップ</a></p> +<p class="apache">Apache HTTP サーバ バージョン 2.4</p> +<img alt="" src="./images/feather.png" /></div> +<div class="up"><a href="./"><img title="<-" alt="<-" src="./images/left.gif" /></a></div> +<div id="path"> +<a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP サーバ</a> > <a href="http://httpd.apache.org/docs/">ドキュメンテーション</a> > <a href="./">バージョン 2.4</a></div><div id="page-content"><div id="preamble"><h1>ログファイル</h1> +<div class="toplang"> +<p><span>翻訳済み言語: </span><a href="./en/logs.html" hreflang="en" rel="alternate" title="English"> en </a> | +<a href="./fr/logs.html" hreflang="fr" rel="alternate" title="Français"> fr </a> | +<a href="./ja/logs.html" title="Japanese"> ja </a> | +<a href="./ko/logs.html" hreflang="ko" rel="alternate" title="Korean"> ko </a> | +<a href="./tr/logs.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p> +</div> +<div class="outofdate">この日本語訳はすでに古くなっている + 可能性があります。 + 最近更新された内容を見るには英語版をご覧下さい。 + </div> + + <p>ウェブサーバを効果的に管理するためには、サーバの活動やパフォーマンス、 + 今発生しているかもしれない問題に関するフィードバックを得ることが必要です。 + Apache HTTP サーバには非常に包括的で柔軟なロギング機能があります。 + この文書はロギング機能の設定の仕方と、ログに何が書かれているかを + 理解するための方法を説明します。</p> + </div> +<div id="quickview"><a href="https://www.apache.org/foundation/contributing.html" class="badge"><img src="https://www.apache.org/images/SupportApache-small.png" alt="Support Apache!" /></a><ul id="toc"><li><img alt="" src="./images/down.gif" /> <a href="#security"> + セキュリティに関する警告</a></li> +<li><img alt="" src="./images/down.gif" /> <a href="#errorlog">エラーログ</a></li> +<li><img alt="" src="./images/down.gif" /> <a href="#accesslog">アクセスログ</a></li> +<li><img alt="" src="./images/down.gif" /> <a href="#rotation">ログの交替</a></li> +<li><img alt="" src="./images/down.gif" /> <a href="#piped">パイプ経由のログ</a></li> +<li><img alt="" src="./images/down.gif" /> <a href="#virtualhosts">バーチャルホスト</a></li> +<li><img alt="" src="./images/down.gif" /> <a href="#other">他のログファイル</a></li> +</ul><h3>参照</h3><ul class="seealso"><li><a href="#comments_section">コメント</a></li></ul></div> +<div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="security" id="security"> + セキュリティに関する警告</a></h2> + + <p>Apache がログファイルを書いているディレクトリに書き込める人は、 + ほぼ確実にサーバが起動された uid へのアクセスを手に入れることができます。 + そして、それは通常は root ユーザです。 + ちゃんと結果を考えることなく、そのディレクトリへの + 書き込み権限を与え<em>ない</em>でください。詳しくは + <a href="misc/security_tips.html">セキュリティのこつ</a>の文書を + 読んでください。</p> + + <p>加えて、ログファイルにはクライアントからの情報がそのまま、 + エスケープされることなく書かれています。ですから、悪意のある + クライアントがログファイルに制御文字を挿入することができます。 + 生のログを扱うときは注意してください。</p> + </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="errorlog" id="errorlog">エラーログ</a></h2> + + <table class="related"><tr><th>関連モジュール</th><th>関連ディレクティブ</th></tr><tr><td /><td><ul><li><code class="directive"><a href="./mod/core.html#errorlog">ErrorLog</a></code></li><li><code class="directive"><a href="./mod/core.html#loglevel">LogLevel</a></code></li></ul></td></tr></table> + + <p><code class="directive"><a href="./mod/core.html#errorlog">ErrorLog</a></code> ディレクティブにより + 名前と場所が決まるサーバのエラーログは、一番重要なログファイルです。 + Apache の診断情報はここに送られ、リクエストを処理しているときに + 発生したエラーはすべてここに記録されます。サーバを起動したときや、 + サーバの動作に問題が起こったときは、一番最初に調べるべき + ところです。間違いの詳細や修正方法がそこに書かれていることが + よくあります。</p> + + <p>エラーログは普通はファイルに書かれます (通常 Unix システムでは + <code>error_log</code>、Windows と OS/2 では <code>error.log</code>)。 + Unix システムではエラーを <code>syslog</code> や + <a href="#piped">パイプでプログラムに送る</a> ことができます。</p> + + <p>エラーログの書式は比較的自由度の高いもので、説明的に書かれています。 + ただし、いくつかの情報はほとんどのエラーログのエントリにあります。 + 例えば、代表的なものに次のようなメッセージがあります。</p> + + <div class="example"><p><code> + [Wed Oct 11 14:32:52 2000] [error] [client 127.0.0.1] + client denied by server configuration: + /export/home/live/ap/htdocs/test + </code></p></div> + + <p>ログエントリの最初の項目はメッセージの日付と時刻です。 + 二つめの項目は報告されているエラーの重要度です。 + <code class="directive"><a href="./mod/core.html#loglevel">LogLevel</a></code> で重要度のレベルを + 制限することによりエラーログに送られるエラーの種類を制御することが + できます。三つ目の項目はエラーを発生させたクライアントの IP アドレス + です。残りはメッセージで、この場合はサーバがクライアントのアクセスを + 拒否するように設定されている、ということを示しています。 + サーバはリクエストされた文書の (ウェブのパスではなく) ファイルシステムの + パスを報告します。</p> + + <p>非常に広範囲のメッセージがエラーログに現れます。たいていのものは + 上の例のような感じです。エラーログには CGI スクリプトのデバッグ + 出力も書かれます。CGI スクリプトが <code>stderr</code> に書いた + すべての情報は直接エラーログにコピーされます。</p> + + <p>情報を追加したり削除したりしてエラーログをカスタマイズすることは + できません。しかし、リクエストに対するエラーログのエントリは、 + 対応するエントリが<a href="#accesslog">アクセスログ</a>にあります。 + 例えば、上の例のエントリはアクセスログのステータスコード 403 の + エントリに対応します。アクセスログはカスタマイズ可能ですので、 + そちらを使うことによりエラーの状況に関する情報をより多く + 手に入れることができます。</p> + + <p>テストの最中は、問題が発生しているかどうかを見るために、 + 常にエラーログを監視するのが役に立つ場合がよくあります。 + Unix システムでは、次のものを使うことができます。</p> + + <div class="example"><p><code> + tail -f error_log + </code></p></div> + </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="accesslog" id="accesslog">アクセスログ</a></h2> + + + <table class="related"><tr><th>関連モジュール</th><th>関連ディレクティブ</th></tr><tr><td><ul><li><code class="module"><a href="./mod/mod_log_config.html">mod_log_config</a></code></li><li><code class="module"><a href="./mod/mod_setenvif.html">mod_setenvif</a></code></li></ul></td><td><ul><li><code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code></li><li><code class="directive"><a href="./mod/mod_log_config.html#logformat">LogFormat</a></code></li><li><code class="directive"><a href="./mod/mod_setenvif.html#setenvif">SetEnvIf</a></code></li></ul></td></tr></table> + + <p>サーバアクセスログはサーバが処理をしたすべてのリクエストを + 記録します。アクセスログの場所と内容は <code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code> + ディレクティブにより決まります。ログの内容の選択を簡潔にするために + <code class="directive"><a href="./mod/mod_log_config.html#logformat">LogFormat</a></code> + ディレクティブを使用することができます。このセクションはアクセスログに + 情報を記録するためのサーバの設定方法を説明します。</p> + + <p>もちろん、アクセスログに情報を蓄積することはログ管理の + 始まりに過ぎません。次の段階は有用な統計を取るためにこの情報を + 解析することです。一般的なログ解析はこの文書の範囲外で、 + ウェブサーバ自身の仕事というわけでもありません。この話や、 + ログ解析を行なうアプリケーションの情報を得るには、<a href="http://dmoz.org/Computers/Software/Internet/Site_Management/Log_Analysis/"> + Open Directory</a> を調べてください。</p> + + <p>いろんなバージョンの Apache httpd が mod_log_config, + mod_log_agent, <code>TransferLog</code> ディレクティブといった、 + 他のモジュールやディレクティブを使ってアクセスのロギングを + 制御してきました。今では、<code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code> がすべての古い + ディレクティブの機能を含むようになっています。</p> + + <p>アクセスログの書式は非常に柔軟な設定が可能です。 + 書式は C の printf(1) フォーマット文字列に非常に似た + <code class="directive"><a href="./mod/mod_log_config.html#フォーマット文字列">フォーマット文字列</a></code> + により指定されます。いくつか次の節で例を示します。 + フォーマット文字列に使用できる内容の一覧は <a href="mod/mod_log_config.html">mod_log_config の文書</a> + を見てください。</p> + + <h3><a name="common" id="common">Common Log Format</a></h3> + + + <p>アクセスログのよくある設定に以下のものがあります。</p> + + <div class="example"><p><code> + LogFormat "%h %l %u %t \"%r\" %>s %b" common<br /> + CustomLog logs/access_log common + </code></p></div> + + <p>これは、<em>ニックネーム</em> <code>common</code> を定義し、 + ログのフォーマット文字列の一つと関連付けます。フォーマット文字列は + パーセントディレクティブからなり、それぞれのパーセントディレクティブは + サーバにどの情報をロギングするかを指示します。フォーマット文字列に + 文字をそのまま入れることもでき、それらはログの出力に直接コピーされます。 + そこに引用文字 (<code>"</code>) を書くときは、 + フォーマット文字列の最後として解釈 + されることを防ぐためにバックスラッシュでエスケープする必要があります。 + フォーマット文字列には改行用の "<code>\n</code>"、タブ用の + "<code>\t</code>" という特別な制御文字も含めることができます。</p> + + <p><code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code> ディレクティブは + 既に定義された + <em>ニックネーム</em> を使って新しいログファイルを設定します。 + アクセスログのファイル名はスラッシュで始まらない限り、 + <code class="directive"><a href="./mod/core.html#serverroot">ServerRoot</a></code> からの相対パスとして + 扱われます。</p> + + <p>上の設定は Common Log Format (CLF) と呼ばれる形式で + ログエントリを書きます。この標準の形式は異なるウェブサーバの多くが + 生成することができ、多くのログ解析プログラムが読みこむことができます。 + CLF により生成されたログファイルのエントリは以下のようになります:</p> + + <div class="example"><p><code> + 127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET + /apache_pb.gif HTTP/1.0" 200 2326 + </code></p></div> + + <p>このログエントリのそれぞれの部分の意味は以下で説明します。</p> + + <dl> + <dt><code>127.0.0.1</code> (<code>%h</code>)</dt> + + <dd>これはサーバへリクエストをしたクライアント (リモートホスト) + の IP アドレスです。<code class="directive"><a href="./mod/core.html#hostnamelookups">HostnameLookups</a></code> が + <code>On</code> の場合は、サーバはホスト名を調べて、 + IP アドレスが書かれているところに記録します。しかし、この設定は + サーバをかなり遅くするので、あまりお勧めできません。 + そうではなく、<code class="program"><a href="./programs/logresolve.html">logresolve</a></code> の + ようなログの後処理を行なうプログラムでホスト名を調べるのが良いでしょう。 + ここに報告される IP アドレスは必ずしもユーザが使っているマシンの + ものであるとは限りません。ユーザとサーバの間にプロキシサーバが + あれば、このアドレスは元のマシンのものではなく、プロキシの + アドレスになります。</dd> + + <dt><code>-</code> (<code>%l</code>)</dt> + + <dd>出力中の「ハイフン」は要求された情報が手に入らなかったということを + 意味します。この場合、取得できなかった情報はクライアントのマシンの + <code>identd</code> により決まる RFC 1413 のクライアントの + アイデンティティです。この情報はあまり信用することができず、 + しっかりと管理された内部ネットワークを除いては使うべきではありません。 + Apache は <code class="directive"><a href="./mod/core.html#identitycheck">IdentityCheck</a></code> が + <code>On</code> になっていない限り、この情報を得ようとすらしません。</dd> + + <dt><code>frank</code> (<code>%u</code>)</dt> + + <dd>これは HTTP 認証による、ドキュメントをリクエストした人の + ユーザ ID です。CGI スクリプトには通常同じ値が <code>REMOTE_USER</code> + 環境変数として与えられます。リクエストのステータスコード + (以下を参照) が 401 であった場合は、ユーザは認証に失敗しているので、 + この値は信用できません。ドキュメントがパスワードで保護されていない + 場合は、この部分は前のものと同じように "<code>-</code>" に + なります。</dd> + + <dt><code>[10/Oct/2000:13:55:36 -0700]</code> + (<code>%t</code>)</dt> + + <dd> + サーバがリクエストを受け取った時刻です。書式は: + + <p class="indent"> + <code>[day/month/year:hour:minute:second zone]<br /> + day = 2*digit<br /> + month = 3*letter<br /> + year = 4*digit<br /> + hour = 2*digit<br /> + minute = 2*digit<br /> + second = 2*digit<br /> + zone = (`+' | `-') 4*digit</code> + </p> + ログのフォーマット文字列に <code>%{format}t</code> を + 指定することで、別の形式で時刻を表示させることもできます。 + このとき、<code>format</code> は C の標準ライブラリの + <code>strftime(3)</code> の形式になります。 + </dd> + + <dt><code>"GET /apache_pb.gif HTTP/1.0"</code> + (<code>\"%r\"</code>)</dt> + + <dd>クライアントからのリクエストが二重引用符の中に示されています。 + リクエストには多くの有用な情報があります。まず、この場合クライアントが + 使ったメソッドは <code>GET</code> です。次に、クライアントは + リソース <code>/apache_pb.gif</code> を要求しました。そして、 + クライアントはプロトコル <code>HTTP/1.0</code> を使用しました。 + リクエストの各部分を独立にログ収集することもできます。例えば、 + フォーマット文字列 "<code>%m %U%q %H</code>" は + メソッド、パス、クエリ文字列、プロトコルをログ収集し、 + 結局 "<code>%r</code>" とまったく同じ出力になります。</dd> + + <dt><code>200</code> (<code>%>s</code>)</dt> + + <dd>サーバがクライアントに送り返すステータスコードです。 + この情報は、リクエストが成功応答 (2 で始まるコード) であったか、 + リダイレクション (3 で始まるコード) であったか、クライアントによる + エラー (4 で始まるコード) であったか、サーバのエラー (5 で始まるコード) + であったか、を表すので、非常に大切です。ステータスコードの + 完全なリストは <a href="http://www.w3.org/Protocols/rfc2616/rfc2616.txt">HTTP + 規格</a> (RFC2616 第 10 節) にあります。</dd> + + <dt><code>2326</code> (<code>%b</code>)</dt> + + <dd>この最後の部分はクライアントに送信されたオブジェクトの、 + 応答ヘッダを除いたサイズを表します。コンテントがクライアントに送られなかった + 場合は、この値は "<code>-</code>" になります。コンテントが無い場合に + "<code>0</code>" をログ収集するには、<code>%b</code> ではなく + <code>%B</code> を使ってください。</dd> + + </dl> + + + <h3><a name="combined" id="combined">Combined Log Format</a></h3> + + + <p>もう一つのよく使われる書式は Combined Log Format と呼ばれています。 + 以下のようにして使うことができます。</p> + + <div class="example"><p><code> + LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" + \"%{User-agent}i\"" combined<br /> + CustomLog log/access_log combined + </code></p></div> + + <p>この書式の最初の方は Common Log Format とまったく同じで、最後に + 二つ追加のエントリがあります。追加のエントリはパーセントディレクティブ + <code>%{<em>header</em>}i</code> を使っています。ここで + <em>header</em> は HTTP のリクエストヘッダのどれかです。この書式による + アクセスログは以下のような感じになります:</p> + + <div class="example"><p><code> + 127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET + /apache_pb.gif HTTP/1.0" 200 2326 + "http://www.example.com/start.html" "Mozilla/4.08 [en] + (Win98; I ;Nav)" + </code></p></div> + + <p>追加のエントリは:</p> + + <dl> + <dt><code>"http://www.example.com/start.html"</code> + (<code>\"%{Referer}i\"</code>)</dt> + + <dd>"Referer" (意図的な綴り間違い) HTTP リクエストヘッダです。 + これはクライアントが報告してくる参照元のサイトを表します。 + (この場合は、<code>/apache_pb.gif</code> にリンクしているか、 + それを含んでいるページです)。</dd> + + <dt><code>"Mozilla/4.08 [en] (Win98; I ;Nav)"</code> + (<code>\"%{User-agent}i\"</code>)</dt> + + <dd>User-Agent HTTP リクエストヘッダです。これはクライアントのブラウザが + 自分自身のことを報告してくる情報です。</dd> + </dl> + + + <h3><a name="multiple" id="multiple">複数のアクセスログ</a></h3> + + + <p>複数のアクセスログは単に設定ファイルに複数の <code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code> + ディレクティブを書くことで作成されます。例えば、以下のディレクティブは + 三つのアクセスログを作ります。最初のものは基本的な CLF の情報で、 + 二つ目と三つ目は referer とブラウザの情報です。最後二つの + <code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code> は + <code>ReferLog</code> ディレクティブと + <code>AgentLog</code> ディレクティブの効果をまねる方法を示しています。</p> + + <div class="example"><p><code> + LogFormat "%h %l %u %t \"%r\" %>s %b" common<br /> + CustomLog logs/access_log common<br /> + CustomLog logs/referer_log "%{Referer}i -> %U"<br /> + CustomLog logs/agent_log "%{User-agent}i" + </code></p></div> + + <p>この例は <code class="directive"><a href="./mod/mod_log_config.html#logformat">LogFormat</a></code> で + ニックネームを定義する必要がない、 + ということも示しています。ニックネームの代わりに、 + <code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code> ディレクティブに + 直接ログの書式を指定することができます。</p> + + + <h3><a name="conditional" id="conditional">条件付きログ</a></h3> + + + <p>クライアントのリクエストの特徴に基づいてアクセスログにエントリの + 一部をロギングしない方が便利なことがあります。これは <a href="env.html">環境変数</a> の補助により簡単に実現できます。まず、 + リクエストが何らかの条件に合うということを表すために環境変数が + 設定される必要があります。これは通常は <code class="directive"><a href="./mod/mod_setenvif.html#setenvif">SetEnvIf</a></code> により + 行なわれます。そして、<code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code> ディレクティブの + <code>env=</code> 節を使って環境変数が設定されているリクエストを + 含めたり排除したりすることができます。いくつか例を挙げます:</p> + + <div class="example"><p><code> + # Mark requests from the loop-back interface<br /> + SetEnvIf Remote_Addr "127\.0\.0\.1" dontlog<br /> + # Mark requests for the robots.txt file<br /> + SetEnvIf Request_URI "^/robots\.txt$" dontlog<br /> + # Log what remains<br /> + CustomLog logs/access_log common env=!dontlog + </code></p></div> + + <p>他の例として、英語を話す人からのリクエストとそれ以外の人からのリクエストを + 分けたい、という場合を考えてみてください。</p> + + <div class="example"><p><code> + SetEnvIf Accept-Language "en" english<br /> + CustomLog logs/english_log common env=english<br /> + CustomLog logs/non_english_log common env=!english + </code></p></div> + + <p>ここまででは条件付きロギングが非常に強力で柔軟であることを示してきましたが、 + それがログの内容を制御する唯一の方法というわけではありません。ログファイルは + サーバの活動の完全な記録である方がより役に立ちます。単純にログファイルを + 後処理して、考慮したくないログを削除する方が簡単であることがよくあります。</p> + + </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="rotation" id="rotation">ログの交替</a></h2> + + + <p>普通の負荷のサーバでさえ、ログファイルに保存される情報の量は + 膨大になります。アクセスログのファイルは普通 10,000 リクエスト毎に + 1 MB 以上増えます。ですから、既存のログを移動したり、削除したりして、 + 定期的にログを交替させることが必要になります。これはサーバの実行中には + 行なえません。というのは、Apache はファイルが open されている間は + ずっと古いログファイルに書き続けるからです。 + 新しいログファイルを open できるように、ログファイルが移動されたり + 削除された後に、サーバを<a href="stopping.html">再起動</a>する + 必要があります。</p> + + <p><em>優雅な</em> 再起動を行なうことで、サーバは既存のコネクションや + 処理待ちのコネクションを失うことなく新しいログファイルを open させる + ことができます。しかし、これを実現するために、サーバは古いリクエストを + 扱っている間は古いログファイルに書き続ける必要があります。 + ですから、再起動の後ではログファイルの処理を始める前に、しばらく待たなければ + なりません。単にログを交替させて、ディスクの節約のために古いログを + 圧縮する普通のシナリオは:</p> + + <div class="example"><p><code> + mv access_log access_log.old<br /> + mv error_log error_log.old<br /> + apachectl graceful<br /> + sleep 600<br /> + gzip access_log.old error_log.old + </code></p></div> + + <p>ログの交替をするもう一つの方法は<a href="#piped">パイプ経由のログ</a>を使うもので、次の節で説明されています。</p> + </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="piped" id="piped">パイプ経由のログ</a></h2> + + + <p>Apache httpd はエラーログとアクセスログをファイルに直接書く代わりに、 + パイプを通して別のプログラムに書き出すことができます。 + この機能により、主サーバにコードを追加することなく + ロギングの柔軟性が非常に高まっています。パイプにログを書くためには、 + 単にファイル名をパイプ文字 "<code>|</code>" に置き換え、その続きに + 標準入力からログのエントリを受けとる実行プログラムの名前を書くだけです。 + Apache はパイプ経由のログ用のプロセスをサーバの起動時に実行し、 + サーバの実行中にそのプログラムがクラッシュしたときはそれを再び + 実行します。(この最後の機能がこの技術が「信頼性のあるパイプ経由のロギング」 + と呼ばれている理由です。)</p> + + <p>パイプ経由のログ用のプロセスは Apache httpd の親プロセスから起動され、 + そのプロセスのユーザ ID を継承します。これは、パイプ経由のログ用の + プログラムは普通 root として実行されることを意味します。 + ですから、プログラムを簡単で安全に保つことが非常に重要です。</p> + + <p>パイプ経由のログの重要な利用法は、サーバの再起動なしでログの交替を + することです。Apache HTTP サーバにはこのための <code class="program"><a href="./programs/rotatelogs.html">rotatelogs</a></code> と呼ばれる簡単な + プログラムが付属しています。たとえば、24 時間毎にログを交替させるには、 + 以下のものを使うことができます:</p> + + <div class="example"><p><code> + CustomLog "|/usr/local/apache/bin/rotatelogs + /var/log/access_log 86400" common + </code></p></div> + + <p>パイプの先で呼ばれるコマンド全体が引用符で囲まれていることに注目して + ください。この例はアクセスログを使っていますが、エラーログにも同じ技術を + 使うことができます。</p> + + <p>似ているけれど、よりずっと柔軟な + <a href="http://www.cronolog.org/">cronolog</a> というログ交替用の + プログラムが外部のサイトにあります。</p> + + <p>条件付きロギングと同様、パイプ経由のログは非常に強力な + 道具ですが、オフラインの後処理のような、より簡単な解決方法があるときは + 使わない方が良いでしょう。</p> + </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="virtualhosts" id="virtualhosts">バーチャルホスト</a></h2> + + + <p>多くの <a href="vhosts/">バーチャルホスト</a> のあるサーバを実行している + ときは、ログファイルの扱い方にいくつかの方法があります。 + まず、単独のホストのみのサーバとまったく同じようにログを使うことができます。 + ロギングディレクティブを主サーバのコンテキストの + <code class="directive"><a href="./mod/core.html#virtualhost"><VirtualHost></a></code> セクションの外に置くことで、 + すべてのログを同じアクセスログとエラーログにログ収集することができます。 + この手法では個々のバーチャルホストの統計を簡単にとることはできません。</p> + + <p><code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code> や + <code class="directive"><a href="./mod/mod_log_config.html#errorlog">ErrorLog</a></code> ディレクティブが + <code class="directive"><a href="./mod/core.html#virtualhost"><VirtualHost></a></code> の中に + 置かれた場合は、そのバーチャル + ホストへのすべてのリクエストやエラーがそこで指定されたファイルにのみ + ログ収集されます。ロギングディレクティブのないバーチャルホストは + 依然としてリクエストが主サーバのログに送られます。この手法は少ない + バーチャルホストに対しては非常に有用ですが、ホストの数が非常に多くなると + 管理が大変になります。さらに、<a href="vhosts/fd-limits.html">ファイル記述子の限界</a>の問題を起こすことが + あります。</p> + + <p>アクセスログには、非常に良い妥協案があります。バーチャルホストの + 情報をログのフォーマット文字列に加えることで、すべてのホストへの + リクエストを同じログにログ収集して、後でログを個々のファイルに分割することが + できます。たとえば、以下のディレクティブを見てください。</p> + + <div class="example"><p><code> + LogFormat "%v %l %u %t \"%r\" %>s %b" + comonvhost<br /> + CustomLog logs/access_log comonvhost + </code></p></div> + + <p><code>%v</code> がリクエストを扱っているバーチャルホストの名前を + ログ収集するために使われています。そして、<a href="programs/other.html">split-logfile</a> のようなプログラムを + 使ってアクセスログを後処理することで、 + バーチャルホスト毎のファイルにログを分割することができます。</p> + + <p>残念ながら、エラーログには同様の手法はありません。ですから、 + すべてのバーチャルホストを同じエラーログの中に混ぜるか、 + バーチャルホスト毎にエラーログを使うかを選ばなければなりません。</p> + </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="other" id="other">他のログファイル</a></h2> + + + <table class="related"><tr><th>関連モジュール</th><th>関連ディレクティブ</th></tr><tr><td><ul><li><code class="module"><a href="./mod/mod_logio.html">mod_logio</a></code></li><li><code class="module"><a href="./mod/mod_log_forensic.html">mod_log_forensic</a></code></li><li><code class="module"><a href="./mod/mod_cgi.html">mod_cgi</a></code></li><li><code class="module"><a href="./mod/mod_rewrite.html">mod_rewrite</a></code></li></ul></td><td><ul><li><code class="directive"><a href="./mod/mod_log_config.html#logformat">LogFormat</a></code></li><li><code class="directive"><a href="./mod/mod_log_forensic.html#forensiclog">ForensicLog</a></code></li><li><code class="directive"><a href="./mod/mpm_common.html#pidfile">PidFile</a></code></li><li><code class="directive"><a href="./mod/mod_rewrite.html#rewritelog">RewriteLog</a></code></li><li><code class="directive"><a href="./mod/mod_rewrite.html#rewriteloglevel">RewriteLogLevel</a></code></li><li><code class="directive"><a href="./mod/mod_cgi.html#scriptlog">ScriptLog</a></code></li><li><code class="directive"><a href="./mod/mod_cgi.html#scriptlogbuffer">ScriptLogBuffer</a></code></li><li><code class="directive"><a href="./mod/mod_cgi.html#scriptloglength">ScriptLogLength</a></code></li></ul></td></tr></table> + + <h3>実際に送受信したバイト数のログ</h3> + + + <p><code class="module"><a href="./mod/mod_logio.html">mod_logio</a></code> は、 + ネットワーク上で実際に送受信した数をログする + 二つのフィールド (%I と %O) を + <code class="directive"><a href="./mod/mod_log_config.html#logformat">LogFormat</a></code> + ディレクティブに追加します。</p> + + + <h3>Forensic ログ</h3> + + + <p><code class="module"><a href="./mod/mod_log_forensic.html">mod_log_forensic</a></code> はクライアントリクエストの + forensic ログを取ります。ログはリクエスト処理前と処理後に + 行われますので、1 リクエストに対して 2 行のログが出力されます。 + forensic ロガーはとても厳密でカスタマイズできません。 + デバッグやセキュリティ用のツールとして有効かもしれません。</p> + + + <h3><a name="pidfile" id="pidfile">PID ファイル</a></h3> + + + <p>起動時に、Apache は親 httpd プロセスのプロセス ID を + <code>logs/httpd.pid</code> に保存します。この + ファイル名は <code class="directive"><a href="./mod/mpm_common.html#pidfile">PidFile</a></code> ディレクティブを使って + 変更することができます。プロセス ID は管理者が親プロセスに + シグナルを送ることでデーモンを再起動したり終了させたりするときに + 使用します。Windows では、代わりに -k コマンドオプションを + 使ってください。詳しい情報は <a href="stopping.html">終了と + 再起動</a> のページを見てください。</p> + + + <h3><a name="scriptlog" id="scriptlog">スクリプトログ</a></h3> + + + <p>デバッグの補助のために、<code class="directive"><a href="./mod/mod_cgi.html#scriptlog">ScriptLog</a></code> ディレクティブは + CGI スクリプトの入力と出力を記録するようにできます。 + これはテスト用にのみ使用して、通常のサーバでは使用しないでください。 + 詳しい情報は <a href="mod/mod_cgi.html">mod_cgi の文書</a> にあります。</p> + + + <h3><a name="rewritelog" id="rewritelog">リライトログ</a></h3> + + + <p><code class="directive"><a href="./mod/mod_rewrite.html#mod_rewrite">mod_rewrite</a></code> の強力で + 複雑な機能を + 使っているときは、ほぼいつもデバッグを簡単にするために + <code class="directive"><a href="./mod/mod_rewrite.html#rewritelog">RewriteLog</a></code> の使用が + 必要でしょう。このログファイルにはリライトエンジンがリクエストを + 書き換える方法の詳細な解析が出力されます。詳しさの度合は <code class="directive"><a href="./mod/mod_rewrite.html#rewriteloglevel">RewriteLogLevel</a></code> + で制御できます。</p> + + </div></div> +<div class="bottomlang"> +<p><span>翻訳済み言語: </span><a href="./en/logs.html" hreflang="en" rel="alternate" title="English"> en </a> | +<a href="./fr/logs.html" hreflang="fr" rel="alternate" title="Français"> fr </a> | +<a href="./ja/logs.html" title="Japanese"> ja </a> | +<a href="./ko/logs.html" hreflang="ko" rel="alternate" title="Korean"> ko </a> | +<a href="./tr/logs.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p> +</div><div class="top"><a href="#page-header"><img src="./images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">コメント</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div> +<script type="text/javascript"><!--//--><![CDATA[//><!-- +var comments_shortname = 'httpd'; +var comments_identifier = 'http://httpd.apache.org/docs/2.4/logs.html'; +(function(w, d) { + if (w.location.hostname.toLowerCase() == "httpd.apache.org") { + d.write('<div id="comments_thread"><\/div>'); + var s = d.createElement('script'); + s.type = 'text/javascript'; + s.async = true; + s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier; + (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s); + } + else { + d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>'); + } +})(window, document); +//--><!]]></script></div><div id="footer"> +<p class="apache">Copyright 2019 The Apache Software Foundation.<br />この文書は <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a> のライセンスで提供されています。.</p> +<p class="menu"><a href="./mod/">モジュール</a> | <a href="./mod/directives.html">ディレクティブ</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="./glossary.html">用語</a> | <a href="./sitemap.html">サイトマップ</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!-- +if (typeof(prettyPrint) !== 'undefined') { + prettyPrint(); +} +//--><!]]></script> +</body></html>
\ No newline at end of file diff --git a/docs/manual/logs.html.ko.euc-kr b/docs/manual/logs.html.ko.euc-kr new file mode 100644 index 0000000..0e32574 --- /dev/null +++ b/docs/manual/logs.html.ko.euc-kr @@ -0,0 +1,550 @@ +<?xml version="1.0" encoding="EUC-KR"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" lang="ko" xml:lang="ko"><head> +<meta content="text/html; charset=EUC-KR" http-equiv="Content-Type" /> +<!-- + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + This file is generated from xml source: DO NOT EDIT + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + --> +<title>α - Apache HTTP Server Version 2.4</title> +<link href="./style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" /> +<link href="./style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" /> +<link href="./style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="./style/css/prettify.css" /> +<script src="./style/scripts/prettify.min.js" type="text/javascript"> +</script> + +<link href="./images/favicon.ico" rel="shortcut icon" /></head> +<body id="manual-page"><div id="page-header"> +<p class="menu"><a href="./mod/"></a> | <a href="./mod/directives.html">þ</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="./glossary.html"></a> | <a href="./sitemap.html">Ʈ</a></p> +<p class="apache">Apache HTTP Server Version 2.4</p> +<img alt="" src="./images/feather.png" /></div> +<div class="up"><a href="./"><img title="<-" alt="<-" src="./images/left.gif" /></a></div> +<div id="path"> +<a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="./">Version 2.4</a></div><div id="page-content"><div id="preamble"><h1>α</h1> +<div class="toplang"> +<p><span> : </span><a href="./en/logs.html" hreflang="en" rel="alternate" title="English"> en </a> | +<a href="./fr/logs.html" hreflang="fr" rel="alternate" title="Français"> fr </a> | +<a href="./ja/logs.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> | +<a href="./ko/logs.html" title="Korean"> ko </a> | +<a href="./tr/logs.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p> +</div> +<div class="outofdate"> ֽ ƴմϴ. + ֱٿ ϼ.</div> + + <p>ȿ Ϸ ϴ Բ + Ȱ ɿ ˾ƾ Ѵ. ġ ſ ̰ + α Ѵ. α ϴ + α Ѵ.</p> + </div> +<div id="quickview"><a href="https://www.apache.org/foundation/contributing.html" class="badge"><img src="https://www.apache.org/images/SupportApache-small.png" alt="Support Apache!" /></a><ul id="toc"><li><img alt="" src="./images/down.gif" /> <a href="#security"> </a></li> +<li><img alt="" src="./images/down.gif" /> <a href="#errorlog"> α (Error Log)</a></li> +<li><img alt="" src="./images/down.gif" /> <a href="#accesslog"> α (Access Log)</a></li> +<li><img alt="" src="./images/down.gif" /> <a href="#rotation">α ȯ (Log Rotation)</a></li> +<li><img alt="" src="./images/down.gif" /> <a href="#piped">α </a></li> +<li><img alt="" src="./images/down.gif" /> <a href="#virtualhost">ȣƮ</a></li> +<li><img alt="" src="./images/down.gif" /> <a href="#other">ٸ α</a></li> +</ul><h3></h3><ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div> +<div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="security" id="security"> </a></h2> + + + <p> ġ α ִ 丮 + ִٸ ( root) ϴ uid Ȯ + ִ. ̸ ʰ αװ 丮 + <em></em>. ڼ <a href="misc/security_tips.html"> </a> ϶.</p> + + <p>, Ŭ̾Ʈ αϿ ״ + ϵȴ. ǰ ִ Ŭ̾Ʈ αϿ ڸ + Ƿ, α ٷ궧 ؾ Ѵ.</p> + </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="errorlog" id="errorlog"> α (Error Log)</a></h2> + + + <table class="related"><tr><th>õ </th><th>õ þ</th></tr><tr><td /><td><ul><li><code class="directive"><a href="./mod/core.html#errorlog">ErrorLog</a></code></li><li><code class="directive"><a href="./mod/core.html#loglevel">LogLevel</a></code></li></ul></td></tr></table> + + <p><code class="directive"><a href="./mod/core.html#errorlog">ErrorLog</a></code> þ + ߿ α α ̸ ġ Ѵ. + ġ Ͽ û óϴ + Ѵ. ϰų ϴµ + ִٸ ߸Ǿ ġ ˷ִ + ̰ Ѵ.</p> + + <p> α״ ( н ýۿ + <code>error_log</code>, OS/2 + <code>error.log</code>) Ͽ ϵȴ. н ýۿ + <code>syslog</code> <a href="#piped"> + Ͽ ٸ α</a> ִ.</p> + + <p> α Ӱ ڼϴ. + κ α ִ. + , .</p> + + <div class="example"><p><code> + [Wed Oct 11 14:32:52 2000] [error] [client 127.0.0.1] + client denied by server configuration: + /export/home/live/ap/htdocs/test + </code></p></div> + + <p>α ù° ¥ ð̴. ι° + ϴ ɰ Ÿ. <code class="directive"><a href="./mod/core.html#loglevel">LogLevel</a></code> þ α + ϵǴ ɰ ִ. ° + Ŭ̾Ʈ IP ̴ּ. + , Ŭ̾Ʈ źϵ + Ǿٰ ִ. û ( ΰ ƴ) + Ͻý ε δ.</p> + + <p> α ſ پ ִ. + κ ϴ. CGI ũƮ µ + α ϵȴ. CGI ũƮ <code>stderr</code> + ״ α ȴ.</p> + + <p> α ߰ϰ . + û α <a href="#accesslog"> + α</a> ϴ . , + ڵ尡 403 α . α״ + Ƿ Ͽ Ȳ + ߰ ִ.</p> + + <p>˻Ҷ α 캸 + . н ýۿ Ѵ:</p> + + <div class="example"><p><code> + tail -f error_log + </code></p></div> + </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="accesslog" id="accesslog"> α (Access Log)</a></h2> + + + <table class="related"><tr><th>õ </th><th>õ þ</th></tr><tr><td><ul><li><code class="module"><a href="./mod/mod_log_config.html">mod_log_config</a></code></li><li><code class="module"><a href="./mod/mod_setenvif.html">mod_setenvif</a></code></li></ul></td><td><ul><li><code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code></li><li><code class="directive"><a href="./mod/mod_log_config.html#logformat">LogFormat</a></code></li><li><code class="directive"><a href="./mod/mod_setenvif.html#setenvif">SetEnvIf</a></code></li></ul></td></tr></table> + + <p> α״ óϴ û Ѵ. + <code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code> + þ α ġ Ѵ. <code class="directive"><a href="./mod/mod_log_config.html#logformat">LogFormat</a></code> þ + Ͽ α ִ. + α ϴ Ѵ.</p> + + <p> α ϴ α + ̴. ܰ мϿ 踦 + ̴. Ϲ α м ؼ ٷ , + α м ƴϴ. α м + α мϴ Ʈ ؼ <a href="http://dmoz.org/Computers/Software/Internet/Site_Management/Log_Analysis/">Open Directory</a> + ϶.</p> + + <p>ġ mod_log_referer, mod_log_agent, + <code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code> + þ Ͽ α ٷ. + <code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code> + þ þ ̾Ҵ.</p> + + <p> α ſ ϴ. C + printf(1) Ĺڿ ſ Ĺڿ Ͽ + Ѵ. . Ĺڿ 밡 + ˷ <code class="module"><a href="./mod/mod_log_config.html">mod_log_config</a></code> <a href="mod/mod_log_config.html#formats">Ĺڿ</a> + ϶.</p> + + <h3><a name="common" id="common">Common α </a></h3> + + + <p> α .</p> + + <div class="example"><p><code> + LogFormat "%h %l %u %t \"%r\" %>s %b" common<br /> + CustomLog logs/access_log common + </code></p></div> + + <p> α Ĺڿ <em></em> + <code>common</code> Ѵ. Ĺڿ ۼƮ + þ Ǹ, ˸. + Ĺڿ Ϲ ڸ ״ α µȴ. + ǥ (<code>"</code>) ϰ ʹٸ 齽 + տ ٿ Ĺڿ ƴ ǥѴ. Ĺڿ + ٹٲ "<code>\n</code>", "<code>\t</code>" + Ư ڸ ִ.</p> + + <p><code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code> + þ <em></em> ϴ ο α + . α ϸ + <code class="directive"><a href="./mod/core.html#serverroot">ServerRoot</a></code> ̴.</p> + + <p> α(Common Log Format, CLF)̶ + α Ѵ. ٸ 鵵 ̷ + ǥ α , α м α + ִ. CLF α :</p> + + <div class="example"><p><code> + 127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET + /apache_pb.gif HTTP/1.0" 200 2326 + </code></p></div> + + <p> α κ Ѵ.</p> + + <dl> + <dt><code>127.0.0.1</code> (<code>%h</code>)</dt> + + <dd> û Ŭ̾Ʈ( ȣƮ) IP + ̴ּ. <code class="directive"><a href="./mod/core.html#hostnamelookups">HostnameLookups</a></code> + <code>On</code>̶ ȣƮ ãƼ IP ּ ڸ + . ſ + Ƿ õ ʴ´. ȣƮ ˷ ߿ + <a href="programs/logresolve.html">logresolve</a> + α óϴ α ϴ . + IP ּҴ ڰ ϴ ǻ ּҰ + ƴ ִ. Ͻ ڿ ̿ Ѵٸ, + ǻ ּҰ ƴ϶ Ͻ ּҰ ϵ ̴.</dd> + + <dt><code>-</code> (<code>%l</code>)</dt> + + <dd>¿ "ȣ" û Ÿ. + Ŭ̾Ʈ ǻ + <code>identd</code> Ŭ̾Ʈ RFC 1413 + ſ̴. ſ , + Ǵ Ʈ ƴ϶ ϸ + ȵȴ. <code class="directive"><a href="./mod/core.html#identitycheck">IdentityCheck</a></code> + <code>On</code> ƴ϶ ġ + ˾ƺ õ ʴ´.</dd> + + <dt><code>frank</code> (<code>%u</code>)</dt> + + <dd>̴ HTTP ˾Ƴ û + userid̴. CGI ũƮ + <code>REMOTE_USER</code> ȯ溯 Ѱ. û + ڵ尡 401̶ (Ʒ ) ڰ + ġ ʾǷ ȵȴ. ȣ + ȣ ʴ´ٸ + "<code>-</code>"̴.</dd> + + <dt><code>[10/Oct/2000:13:55:36 -0700]</code> + (<code>%t</code>)</dt> + + <dd> + ûó ģ ð. + : + + <p class="indent"> + <code>[day/month/year:hour:minute:second zone]<br /> + day = 2<br /> + month = 3<br /> + year = 4<br /> + hour = 2<br /> + minute = 2<br /> + second = 2<br /> + zone = (`+' | `-') 4</code> + </p> + α Ĺڿ <code>%{format}t</code> Ͽ + ٸ ð ִ. <code>format</code> + C ǥ ̺귯 <code>strftime(3)</code> . + </dd> + + <dt><code>"GET /apache_pb.gif HTTP/1.0"</code> + (<code>\"%r\"</code>)</dt> + + <dd>Ŭ̾Ʈ û ֵǥ ִ. û + ſ ִ. ù°, Ŭ̾Ʈ + <code>GET</code>̴. °, Ŭ̾Ʈ ڿ + <code>/apache_pb.gif</code> ûѴ. °, Ŭ̾Ʈ + <code>HTTP/1.0</code> Ѵ. û + κ α ִ. , Ĺڿ + "<code>%m %U%q %H</code>" "<code>%r</code>" Ȱ + , , ǹڿ, αѴ.</dd> + + <dt><code>200</code> (<code>%>s</code>)</dt> + + <dd>̴ Ŭ̾Ʈ ڵ̴. + (2 ϴ ڵ) û Ͽ, (4 + ϴ ڵ) Ŭ̾Ʈ ִ, (5 ϴ + ڵ) ִ ˷ֹǷ ſ ߿ϴ. + ڵ ü <a href="http://www.w3.org/Protocols/rfc2616/rfc2616.txt">HTTP + Ծ</a> (RFC2616 section 10) ã ִ.</dd> + + <dt><code>2326</code> (<code>%b</code>)</dt> + + <dd> ϰ Ŭ̾Ʈ + ũ⸦ Ÿ. Ŭ̾Ʈ + ٸ "<code>-</code>"̴. + "<code>0</code>" αϷ + <code>%B</code> Ѵ.</dd> + </dl> + + + <h3><a name="combined" id="combined">Combined α </a></h3> + + + <p> Ǵ ٸ Ĺڿ յȷα(Combined + Log Format)̴. Ѵ.</p> + + <div class="example"><p><code> + LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" + \"%{User-agent}i\"" combined<br /> + CustomLog log/access_log combined + </code></p></div> + + <p> ߰ ϰ Common + α İ . ߰ ۼƮ þ + <code>%{<em>header</em>}i</code> Ѵ. ⼭ + <em>header</em> ڸ HTTP û ̸ + ִ. α״ :</p> + + <div class="example"><p><code> + 127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET + /apache_pb.gif HTTP/1.0" 200 2326 + "http://www.example.com/start.html" "Mozilla/4.08 [en] + (Win98; I ;Nav)" + </code></p></div> + + <p>߰ :</p> + + <dl> + <dt><code>"http://www.example.com/start.html"</code> + (<code>\"%{Referer}i\"</code>)</dt> + + <dd>"Referer" ( Ʋʾ) HTTP û . + Ŭ̾Ʈ ߴٰ ˸ Ʈ̴. + (, <code>/apache_pb.gif</code> ũϿų + Ʈ̴.)</dd> + + <dt><code>"Mozilla/4.08 [en] (Win98; I ;Nav)"</code> + (<code>\"%{User-agent}i\"</code>)</dt> + + <dd>User-Agent HTTP û . Ŭ̾Ʈ + ڽſ ˸ ĺ̴.</dd> + </dl> + + + <h3><a name="multiple" id="multiple"> α</a></h3> + + + <p>Ͽ <code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code> þ + ϸ αװ . , + α . ù° ⺻ CLF + ϰ, ι° ° referer + Ѵ. <code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code> + <code>ReferLog</code> <code>AgentLog</code> þ + 䳻 ִ ش.</p> + + <div class="example"><p><code> + LogFormat "%h %l %u %t \"%r\" %>s %b" common<br /> + CustomLog logs/access_log common<br /> + CustomLog logs/referer_log "%{Referer}i -> %U"<br /> + CustomLog logs/agent_log "%{User-agent}i" + </code></p></div> + + <p>, <code class="directive"><a href="./mod/mod_log_config.html#logformat">LogFormat</a></code> ݵ + ʿ ش. <code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code> þ + α ִ.</p> + + + <h3><a name="conditional" id="conditional">Ǻ α</a></h3> + + + <p>Ŭ̾Ʈ û ݿ ش α + ʰ ִ. <a href="env.html">ȯ溯</a> + ϸ ذȴ. , Ŭ̾Ʈ Ư + ϸ ȯ溯 Ѵ. ۾ <code class="directive"><a href="./mod/mod_setenvif.html#setenvif">SetEnvIf</a></code> Ѵ. + <code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code> + þ <code>env=</code> Ͽ ȯ溯 + û ְų . :</p> + + <div class="example"><p><code> + # loop-back ̽ û ǥѴ<br /> + SetEnvIf Remote_Addr "127\.0\.0\.1" dontlog<br /> + # robots.txt Ͽ û ǥѴ<br /> + SetEnvIf Request_URI "^/robots\.txt$" dontlog<br /> + # α <br /> + CustomLog logs/access_log common env=!dontlog + </code></p></div> + + <p>ٸ û αϿ ϰ, + û ٸ αϿ ϴ 츦 + غ.</p> + + <div class="example"><p><code> + SetEnvIf Accept-Language "en" english<br /> + CustomLog logs/english_log common env=english<br /> + CustomLog logs/non_english_log common env=!english + </code></p></div> + + <p>Ǻ α״ ſ ϰ , ̰ α + ϴ ƴϴ. α + ൿ Ҷ ϴ. ߿ ʴ û + ϰ α мϴ .</p> + + </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="rotation" id="rotation">α ȯ (Log Rotation)</a></h2> + + + <p> ٻ αϿ Ǵ ſ + . α״ û 1MB ̻ Ѵ. + α űų α ֱ + Ȱ ʿ䰡 ִ. ġ ִ ȿ + αϿ ϶ α ȯ + . α űų <a href="stopping.html"></a>Ͽ, α + Ѵ.</p> + + <p><em></em> ϸ Ŭ̾Ʈ + Ȥ ʰ α ִ. + ̸ û + α ؾ Ѵ. Ƿ + α óϱ ٸ ʿ䰡 ִ. Ϲ + α ȯϰ, ũ ϱ + α Ѵ:</p> + + <div class="example"><p><code> + mv access_log access_log.old<br /> + mv error_log error_log.old<br /> + apachectl graceful<br /> + sleep 600<br /> + gzip access_log.old error_log.old + </code></p></div> + + <p>α ȯϴ ٸ <a href="#piped"> α</a> ϴ ̴.</p> + </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="piped" id="piped">α </a></h2> + + + <p>ġ α α Ͽ + ʰ ٸ μ ִ. + ϸ ڵ带 ߰ʰ ſ ϰ + α ó ִ. α ϸ + ڸ "<code>|</code>" ڿ ǥԷ + α ϸ ȴ. ġ + Ҷ α μ ϰ, + Ǵ μ ٽ Ѵ. ( + ɶ 츮 " ִ α" + θ.)</p> + + <p> α μ θ ġ httpd μ + , μ userid . , α + α root ȴ. Ƿ α ϰ + ϰ ſ ߿ϴ.</p> + + <p> θ ü ɾ ǥ ϶. + α , α .</p> + + <p> ʰ α ȯ ִ + α ϴ ߿ . ġ ̸ + <a href="programs/rotatelogs.html">rotatelogs</a> + α Ѵ. 24ð α ȯѴٸ:</p> + + <div class="example"><p><code> + CustomLog "|/usr/local/apache/bin/rotatelogs + /var/log/access_log 86400" common + </code></p></div> + + <p>ٸ Ʈ <a href="http://www.cronolog.org/">cronolog</a> + ξ α ȯ α ִ.</p> + + <p>Ǻ α α״ ſ , + ߿ óϴ ؼ + ȵȴ.</p> + </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="virtualhost" id="virtualhost">ȣƮ</a></h2> + + + <p> <a href="vhosts/">ȣƮ</a> ִ + Ҷ α ٷ ִ. , + ȣƮ Ѱ α ִ. <code class="directive"><a href="./mod/core.html#virtualhost"><VirtualHost></a></code> + ƴ ּ α þ θ û + α α ϵȴ. ȣƮ + ó .</p> + + <p><code class="directive"><a href="./mod/core.html#virtualhost"><VirtualHost></a></code> + ȿ <code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code> + <code class="directive"><a href="./mod/core.html#errorlog">ErrorLog</a></code> þ + ϸ ش ȣƮ û + Ͽ ϵȴ. α þ ٸ ȣƮ + ּ α α Ѵ. ȣƮ + ſ , ȣƮ ٸ ϱ + . , <a href="vhosts/fd-limits.html">ϱڰ + </a> Ѵ.</p> + + <p> α ſ ذå ִ. α Ĺڿ + ȣƮ ߰ϸ ȣƮ α + ϰ, ߿ α ȣƮ ִ. + , þ .</p> + + <div class="example"><p><code> + LogFormat "%v %l %u %t \"%r\" %>s %b" + comonvhost<br /> + CustomLog logs/access_log comonvhost + </code></p></div> + + <p><code>%v</code> û ϴ ȣƮ ̸ + Ѵ. ߿ <a href="programs/other.html">split-logfile</a> + α α ȣ ִ.</p> + </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="other" id="other">ٸ α</a></h2> + + + <table class="related"><tr><th>õ </th><th>õ þ</th></tr><tr><td><ul><li><code class="module"><a href="./mod/mod_cgi.html">mod_cgi</a></code></li><li><code class="module"><a href="./mod/mod_rewrite.html">mod_rewrite</a></code></li></ul></td><td><ul><li><code class="directive"><a href="./mod/mpm_common.html#pidfile">PidFile</a></code></li><li><code class="directive"><a href="./mod/mod_rewrite.html#rewritelog">RewriteLog</a></code></li><li><code class="directive"><a href="./mod/mod_rewrite.html#rewriteloglevel">RewriteLogLevel</a></code></li><li><code class="directive"><a href="./mod/mod_cgi.html#scriptlog">ScriptLog</a></code></li><li><code class="directive"><a href="./mod/mod_cgi.html#scriptlogbuffer">ScriptLogBuffer</a></code></li><li><code class="directive"><a href="./mod/mod_cgi.html#scriptloglength">ScriptLogLength</a></code></li></ul></td></tr></table> + + <h3><a name="pidfile" id="pidfile">PID </a></h3> + + + <p>ġ Ҷ <code>logs/httpd.pid</code> + Ͽ θ httpd μ process id Ѵ. + ϸ <code class="directive"><a href="./mod/mpm_common.html#pidfile">PidFile</a></code> + þ ִ. process-id ڰ θ μ + ñ׳ ϰų ϶ Ѵ. + -k ɼ Ѵ. ڼ + <a href="stopping.html">ߴܰ </a> + ϶.</p> + + + <h3><a name="scriptlog" id="scriptlog">ũƮ α</a></h3> + + + <p> <code class="directive"><a href="./mod/mod_cgi.html#scriptlog">ScriptLog</a></code> þ Ͽ + CGI ũƮ Է° ִ. þ + Ʈθ ؾ Ѵ. ϴ + ϸ ȵȴ. ڼ <a href="mod/mod_cgi.html">mod_cgi</a> ϶.</p> + + + <h3><a name="rewritelog" id="rewritelog">ۼ α</a></h3> + + + <p><a href="mod/mod_rewrite.html">mod_rewrite</a> ϰ + Ѵٸ <code class="directive"><a href="./mod/mod_rewrite.html#rewritelog">RewriteLog</a></code> ʿ䰡 + ִ. α ۼ û ȯϴ + ڼ ˷ش. ڼ <code class="directive"><a href="./mod/mod_rewrite.html#rewriteloglevel">RewriteLogLevel</a></code> þ + Ѵ.</p> + + </div></div> +<div class="bottomlang"> +<p><span> : </span><a href="./en/logs.html" hreflang="en" rel="alternate" title="English"> en </a> | +<a href="./fr/logs.html" hreflang="fr" rel="alternate" title="Français"> fr </a> | +<a href="./ja/logs.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> | +<a href="./ko/logs.html" title="Korean"> ko </a> | +<a href="./tr/logs.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p> +</div><div class="top"><a href="#page-header"><img src="./images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div> +<script type="text/javascript"><!--//--><![CDATA[//><!-- +var comments_shortname = 'httpd'; +var comments_identifier = 'http://httpd.apache.org/docs/2.4/logs.html'; +(function(w, d) { + if (w.location.hostname.toLowerCase() == "httpd.apache.org") { + d.write('<div id="comments_thread"><\/div>'); + var s = d.createElement('script'); + s.type = 'text/javascript'; + s.async = true; + s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier; + (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s); + } + else { + d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>'); + } +})(window, document); +//--><!]]></script></div><div id="footer"> +<p class="apache">Copyright 2019 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p> +<p class="menu"><a href="./mod/"></a> | <a href="./mod/directives.html">þ</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="./glossary.html"></a> | <a href="./sitemap.html">Ʈ</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!-- +if (typeof(prettyPrint) !== 'undefined') { + prettyPrint(); +} +//--><!]]></script> +</body></html>
\ No newline at end of file diff --git a/docs/manual/logs.html.tr.utf8 b/docs/manual/logs.html.tr.utf8 new file mode 100644 index 0000000..e989bd3 --- /dev/null +++ b/docs/manual/logs.html.tr.utf8 @@ -0,0 +1,685 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" lang="tr" xml:lang="tr"><head> +<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" /> +<!-- + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + This file is generated from xml source: DO NOT EDIT + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + --> +<title>Günlük Dosyaları - Apache HTTP Sunucusu Sürüm 2.4</title> +<link href="./style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" /> +<link href="./style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" /> +<link href="./style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="./style/css/prettify.css" /> +<script src="./style/scripts/prettify.min.js" type="text/javascript"> +</script> + +<link href="./images/favicon.ico" rel="shortcut icon" /></head> +<body id="manual-page"><div id="page-header"> +<p class="menu"><a href="./mod/">Modüller</a> | <a href="./mod/directives.html">Yönergeler</a> | <a href="http://wiki.apache.org/httpd/FAQ">SSS</a> | <a href="./glossary.html">Terimler</a> | <a href="./sitemap.html">Site Haritası</a></p> +<p class="apache">Apache HTTP Sunucusu Sürüm 2.4</p> +<img alt="" src="./images/feather.png" /></div> +<div class="up"><a href="./"><img title="<-" alt="<-" src="./images/left.gif" /></a></div> +<div id="path"> +<a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Sunucusu</a> > <a href="http://httpd.apache.org/docs/">Belgeleme</a> > <a href="./">Sürüm 2.4</a></div><div id="page-content"><div id="preamble"><h1>Günlük Dosyaları</h1> +<div class="toplang"> +<p><span>Mevcut Diller: </span><a href="./en/logs.html" hreflang="en" rel="alternate" title="English"> en </a> | +<a href="./fr/logs.html" hreflang="fr" rel="alternate" title="Français"> fr </a> | +<a href="./ja/logs.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> | +<a href="./ko/logs.html" hreflang="ko" rel="alternate" title="Korean"> ko </a> | +<a href="./tr/logs.html" title="Türkçe"> tr </a></p> +</div> + + <p>Bir HTTP sunucusunu verimli şekilde yönetebilmek için oluşabilecek + sorunlardan başka sunucunun başarımı ve etkinliği hakkında da bazı geri + bildirimler almak gerekir. Apache HTTP Sunucusu çok kapsamlı ve esnek + bir günlükleme yeteneğine sahiptir. Bu belgede sunucunun günlükleme + yeteneğini nasıl yapılandıracağınızdan ve günlük kayıtlarını nasıl + yorumlayacağınızdan bahsedilecektir.</p> + </div> +<div id="quickview"><a href="https://www.apache.org/foundation/contributing.html" class="badge"><img src="https://www.apache.org/images/SupportApache-small.png" alt="Support Apache!" /></a><ul id="toc"><li><img alt="" src="./images/down.gif" /> <a href="#overview">Giriş</a></li> +<li><img alt="" src="./images/down.gif" /> <a href="#security">Güvenlik Uyarısı</a></li> +<li><img alt="" src="./images/down.gif" /> <a href="#errorlog">Hata Günlüğü</a></li> +<li><img alt="" src="./images/down.gif" /> <a href="#permodule">Modüllere göre günlükleme</a></li> +<li><img alt="" src="./images/down.gif" /> <a href="#accesslog">Erişim Günlüğü</a></li> +<li><img alt="" src="./images/down.gif" /> <a href="#rotation">Günlük Çevrimi</a></li> +<li><img alt="" src="./images/down.gif" /> <a href="#piped">Borulu Günlükler</a></li> +<li><img alt="" src="./images/down.gif" /> <a href="#virtualhost">Sanal Konaklar</a></li> +<li><img alt="" src="./images/down.gif" /> <a href="#other">Diğer Günlük Dosyaları</a></li> +</ul><h3>Ayrıca bakınız:</h3><ul class="seealso"><li><a href="#comments_section">Yorum</a></li></ul></div> +<div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="overview" id="overview">Giriş</a></h2> + + + <table class="related"><tr><th>İlgili Modüller</th><th>İlgili Yönergeler</th></tr><tr><td><ul><li><code class="module"><a href="./mod/mod_log_config.html">mod_log_config</a></code></li><li><code class="module"><a href="./mod/mod_log_forensic.html">mod_log_forensic</a></code></li><li><code class="module"><a href="./mod/mod_logio.html">mod_logio</a></code></li><li><code class="module"><a href="./mod/mod_cgi.html">mod_cgi</a></code></li></ul></td><td /></tr></table> + + <p>Apache HTTP Sunucusu, isteğin ilk alınışından itibaren, URL eşleme + işlemleri, bağlantının son çözümlemesi ve bu işlemler sırasına ortaya çıkan + hatalar da dahil olmak üzere sunucunuzda meydana gelen herşeyi günlüklemek + için çok çeşitli mekanizmalar içerir. Buna ek olarak, günlükleme + yetenekleri sağlayan üçüncü parti modüller de kullanılabilir veya mevcut + günlük dosyalarına girdiler enjekte edilebilir. Ayrıca, CGI programları, + PHP betikleri ve benzerleri sunucu hata günlüğüne kendi iletilerini + gönderebilirler.</p> + + <p>Bu belgede Apache HTTP Sunucusunun standart parçası olan günlükleme + modülleri hakkında bilgi verilecektir.</p> + + </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="security" id="security">Güvenlik Uyarısı</a></h2> + + + <p>Apache httpd’nin günlük dosyalarını yazdığı dizine yazabilen birinin sunucuyu + başlatan kullanıcı kimliğine (bu genellikle root olur) erişim + kazanabileceğine hemen hemen kesin gözüyle bakılabilir. Sonuçlarının + neler olacağını kestiremiyorsanız günlüklerin yazıldığı dizinde <em>hiç + kimseye</em> yazma erişimi vermeyin; ayrıntılı bilgi için <a href="misc/security_tips.html">güvenlik ipuçları</a> belgesine + bakınız.</p> + + <p>Buna ilaveten, günlük dosyaları istemci tarafından sağlanmış bilgiler + de içerebilir. Bu nedenle, kötü niyetli istemcilerin günlük dosyalarına + denetim karakterleri girmeleri olasılığına karşı ham günlükler ele + alınırken dikkatli olunmalıdır.</p> + </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="errorlog" id="errorlog">Hata Günlüğü</a></h2> + + <table class="related"><tr><th>İlgili Modüller</th><th>İlgili Yönergeler</th></tr><tr><td><ul><li><code class="module"><a href="./mod/core.html">core</a></code></li></ul></td><td><ul><li><code class="directive"><a href="./mod/core.html#errorlog">ErrorLog</a></code></li><li><code class="directive"><a href="./mod/core.html#errorlogformat">ErrorLogFormat</a></code></li><li><code class="directive"><a href="./mod/core.html#loglevel">LogLevel</a></code></li></ul></td></tr></table> + + <p>İsmi ve yeri <code class="directive"><a href="./mod/core.html#errorlog">ErrorLog</a></code> yönergesi + ile belirtilen sunucu hata günlüğü, en önemli günlük dosyasıdır. Apache + httpd tarafından istekler işlenirken saptanan hatalar ve tanı bilgileri + bu dosyaya gönderilir. Sunucuyu başlatırken veya sunucu çalışırken bir + sorunla karşılaşıldığında, neyin yanlış gittiğini öğrenmek için + bakılacak ilk yer burasıdır. Günlük kaydı çoğunlukla sorunun nasıl + düzeltileceği ile ilgili ayrıntıları da içerir.</p> + + <p>Hata günlüğü normal olarak bir dosyaya yazılır (genellikle, dosyanın + ismi Unix sistemlerinde <code>error_log</code>, OS/2 ve Windows’ta ise + <code>error.log</code>’dur). Ayrıca, Unix sistemlerinde sunucunun + hataları <code>syslog</code>’a veya <a href="#piped">borulamak suretiyle + bir programa</a> aktarması da mümkündür.</p> + + <p>Hata günlüğünün biçemi <code class="directive"><a href="./mod/core.html#errorlogformat">ErrorLogFormat</a></code> yönergesi ile belirlenir. Bu yönergeyi + kullanarak günlüklenen değerleri özelleştirebilirsiniz. Bir biçem + belirtmezseniz öntanımlı biçem kullanılır. Örnek tipik bir hata iletisi + içermektedir:</p> + + <div class="example"><p><code> + [Fri Sep 09 10:42:29.902022 2011] [core:error] [pid 35708:tid 4328636416] + [client 72.15.99.187] Dosya yok: /usr/local/apache2/htdocs/favicon.ico + </code></p></div> + + <p>Günlük girdisinin ilk öğesi iletinin yazıldığı tarih ve saatten oluşur. + İkincisi iletiyi üreten modülün ismi (bu durumda: core) ile raporlanan + bilginin önem derecesini belirtir. Bunu varsa sürecin kimliği ve yine + varsa evre kimliği izler. Sonraki öğe hatanın üretilmesine sebep olan + istemcinin IP adresini içerir. Kalanı iletinin kendisidir (duruma + bakılırsa bir dosyaya yapılan istek yerine getirilememiş).</p> + + <p>Hata günlüğünde görünebilecek ileti çeşitliliği oldukça fazladır. Çoğu + yukarıdaki örneğin benzeridir. Hata günlüğü ayrıca, CGI betiklerinin + hata ayıklama çıktılarını da içerir. Bir CGI betiği tarafından standart + hataya (<code>stderr</code>) yazılan her türlü bilgi doğrudan hata + günlüğüne kopyalanır.</p> + + <p>Hata günlüğüne ve erişim günlüğüne <code>%L</code> dizgeciği konularak + erişim günlüğündeki girdi ile hata günlüğündeki girdiyi ilişkilendirecek + bir günlük girdisi kimliği oluşturulabilir. + <code class="module"><a href="./mod/mod_unique_id.html">mod_unique_id</a></code> yüklüyse günlük girdisi kimliği olarak + onun eşsiz istek kimliği de kullanılır.</p> + + <p>Sunucuyu denerken olası sorunlara karşı hata günlüğünü sürekli + izlemelisiniz. Unix sistemlerinde bunu şöyle bir komutla + sağlayabilirsiniz:</p> + + <div class="example"><p><code> + tail -f error_log + </code></p></div> + </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="permodule" id="permodule">Modüllere göre günlükleme</a></h2> + + + <p><code class="directive"><a href="./mod/core.html#loglevel">LogLevel</a></code> yönergesi, günlük + iletisinin üretilmesine sebep olan modüle bağlı bir önem seviyesi + belirleyebilmenizi sağlar. Bu yolla sorun yaşadığınız modülle ilgili + günlük musluklarını sonuna kadar açabiliri ek olarak ilgilendiğiniz diğer + modüllerle ilgili ayrıntıları da edinebilirsiniz. Özellikle + <code class="module"><a href="./mod/mod_proxy.html">mod_proxy</a></code> veya <code class="module"><a href="./mod/mod_rewrite.html">mod_rewrite</a></code> gibi + modüllerde yapılmak isteneni denerken neler olup bittiğini ayrıntılarıyla + bilmek istediğiniz durumlarda kullanışlıdır.</p> + + <p>Bunu <code class="directive">LogLevel</code> yönergesinde modülün ismini + belirterek yapabilirsiniz:</p> + + <pre class="prettyprint lang-config">LogLevel info rewrite:trace5</pre> + + + <p>Bu satırla ana <code class="directive">LogLevel</code> info'ya ayarlanırken + <code class="module"><a href="./mod/mod_rewrite.html">mod_rewrite</a></code> için musluk <code>trace5</code> seviyesine + kadar açılmaktadır.</p> + + <div class="note">Bu yönerge, Apache HTTP Sunucusunun evvelki sürümlerinde mevcut olan + <code>RewriteLog</code> gibi günlükleme modüllerinin yerini almıştır. + </div> + </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="accesslog" id="accesslog">Erişim Günlüğü</a></h2> + + + <table class="related"><tr><th>İlgili Modüller</th><th>İlgili Yönergeler</th></tr><tr><td><ul><li><code class="module"><a href="./mod/mod_log_config.html">mod_log_config</a></code></li><li><code class="module"><a href="./mod/mod_setenvif.html">mod_setenvif</a></code></li></ul></td><td><ul><li><code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code></li><li><code class="directive"><a href="./mod/mod_log_config.html#logformat">LogFormat</a></code></li><li><code class="directive"><a href="./mod/mod_setenvif.html#setenvif">SetEnvIf</a></code></li></ul></td></tr></table> + + <p>Sunucu erişim günlüğü sunucu tarafından işleme alınan tüm istekleri + kaydeder. Erişim günlüğünün yeri ve içeriği <code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code> yönergesi ile belirlenir. + <code class="directive"><a href="./mod/mod_log_config.html#logformat">LogFormat</a></code> yönergesi ile + günlük içeriğini kişiselleştirmek mümkündür. Bu bölümde sunucunun + bilgileri erişim günlüğüne kaydetmesi için nasıl yapılandırılacağından + bahsedilecektir.</p> + + <p>Şüphesiz, bilginin erişim günlüğünde saklanması günlük yönetiminde ilk + adımı oluşturur. Sonraki adım yararlı istatistikleri üretmek için bu + bilgiyi incelemektir. Günlük incelemesi bu belgenin kapsamına dahil + değildir ve aslında bu işlem sunucunun yaptığı işlerden biri değildir. + Bu konu ve günlük incelemesi yapan uygulamalar hakkında daha ayrıntılı + bilgi edinmek için <a href="http://dmoz.org/Computers/Software/Internet/Site_Management/Log_Analysis/">dmoz.org</a>'a bakınız.</p> + + <p>Apache httpd’nin çeşitli sürümlerinde erişim günlüklerini denetlemek + için kullanılan diğer modüller ve yönergeler arasında mod_log_referer, + mod_log_agent modülleri ve <code>TransferLog</code> yönergesi + sayılabilir. Artık, daha eski tüm diğer yönergelerin işlevselliklerini + bir araya toplayan <code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code> yönergesi kullanılmaktadır.</p> + + <p>Erişim günlüğünün girdi biçemi kolayca isteğe göre + düzenlenebilmektedir. Biçemi belirtmekte kullanılan biçem dizgesi, C + tarzı printf(1) biçem dizgesini andırır. Sonraki bölümlerde bazı + örneklere yer verilmiştir. Biçem dizgesini oluşturan belirteçlerin tam + listesi için <code class="module"><a href="./mod/mod_log_config.html">mod_log_config</a></code> belgesinin <a href="mod/mod_log_config.html#formats">Günlük Girdilerinin + Kişiselleştirilmesi</a> bölümüne bakınız.</p> + + <h3><a name="common" id="common">Ortak Günlük Biçemi (OGB)</a></h3> + + + <p>Erişim günlüğü için sıklıkla kullanılan bir yapılandırma:</p> + + <pre class="prettyprint lang-config">LogFormat "%h %l %u %t \"%r\" %>s %b" common +CustomLog logs/access_log common</pre> + + + <p>İlk satırda belli bir biçem dizgesi için <code>common</code> diye bir + <em>takma ad</em> tanımlanmaktadır. Biçem dizgesi, sunucuya hangi + belli bir bilgi parçalarını günlükleyeceğini söyleyen % imli biçem + belirteçlerinden oluşur. Biçem dizgesine ayrıca dizgesel sabitler de + yerleştirilebilir ve bunlar erişim günlüğüne oldukları gibi + kopyalanırlar. Biçem dizgesi içinde çift tırnak karakteri (") biçem + dizgesini vaktinden önce sonlandırmaması için ters bölü çizgisi ile + öncelenmelidir. Biçem dizgesi ayrıca, satır sonlarını belirtmek için + "<code>\n</code>" ve sekmeleri belirtmek için "<code>\t</code>" + denetim karakterlerini de içerebilir.</p> + + <p><code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code> yönergesi + evvelce tanımlanmış bir <em>takma adı</em> kullanarak yeni bir günlük + dosyası tanımlar. Erişim günlüğünün dosya ismi bölü çizgisi ile + başlamadıkça dosya yolunun <code class="directive"><a href="./mod/core.html#serverroot">ServerRoot</a></code> değerine göreli olduğu varsayılır.</p> + + <p>Yukarıdaki yapılandırma günlük dosyasına girdileri Ortak Günlük + Biçemi (Common Log Format) adı verilen standart biçemde yazar. + Bu standart biçem başka HTTP sunucuları tarafından da kullanılır ve + çoğu günlük inceleme yazılımı tarafından tanınır. Ortak Günlük + Biçeminde üretilen günlük girdileri şöyle görünür:</p> + + <div class="example"><p><code> + 127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET + /apache_pb.gif HTTP/1.0" 200 2326 + </code></p></div> + + <p>Bu günlük girdisini parça parça açıklayalım:</p> + + <dl> + <dt><code>127.0.0.1</code> (<code>%h</code>)</dt> + + <dd>Bu, sunucuya istek yapan istemcinin (uzak konağın) IP adresidir. + Eğer <code class="directive"><a href="./mod/core.html#hostnamelookups">HostnameLookups</a></code> + yönergesine <code>On</code> değeri atanmışsa sunucu bu IP adresi + için DNS sorgusu yapacak ve IP adresi yerine bulduğu konak ismini + yazmaya çalışacaktır. Bununla birlikte, bu işlem sunucuyu epeyce + yavaşlattığından önerilmemektedir. Konak isimlerini saptamak için en + iyisi günlük girdilerini <code class="program"><a href="./programs/logresolve.html">logresolve</a></code> gibi bir + günlük işlemcisinden geçirmektir. Burada raporlanan IP adresi + doğrudan istemcinin IP adresi olmayabilir. Eğer sunucu ile istemci + arasında bir vekil sunucu varsa bu IP adresi, vekil sunucunun IP + adresi olacaktır.</dd> + + <dt><code>-</code> (<code>%l</code>)</dt> + + <dd>Çıktıdaki bir "tire" imi istenen bilgi parçasının mevcut olmadığı + anlamına gelir. Bu durumda, mevcut olmayan bilgi istemci makine + üzerinde <code>identd</code> tarafından belirlenen istemcinin RFC + 1413 kimliğidir. Bu bilgi oldukça güvenilmezdir ve sıkıca denetlenen + iç ağlar haricinde hemen hemen asla kullanılmamalıdır. Apache, + <code class="directive"><a href="./mod/mod_ident.html#identitycheck">IdentityCheck</a></code> yönergesine + <code>On</code> değeri atanmış olmadıkça bu bilgiyi saptamaya + uğraşmaz.</dd> + + <dt><code>frank</code> (<code>%u</code>)</dt> + + <dd>Bu, belge isteğinde bulunan kişinin HTTP kimlik doğrulamasıyla + saptanan kullanıcı kimliğidir. Bu değer CGI betiklerine + <code>REMOTE_USER</code> ortam değişkeni ile sağlanır. Eğer istek + için durum kodu 401 ise (aşağıya bakınız) henüz kullanıcının kimliği + doğrulanmamış olacağından bu değere güvenilmemelidir. Eğer belge + parola korumalı değilse günlüğün bu kısmı da yukarıdaki gibi + "<code>-</code>" olacaktır.</dd> + + <dt><code>[10/Oct/2000:13:55:36 -0700]</code> + (<code>%t</code>)</dt> + + <dd>İsteğin alındığı tarih ve saat. Biçemi şöyledir: + + <p class="indent"> + <code>[gün/ay/yıl:saat:dakika:saniye dilim]<br /> + gün = 2 hane<br /> + ay = 3 harf<br /> + yıl = 4 hane<br /> + saat = 2 hane<br /> + dakika = 2 hane<br /> + saniye = 2 hane<br /> + dilim = (`+' | `-') 4 hane</code> + </p> + <p>Günlük biçem dizgesinde zaman gösterim biçemini + <code>%{<em>biçem</em>}t</code> şeklinde belirtmek de mümkündür. + Buradaki <code><em>biçem</em></code> dizgesi, stardart C + kütüphanesindeki <code>strftime(3)</code> işlevi için tanımlanmış + biçem belirteçleriyle veya desteklenen özel belirteçlerle + oluşturulabilir. Ayrıntılı bilgi için <code class="module"><a href="./mod/mod_log_config.html">mod_log_config</a></code> + <a href="mod/mod_log_config.html#formats">biçem dizgelerine</a> + bakın.</p> + </dd> + + <dt><code>"GET /apache_pb.gif HTTP/1.0"</code> + (<code>\"%r\"</code>)</dt> + + <dd>İstemciden alınan istek satırının çift tırnaklar arasında + gösterilmesi istenmiştir. İstek satırı en yararlı bilgi parçalarını + içerir. Birincisi, istemci tarafından kullanılan yöntem + <code>GET</code>’miş. İkinci olarak istemci + <code>/apache_pb.gif</code> dosyasını istemiş ve üçüncü olarak + istemci <code>HTTP/1.0</code> protokolünü kullanmış. İstek satırının + bazı parçalarını bağımsız olarak da günlüklemek mümkündür. Örneğin, + "<code>%m %U%q %H</code>" dizgesi, yöntem, yol, sorgu dizgesi ve + protokolü kaydedecektir; bu dizge "<code>%r</code>" biçem + belirtecinin tek başına yaptığı işi yapar.</dd> + + <dt><code>200</code> (<code>%>s</code>)</dt> + + <dd>Bu, sunucunun istemciye gönderdiği durum kodudur. İsteğin + başarıyla yerine getirilip getirilmediğini gösterdiği için bu bilgi + çok değerlidir. Durum kodu 2 ile başlıyorsa istek başarıyla yerine + getirilmiştir, 3 ile başlıyorsa yönlendirilmiştir, 4 ile başlıyorsa + istemci tarafında bir hata oluşmuştur, 5 ile başlıyorsa sunucuda bir + hata oluşmuştur. Olası hata kodlarının tam listesi <a href="http://www.w3.org/Protocols/rfc2616/rfc2616.txt">RFC2616 Hiper + Metin Aktarım Protokolü</a>nün 10. bölümünde bulunabilir.</dd> + + <dt><code>2326</code> (<code>%b</code>)</dt> + + <dd>Son parça istemciye döndürülen nesnenin yanıt başlığı hariç + uzunluğudur. Eğer istemciye bir içerik döndürülmemişse bu değer + "<code>-</code>" olacaktır. Bunun yerine günlüğe "<code>0</code>" + yazdırmak için <code>%B</code> belirtecini kullanınız.</dd> + </dl> + + + <h3><a name="combined" id="combined">Birleşik Günlük Biçemi</a></h3> + + + <p>Sıklıkla kullanılan diğer bir biçem dizgesi Birleşik Günlük Biçemi + (Combined Log Format) olup şöyle kullanılabilir:</p> + + <pre class="prettyprint lang-config">LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" combined +CustomLog log/access_log combined</pre> + + + <p>Bu biçem ilaveten 2 alan içermesi dışında Ortak Günlük Biçemi ile + aynıdır. İlave alanların ikisi de <code>%{<em>başlık</em>}i</code> + biçeminde olup buradaki <code><em>başlık</em></code>, HTTP isteğindeki + başlık alanlarından biridir. Bu biçemin kullanıldığı bir erişim + günlüğü girdisi şöyle olurdu:</p> + + <div class="example"><p><code> + 127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET + /apache_pb.gif HTTP/1.0" 200 2326 + "http://www.example.com/start.html" "Mozilla/4.08 [en] + (Win98; I ;Nav)" + </code></p></div> + + <p>Ek alanlar:</p> + + <dl> + <dt><code>"http://www.example.com/start.html"</code> + (<code>\"%{Referer}i\"</code>)</dt> + + <dd>HTTP istek başlığı "Referer". İstemcinin raporladığı isteğin + kaynaklandığı URI. (Bu isteğin yapılmasını sağlayan bağlantıyı + içeren URL veya istek bir sayfanın bileşenleri ile ilgiliyse istenen + sayfanın URL’si olabilir.)</dd> + + <dt><code>"Mozilla/4.08 [en] (Win98; I ;Nav)"</code> + (<code>\"%{User-agent}i\"</code>)</dt> + + <dd>Tarayıcı kimliğini içeren HTTP istek başlığı. Bu istemcinin + tarayıcısının raporladığı kendi tanıtım bilgisidir.</dd> + </dl> + + + <h3><a name="multiple" id="multiple">Çok Sayıda Erişim Günlüğü</a></h3> + + + <p>Yapılandırma dosyasında çok sayıda <code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code> yönergesi kullanarak çok + sayıda erişim günlüğü kolayca oluşturulabilir. Örneğin aşağıdaki + yönergelerle 3 tane erişim günlüğü oluşturulacaktır. İlki temel OGB + bilgisini içerirken diğer ikisi isteğin kaynaklandığı yeri ve tarayıcı + kimliğini içerir. Son iki <code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code> satırı ayrıca, <code>ReferLog</code> ve + <code>AgentLog</code> yönergelerinin etkilerinin nasıl taklit + edileceğini de göstermektedir.</p> + + <pre class="prettyprint lang-config">LogFormat "%h %l %u %t \"%r\" %>s %b" common +CustomLog logs/access_log common +CustomLog logs/referer_log "%{Referer}i -> %U" +CustomLog logs/agent_log "%{User-agent}i"</pre> + + + <p>Bu örnek ayrıca, <code class="directive"><a href="./mod/mod_log_config.html#logformat">LogFormat</a></code> yönergesi ile bir takma ad tanımlamanın şart + olmadığını da göstermektedir. Günlük biçemi doğrudan <code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code> yönergesinde + belirtilebilir.</p> + + + <h3><a name="conditional" id="conditional">Şarta Bağlı Günlükler</a></h3> + + + <p>Bazı durumlarda istemcinin yaptığı isteğe bağlı olarak erişim + günlüğünde belli girdilerin dışlanması gerekebilir. Bu, <a href="env.html">ortam değişkenleri</a> sayesinde kolayca yerine + getirilebilir. Önce isteğin belli koşulları sağladığını belirten bir + ortam değişkeni ataması yapılır. Bu işlem <code class="directive"><a href="./mod/mod_setenvif.html#setenvif">SetEnvIf</a></code> yönergesi ile yapılır. + Sonra da, ortam değişkenine bağlı olarak isteklerin günlüğe dahil + edilip edilmeyeceği <code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code> yönergesinin + <code>env=</code> deyimi kullanılarak belirtilir. Bazı örnekler:</p> + + <pre class="prettyprint lang-config"># yerel konaktan kaynaklanan istekleri imleyelim +SetEnvIf Remote_Addr "127\.0\.0\.1" kaydetme +# robots.txt dosyası isteklerini imleyelim +SetEnvIf Request_URI "^/robots\.txt$" kaydetme +# Kalanları günlüğe kaydedelim +CustomLog logs/access_log common env=!kaydetme</pre> + + + <p>Başka bir örnek olarak, Türkçe belge isteklerini bir dosyaya diğer + dillerdeki istekleri başka bir dosyaya kaydedelim.</p> + + <pre class="prettyprint lang-config">SetEnvIf Accept-Language "tr" turkce +CustomLog logs/turkce_log common env=turkce +CustomLog logs/diger_diller_log common env=!turkce</pre> + + + <p>Bir arabellekleme senaryosuna arabelleğin verimli kullanılıp + kullanılmadığını bilmek isteyelim. Bu basitçe şöyle yapılabilir:</p> + + <pre class="prettyprint lang-config">SetEnv CACHE_MISS 1 +LogFormat "%h %l %u %t "%r " %>s %b %{CACHE_MISS}e" common-cache +CustomLog logs/access_log common-cache</pre> + + + <p><code class="module"><a href="./mod/mod_cache.html">mod_cache</a></code> önce <code class="module"><a href="./mod/mod_env.html">mod_env</a></code> modülünü + çalıştıracak ve başarılı olunduğu takdirde içeriği onsuz teslim + edecektir. Bu durumda arabellek kaybı <code>1</code> olarak + günlüklenirken arabellek sunumu <code>-</code> olarak + günlüklenecektir.</p> + + <p><code>env=</code> sözdizimine ek olarak, <code class="directive"><a href="./mod/mod_log_config.html#logformat">LogFormat</a></code> HTTP yanıt kodudaki koşul + değerlerini günlüklemeyi de destekler:</p> + + <pre class="prettyprint lang-config">LogFormat "%400,501{User-agent}i" browserlog +LogFormat "%!200,304,302{Referer}i" refererlog</pre> + + + <p>Bu örnekte, HTTP durum kodu 400 veya 501 ise <code>User-agent</code> + başlığı günlüklenecektir. Aksi takdirde, günlüğe bir "-" yazılacaktır. + Benzer şekilde ikinci örnekte, HTTP durum kodu 200, 204 veya 302 + <strong>değilse</strong> (durum kodlarının öncesindeki "!" imine + dikkat) <code>Referer</code> başlığı günlüklenecektir.</p> + + <p>Koşula bağlı günlük kaydının çok esnek ve güçlü olabileceğini + göstermiş olsak da günlük içeriğini denetlemenin tek yolu bu değildir. + Günlük dosyaları sunucu etkinliğini eksiksiz olarak kaydedebildikleri + takdirde daha yararlı olurlar. Günlük dosyalarını sonradan işleme tabi + tutarak istenmeyen girdileri kaldırılmış bir kopya almak hem kolay hem + de daha yararlıdır.</p> + + </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="rotation" id="rotation">Günlük Çevrimi</a></h2> + + + <p>Yükü ağır sunucularda günlük dosyalarına kaydedilen bilginin miktarı + çok büyük boyutlara ulaşabilir. 10.000 istek içeren bir erişim günlüğü + yaklaşık 1MB yer kaplar. Etkin günlük dosyasını belirli aralıklarla + değiştirmek veya silmek gerekebilir. Apache httpd çalışırken dosyayı sürekli + açık tuttuğu ve yazdığı için bu işlem sunucu çalışırken yapılamaz. Bu + bakımdan, günlük dosyası değiştirildikten veya silindikten sonra yeni + dosyanın açılması için <a href="stopping.html">sunucunun yeniden + başlatılması</a> gerekir.</p> + + <p><a href="stopping.html#graceful">Nazikçe yeniden başlatmak</a> + suretiyle sunucunun, mevcut ve bekleyen bağlantıları kaybetmeden yeni + günlük dosyalarını açması sağlanabilir. Bununla birlikte, bu işlem + sırasında sunucunun eski isteklere sunumu bitirene kadar eski günlük + dosyalarına yazmaya devam edebilmesi gerekir. Bu bakımdan, yeniden + başlatmanın ardından eski günlük dosyaları üzerinde bir işlem yapmadan + önce biraz beklemek gerekir. Günlük dosyalarını döndürürken kullanılan + senaryolarda genellikle eski günlük dosyaları yer kazanmak için + sıkıştırılırlar:</p> + + <div class="example"><p><code> + mv access_log access_log.old<br /> + mv error_log error_log.old<br /> + apachectl graceful<br /> + sleep 600<br /> + gzip access_log.old error_log.old + </code></p></div> + + <p>Günlük çevrimi yapmanın başka bir yolu da sonraki bölümde açıklandığı + gibi <a href="#piped">borulu günlükler</a> kullanmaktır.</p> + </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="piped" id="piped">Borulu Günlükler</a></h2> + + + <p>Apache httpd hata ve erişim günlüklerini doğrudan bir dosyaya yazmak + yerine bir boru üzerinden başka bir sürece yazabilir. Bu yetenek ana + sunucuya herhangi bir kod eklemeksizin günlükleme esnekliğini şaşırtıcı + derecede arttırır. Günlükler boruya yazılmak istenirse dosya ismini boru + karakteriyle ("<code>|</code>") değiştirip ardına günlük girdilerini + standart girdisinden kabul edecek programın ismini eklemek yeterlidir. + Apache httpd başlatıldığı zaman borulu günlük işlemini de + başlatacaktır. Eğer sunucu çalışırken günlükleri kabul eden süreç + çökerse Apache httpd bu programı yeniden başlatır. (Bu son özelliği + sebebiyle bu tekniğe “güvenilir borulu günlükleme” adını veriyoruz.)</p> + + <p>Borulu günlük süreçleri ana Apache httpd süreci tarafından başlatılır + ve bu süreçler ana Apache httpd sürecinin kullanıcı kimliğini miras + alırlar. Yani borulu günlükleme programları aslında root tarafından + çalıştırılmış gibi olur. Bu bakımdan, bu programları basit ve güvenilir + kılmak çok önemlidir.</p> + + <p>Borulu günlüklerin önemli kullanım alanlarından biri de sunucuyu + yeniden başlatmak gerekmeksizin günlük çevrimini mümkün kılmaktır. + Apache HTTP sunucusu bu amaçla kullanılmak üzere + <code class="program"><a href="./programs/rotatelogs.html">rotatelogs</a></code> diye bir program içerir. Örneğin, + günlükleri 24 saatte bir döndürmek isterseniz bunu şöyle + yapabilirsiniz:</p> + + <pre class="prettyprint lang-config">CustomLog "|/usr/local/apache/bin/rotatelogs /var/log/access_log 86400" common</pre> + + + <p>Borunun diğer ucundaki süreci başlatacak komutun tırnak içine + alındığına dikkat ediniz. Bu örnekler erişim günlüğü için verilmişse de + aynı teknik hata günlüğü için de kullanılabilir.</p> + + <p>Hariçten bir uygulama olarak <a href="http://www.cronolog.org/">cronolog</a> isminde buna benzer ancak + çok daha esnek bir program daha vardır.</p> + + <p>Borulu günlükler de şarta bağlı günlükleme kadar güçlü olmakla beraber + çevrimdışı ardıl işlemler gibi daha basit çözümler için + kullanılmamalıdır.</p> + + <p>Öntanımlı olarak borulu günlük süreci bir kabuk kullanmadan + çalıştırılır. Kabuk kullanarak (genelde <code>/bin/sh -c</code> ile) + yapılmak istenirse "<code>|</code>" yerine "<code>|$</code>" + kullanılır:</p> + + <pre class="prettyprint lang-config"># Kabuk kullanarak "rotatelogs" çalıştırmak +CustomLog "|$/usr/local/apache/bin/rotatelogs /var/log/access_log 86400" common</pre> + + + <p>Bu, Apache 2.2 için öntanımlı davranıştı. Kabuk özelliklerine bağlı + olarak, yeniden başlatma sırasındaki sinyal işleme sorunları ve günlük + borulama uygulamasının yaşam süresi için ek bir kabuk süreci ile + sonuçlanabilir. Apache 2.2 ile uyumluluk açısından "<code>||</code>" + gösterimi de desteklenmekte olup "<code>|</code>" kullanımına + eşdeğerdir.</p> + + <div class="note"><h3>Windows'ta yığın alanı</h3> + <p>Windows'ta çok sayıda borulu günlükleme süreci çalışırken ve özellikle + HTTPD bir hizmet olarak çalışıyorsa sorunlar baş gösterebilir. Bunun + başlıca sebebi masaüstü yığın alanının (heap) dışına taşılmasıdır. Her + hizmete ayrılan masüstü yığın alanı, kayıt defterindeki + HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\SessionManager\SubSystems\Windows + kaydındaki üçüncü değiştirge olan <code>SharedSection</code> + değeridir. <strong>Bu değeri değiştirirken çok dikkatli olun</strong>; + bu, Windows kayıt defterini değiştirirken verilen normal + uyarılardandır, fakat eğer bu değer çok yüksek olursa masaüstü yığın + alanının tükenebileceği dikkate alınmalıdır.</p> + </div> + </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="virtualhost" id="virtualhost">Sanal Konaklar</a></h2> + + + <p>Bir sunucu çok sayıda <a href="vhosts/">sanal konak</a> ile hizmet + sunarken bunların günlük kayıtları için çeşitli seçenekler mevcuttur. + İlk seçenekte, sanki sunucu tek bir konakla hizmet sunuyormuş gibi + günlük kaydı yapılır. Günlükleme yönergelerini <code class="directive"><a href="./mod/core.html#virtualhost"><VirtualHost></a></code> bölümlerinin dışına, ana sunucu + bağlamına yerleştirerek tüm isteklerin aynı erişim ve hata günlüğüne + yazılmasını sağlamak olasıdır. Bu teknik, tek tek sanal konaklar için + kolayca istatistik toplamaya izin vermez.</p> + + <p>Eğer <code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code> + veya <code class="directive"><a href="./mod/core.html#errorlog">ErrorLog</a></code> yönergesi bir + <code class="directive"><a href="./mod/core.html#virtualhost"><VirtualHost></a></code> bölümüne + yerleştirilirse bu sanal konağa bütün erişimler veya hatalar belirtilen + dosyaya günlüklenecektir. Böyle günlükleme yönergeleri içermeyen sanal + konakların günlükleri hala ana sunucunun hata ve erişim günlüklerine + yazılmaya devam edecektir. Bu teknik az sayıda sanal konak barındıran + sunucular için çok kullanışlıdır. Fakat sanal konak sayısı çok fazlaysa + bu teknikle günlük dosyalarını yönetmek çok karmaşık bir hal alabilir. + Ayrıca, <a href="vhosts/fd-limits.html">yetersiz dosya tanıtıcısı</a> + sorunlarıyla çok sık karşılaşılabilir.</p> + + <p>Erişim günlükleri için çok az bir fedakarlıkla çok iyi bir çözüm vardır. + Günlük biçemine sanal konaklarla ilgili bilgi eklemek suretiyle tüm + konakların aynı günlük dosyasını kullanmaları olasıdır. Böylece günlük + dosyası sonradan her sanal konak için ayrı bir dosya oluşturmak üzere + ayrıştırılabilir. Örneğin, bu işlem için şu yönergeler kullanılıyor + olsun:</p> + + <pre class="prettyprint lang-config">LogFormat "%v %l %u %t \"%r\" %>s %b" ortaksankon +CustomLog logs/access_log ortaksankon</pre> + + + <p><code>%v</code> belirteci isteği sunan sanal konağın ismini günlüğe + yazmak için kullanılır. Daha sonra <a href="programs/split-logfile.html">split-logfile</a> gibi bir program + kullanarak, bu dosyadan her sanal konak için ayrı birer dosya elde + edilebilir.</p> + </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> +<div class="section"> +<h2><a name="other" id="other">Diğer Günlük Dosyaları</a></h2> + + + <table class="related"><tr><th>İlgili Modüller</th><th>İlgili Yönergeler</th></tr><tr><td><ul><li><code class="module"><a href="./mod/mod_logio.html">mod_logio</a></code></li><li><code class="module"><a href="./mod/mod_log_config.html">mod_log_config</a></code></li><li><code class="module"><a href="./mod/mod_log_forensic.html">mod_log_forensic</a></code></li><li><code class="module"><a href="./mod/mod_cgi.html">mod_cgi</a></code></li></ul></td><td><ul><li><code class="directive"><a href="./mod/mod_log_config.html#logformat">LogFormat</a></code></li><li><code class="directive"><a href="./mod/mod_log_config.html#bufferedlogs">BufferedLogs</a></code></li><li><code class="directive"><a href="./mod/mod_log_forensic.html#forensiclog">ForensicLog</a></code></li><li><code class="directive"><a href="./mod/mpm_common.html#pidfile">PidFile</a></code></li><li><code class="directive"><a href="./mod/mod_cgi.html#scriptlog">ScriptLog</a></code></li><li><code class="directive"><a href="./mod/mod_cgi.html#scriptlogbuffer">ScriptLogBuffer</a></code></li><li><code class="directive"><a href="./mod/mod_cgi.html#scriptloglength">ScriptLogLength</a></code></li></ul></td></tr></table> + + <h3>Gönderilen ve alınan bayt sayısının günlüklenmesi</h3> + + + <p><code class="module"><a href="./mod/mod_logio.html">mod_logio</a></code> modülü <code class="directive"><a href="./mod/mod_log_config.html#logformat">LogFormat</a></code> yönergesinde kullanılan + biçem belirteçlerine alınan ve gönderilen bayt sayıları için iki + belirteç (%I ve %O) ekler.</p> + + + <h3>Adli Günlük</h3> + + + <p><code class="module"><a href="./mod/mod_log_forensic.html">mod_log_forensic</a></code> modülü istemci isteklerinin kanıt + olarak kullanılmak amacıyla günlüklenmesini sağlar. Günlükleme her + istek için isteğe hizmet sunmadan önce ve sonra olmak üzere iki defa + yapılır. Böylece günlük dosyasında başarılı her istek için iki satır + bulunur. Adli günlükleme çok sıkı kurallara tabi olup + kişiselleştirilemez. Güvenlik ve hata ayıklama aracı olarak yararlı + değildir.</p> + + + <h3><a name="pidfile" id="pidfile">PID Dosyası</a></h3> + + + <p>Apache httpd başlatıldığında, ana httpd sürecinin kimliği (PID) + <code>logs/httpd.pid</code> dosyasına kaydedilir. Bu dosyanın ismi + <code class="directive"><a href="./mod/mpm_common.html#pidfile">PidFile</a></code> yönergesi ile + değiştirilebilir. Bu süreç kimliği sistem yöneticisi tarafından ana + sürece sinyal göndererek artalan sürecini sonlandırmak veya yeniden + başlatmak için kullanılır. Windows üzerinde bu işlem için + <code>-k</code> komut satırı seçeneği kullanılır. Bu konuda daha + ayrıntılı bilgi edinmek için <a href="stopping.html">Durdurma ve + Yeniden Başlatma</a> belgesine bakınız.</p> + + + <h3><a name="scriptlog" id="scriptlog">Betik Günlüğü</a></h3> + + + <p><code class="directive"><a href="./mod/mod_cgi.html#scriptlog">ScriptLog</a></code> yönergesi CGI + betiklerinin girdi ve çıktılarını kaydetmenizi mümkün kılmak suretiyle + hata ayıklamaya yardımcı olur. Bu sadece deneysel amaçla kullanılmalı, + asıl sunucuya uygulanmamalıdır. <a href="mod/mod_cgi.html">mod_cgi</a> + belgesinde daha fazla bilgi bulunabilir.</p> + + </div></div> +<div class="bottomlang"> +<p><span>Mevcut Diller: </span><a href="./en/logs.html" hreflang="en" rel="alternate" title="English"> en </a> | +<a href="./fr/logs.html" hreflang="fr" rel="alternate" title="Français"> fr </a> | +<a href="./ja/logs.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> | +<a href="./ko/logs.html" hreflang="ko" rel="alternate" title="Korean"> ko </a> | +<a href="./tr/logs.html" title="Türkçe"> tr </a></p> +</div><div class="top"><a href="#page-header"><img src="./images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Yorum</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div> +<script type="text/javascript"><!--//--><![CDATA[//><!-- +var comments_shortname = 'httpd'; +var comments_identifier = 'http://httpd.apache.org/docs/2.4/logs.html'; +(function(w, d) { + if (w.location.hostname.toLowerCase() == "httpd.apache.org") { + d.write('<div id="comments_thread"><\/div>'); + var s = d.createElement('script'); + s.type = 'text/javascript'; + s.async = true; + s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier; + (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s); + } + else { + d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>'); + } +})(window, document); +//--><!]]></script></div><div id="footer"> +<p class="apache">Copyright 2019 The Apache Software Foundation.<br /><a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a> altında lisanslıdır.</p> +<p class="menu"><a href="./mod/">Modüller</a> | <a href="./mod/directives.html">Yönergeler</a> | <a href="http://wiki.apache.org/httpd/FAQ">SSS</a> | <a href="./glossary.html">Terimler</a> | <a href="./sitemap.html">Site Haritası</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!-- +if (typeof(prettyPrint) !== 'undefined') { + prettyPrint(); +} +//--><!]]></script> +</body></html>
\ No newline at end of file |