Merge pull request #779 from WalkerWatch/issues/761

Resolves #761
This commit is contained in:
Jesse McConnell 2016-07-28 12:18:53 -05:00 committed by GitHub
commit 6655e7ab64
1 changed files with 10 additions and 4 deletions

View File

@ -23,10 +23,11 @@ There is one entry per request received, and commonly in the standard NCSA forma
[[constructing-request-log-entry]] [[constructing-request-log-entry]]
==== Constructing a Request Log Entry ==== Constructing a Request Log Entry
A standard request log entry includes the client IP address, date, method, URL, result, size, referrer, user agent and latency for example: A standard request log entry includes the client IP address, date, method, URL, result, size, referrer, user agent and latency.
For example:
.... ....
123.4.5.6 - - [27/Aug/2004:10:16:17 +0000] 123.4.5.6 - - [20/Jul/2016:10:16:17 +0000]
"GET /jetty/tut/XmlConfiguration.html HTTP/1.1" "GET /jetty/tut/XmlConfiguration.html HTTP/1.1"
200 76793 "http://localhost:8080/jetty/tut/logging.html" 200 76793 "http://localhost:8080/jetty/tut/logging.html"
"Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040614 Firefox/0.8" 342 "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040614 Firefox/0.8" 342
@ -67,15 +68,20 @@ requestLog.setAppend(true);
requestLog.setExtended(false); requestLog.setExtended(false);
requestLog.setLogTimeZone("GMT"); requestLog.setLogTimeZone("GMT");
requestLog.setLogLatency(true); requestLog.setLogLatency(true);
requestLog.setRetainDays("90");
server.setRequestLog(requestLog); server.setRequestLog(requestLog);
---- ----
This configures a request log in `{$jetty.home}/logs` with filenames including the date. This configures a request log in `{$jetty.home}/logs` with filenames including the date.
By defaukt, log files are kept for 90 days before being deleted.
Existing log files are appended to and the extended NCSA format is used in the GMT time zone. Existing log files are appended to and the extended NCSA format is used in the GMT time zone.
To examine many more configuration options, see link:{JDURL}/org/eclipse/jetty/server/NCSARequestLog.html[NCSARequestLog.java]. You can customize the number of days you wish to keep request logs.
By default, log files are kept for 90 days before being deleted.
The value for `retainDays` (xml) or `setRetainDays` (Java) should be configured as _1 + n_ days.
For example, if you wanted to keep the logs for the current day and the day prior you would set the `retainDays` (or `setRetainDays`) value to 2.
To examine more configuration options, see link:{JDURL}/org/eclipse/jetty/server/NCSARequestLog.html[NCSARequestLog.java].
[[configuring-separate-request-log-for-web-application]] [[configuring-separate-request-log-for-web-application]]
==== Configuring a Separate Request Log For a Web Application ==== Configuring a Separate Request Log For a Web Application