Monitoring the server

ou can monitor your server in realtime by using the Hypertext Transfer Protocol (HTTP). You can also monitor your server by recording and viewing log files.

Monitoring the server using HTTP

Monitor your server's process usage by using the interactive server monitor. You can see how your server is handling its traffic and whether the threads currently assigned are sufficient. As the traffic increases and the server becomes sluggish, you'll need to adjust the server configuration or the system's network kernel.

To monitor your server from the Server Manager,

  1. Choose Server Status|Monitor Current Activity.
  2. Click Monitor. On the page that appears, you can see the server usage, a breakdown of server activity, and some server totals.

Server usage

You can monitor the following server usage areas:

Activity breakdown

You can see the number of threads (in terms of percentages) currently being used in the following server activity tasks:

Totals

You can see the following server totals:

.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 lists all the errors the server has encountered. The access log 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,

  1. Choose Server Status|View Error Log.
  2. If you want to see more or fewer lines of the error log, type the number of lines you'd like to see.
  3. If you'd like to filter the error messages for a particular word, type the word in the Only show entries with field. Case is important; make sure the case for your entry matches the case of the word you're searching for. (For example, if you only want to see error messages that contain "warning," type warning.) The following is an example of an error log:

    [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/mktgdb
    In the previous 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.

Setting log preferences

During installation, an access log file named 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 the server, 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, flexible log format, or your own customizable 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. A customizable format uses parameter blocks that you specify to control what gets logged. Note that 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,

  1. From the Server Manager, choose Server Status|Log Preferences.
  2. Use the Resource Picker to choose the resource you'd like to apply custom logging to.
  3. Select whether to log client accesses.
  4. Type the full path for the log file. As a default, the log files are kept in the logs directory in the server root directory. If you specify a partial path name, the server assumes the path is the logs directory in the server root.

  5. Choose whether to record domain names or IP addresses in the access log.
  6. Choose which format the log format should be: Common Logfile Format or flexible log format (Only log radio button). If you click Only log, the following flexible log format items are available:
  7. If you don't want to log client access from certain host names or IP addresses, type them in the Hostnames and IP Addresses fields. Type a wildcard pattern of hosts the server should not record accesses from; for example, *.netscape.com doesn't log accesses from people whose domain is netscape.com. You can type wildcard patterns for host names, IP addresses, or both.
  8. Click OK.

Viewing an access log file

You can view the server's active and archived access log files from the Server Manager.

To view an access log,

  1. Choose Server Status|View Access Log.
  2. Choose which access log file you want to see. Active log files for resources and archived log files will appear in the list.
  3. To limit how much of the access log you'll see, type the number of lines you want to see in the Number of entries field.
  4. If you'd like to filter the access log entries for a particular word, type the word in the Only show entries with field. Case is important; make sure the case for your entry matches the case of the word you're searching for. (For example, if you only want to see access log entries that contain "POST," type POST.) The following is a sample of an access log in the common logfile format:

    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 571
    The following table 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 the "Running the log analyzer from the command line" section. Before running the log analyzer, you should archive the server logs.

Running the log analyzer from the Server Manager

To run the log analyzer from the Server Manager,

  1. Choose Server Status|Generate Report.
  2. Type the name of your server; this name will appear in the generated report.
  3. Choose whether the report will appear in HTML or ASCII format.
  4. Select the log file you want to analyze.
  5. If you want to save the results in a file, type an output file name in the Output file field. If you leave the field blank, the report results will print to the screen. For large log files, you should save the results to a file because printing the output to the screen might take a long time.
  6. Select whether to generate totals for certain server statistics. The following totals can be generated:
  7. Select whether to generate general statistics. The following general statistics can be generated:
  8. Select whether to generate a list of server access statistics. You can generate a list of the following:
  9. Specify the order in which you want to see the results.
  10. Click OK.

Running the log analyzer from the command line

To analyze access log files from the command line, run 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

Archiving log files

You can archive the access and error log files and have the server create new ones.

When you archive log files, the server renames the current log files and then creates new log files with the original names. You can back up or archive (or delete) the old log files, which are saved with the original file name appended with the date the file was rotated. For example, access becomes access.24-Apr.

Note
Before running the log analyzer, you should archive the server logs.

To archive log files,

  1. From the Server Manager, choose Server Status|Archive Log.
  2. Click Archive if you want to rotate the log files immediately.
  3. If you want archiving to occur at specific times on specific days, click the Rotate log at button, choose times from the list, and select the day(s) for archiving to occur.
  4. Click OK.
  5. Shut down the administration server by clicking on the "shut down" link on the page that appears.
  6. Restart the administration server.