Working with log files
Server log files record your server's activity. You can use these logs to monitor your server and help you when troubleshooting. The error log file, located in httpd-[servername]logs in the server root directory, lists all the errors the server has encountered. The access log, located in httpd-[servername]/logs in the server root directory, records information about requests to the server and the responses from the server. You can specify what is included in the access log file from the Server Manager. Use the log analyzer to generate server statistics. You can back up server error and access log files by archiving them.
Viewing the error log file
The error log file contains errors the server has encountered since the log file was created; it also contains informational messages about the server, such as when the server was started. Incorrect user authentication is also recorded in the error log. Use the error log to find broken URL paths or missing files.
To view the error log file from the Server Manager:
warning
.)
[13/Feb/1996:16:56:51] info: successful server startup> [20/Mar/1996 19:08:52] warning: for host wiley.a.com trying to GET /report.html, append-trailer reports: error opening /usr/ns-home/docs/report.html (No such file or directory) [30/Mar/1996 15:05:43] security: for host arrow.a.com trying to GET /, basic-ncsa reports: user jane password did not match database /usr/ns-home/authdb/mktgdbIn this example, the first line is an informational message--the server started up successfully. The second log entry shows that the client wiley.a.com requested the file report.html, but the file wasn't in the primary document directory on the server. The third log entry shows that the password entered for the user jane was incorrect.
access
was created for the server. You can customize access logging for any resource by specifying whether to log accesses, who not to record accesses from, and whether the server should spend time looking up the domain names of clients when they access a resource.
Server access logs can be in Common Logfile Format or flexible log format. The Common Logfile Format is a commonly supported format, but provides a fixed amount of information about the server. The flexible log format allows you to choose (from the Server Manager) what to log. Once an access log for a resource has been created, you can't change its format unless you archive it or create a new access log file for the resource.
To set access logging preferences:
logs
directory in the server root
directory. If you specify a partial pathname, the server assumes the path is
the logs
directory in the server root.
*.netscape.com
doesn't log accesses from people whose domain is netscape.com
. You can type wildcard patterns for hostnames, IP addresses, or both.
POST
.)
wiley.a.com - - [16/Feb/1996:21:18:26 -0800] "GET / HTTP/1.0" 200 751 wiley.a.com - - [17/Feb/1996:1:04:38 -0800] "GET /docs/grafx/icon.gif HTTP/1.0" 204 342 wiley.a.com - - [20/Feb/1996:4:36:53 -0800] "GET /help HTTP/1.0" 401 571 arrow.a.com - john [29/Mar/1996:4:36:53 -0800] "GET /help HTTP/1.0" 401 571Table 9.1 describes the last line of the sample access log.
The following is a sample of an access log using the flexible logging format:
wiley.a.com - - [25/Mar/1996:12:55:26 -0800] "GET /index.htm HTTP/1.0" "GET" "/?-" "HTTP/
1.0" 304 0 - Mozilla/2.0 (WinNT; I)
wiley.a.com - - [25/Mar/1996:12:55:26 -0800] "GET / HTTP/1.0" "GET" "/?-" "HTTP/1.0" 304 0
- Mozilla/2.0 (WinNT; I)
wiley.a.com - - [25/Mar/1996:12:55:26 -0800] "GET / HTTP/1.0" "GET" "/?-" "HTTP/1.0" 304 0
- Mozilla/2.0 (X11; I; IRIX 5.3 IP22)
The access log using the flexible logging format looks similar to the access log using the Common Logfile Format.
Working with the log analyzer
Use the log analyzer to generate statistics about your server, such as a summary of activity, most commonly accessed URLs, times during the day when the server is accessed most frequently, and so on. You can run the log analyzer from the Server Manager, as described in the following section; if you want to run the log analyzer from the command line, go to "Running the log analyzer from the command line" later in this chapter.
Note  Before running the log analyzer, you should archive the server logs. For more information about archiving server logs, see "Archiving log files" on page 138.
Running the log analyzer from the Server Manager
To run the log analyzer from the Server Manager:
flexanlg
, which is in extras/flexanlg in your server root directory.
To run flexanlg
, type the following command and options at the command prompt:
flexanlg [ -P ] [-n name] [-x] [-r] [-p order] [-i file]* [ -m metafile ]* [ o file][ c opts] [-t opts] [-l opts]The following describes the syntax. (You can get this information online by typing
flexanlg -h
.)
-P: proxy log format Default: no -n servername: The name of the server -x : Output in HTML Default: no -r : Resolve IP addresses to hostnames Default: no -p [c,t,l]: Output order (counts, time stats, lists) Default: ctl -i filename: Input log file(s) Default: none -o filename: Output log file Default: stdout -m filename: Meta file(s) Default: none -c [h,n,r,f,e,u,o,k,c,z]: Count these item(s) - Default: hnreuokc h: total hits n: 304 Not Modified status codes (Use Local Copy) r: 302 Found status codes (Redirects) f: 404 Not Found status codes (Document Not Found) e: 500 Server Error status codes (Misconfiguration) u: total unique URL's o: total unique hosts k: total kilobytes transferred c: total kilobytes saved by caches z: Do not count any items. -t [sx,mx,hx, xx,z]: Find general stats - Default:s5m5h24x10 s(number): Find top (number) seconds of log m(number): Find top (number) minutes of log h(number): Find top (number) hours of log u(number): Find top (number) users of log a(number): Find top (number) user agents of log r(number): Find top (number) referers of log x(number): Find top (number) for miscellaneous keywords z: Do not find any general stats. -l [cx,hx]: Make a list of - Default: c+3h5 c(x,+x): Most commonly accessed URLs (x: Only list x entries) (+x: Only list if accessed more than x times) h(x,+x): Hosts (or IP addresses) most often accessing your server (x: Only list x entries) (+x: Only list if accessed more than x times) z: Do not make any lists
access.24Apr-04AM
.
You can archive log files immediately, or have the server archive log files at a specific time on specific days. The information about when to archive log files is stored in the cron.conf file in the admserv directory in the server root directory; the server's cron configuration options are stored in ns-cron.conf in the admserv directory.
Note
 Before running the log analyzer, you should archive the server logs.
To archive log files: