|
||
|
|
You can monitor your server's activity using several different methods. This chapter discusses how to monitor your server by recording and viewing log files. For information on using the built-performance monitoring services, quality of service features, or SNMP, see Chapter 10 "Monitoring Servers."
This chapter contains the following sections:
- About Log Files
![]()
- Viewing an Access Log File
![]()
- Viewing the Error Log File
![]()
- Archiving Log Files
![]()
- Setting Log Preferences
![]()
- Running the Log Analyzer
![]()
- Viewing Events (Windows NT/Windows 2000)
![]()
Server log files record your server's activity. You can use these logs to monitor your server and to help you when troubleshooting. The error log file, located in server_root/https-identifier/logs/errorsin the server root directory, lists all the errors the server has encountered. The access log, located in server_root/https-identifier/logs/accessin the server root directory, records information about requests to the server and the responses from the server. You can configure the information recorded in the Netscape Enterprise Serveraccesslog file. You use the log analyzer to generate server statistics. You can back up server error and access log files by archiving them.
Due to limitations in the operating system, Enterprise Server cannot work with log files larger than 2GB on Linux. When the maximum file size is reached, logging will cease.
You can view the server's active and archived access log files.
To view the Administration Server's access log from the Administration Server, choose the Preferences tab, and then choose the View Access Log page.
To view an access log for the server instance from the Server Manager, choose the Logs tab, and then choose the View Access Log page.
To view an access log for an individual virtual server from the Class Manager, select a virtual server to manage from the highlighted Manage Virtual Servers page, then click the link under the heading Access Log on the Virtual Server Manager page. You can specify the number of entries to view or entries with a conditional qualifier of your choice.
The following is an example of an access log in the Common Logfile Format (you specify the format in the Log Preferences window; see Setting Log Preferences for more information):
Table 9-1 describes the last line of this sample access log.
Table 9-1 The fields in the last line of the sample access log file
arrow.example.com. (In this case, the hostname is shown because the web server's setting for DNS lookups is enabled; if DNS lookups were disabled, the client's IP address would appear.
The following is an example of an access log using the flexible logging format (you specify the format in the Log Preferences page; see Setting Log Preferences for more information):
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. Unsuccessful user authentication is also recorded in the error log. Use the error log to find broken URL paths or missing files.
To view the Administration Server's error log file, from the Administration Server, choose the Preferences tab, and choose the View Error Log page.
To view a server instance's error log file, from the Server Manager, choose the Logs tab, and choose the View Error Log page.
To view an error log for an individual virtual server, from the Class Manager, select a virtual server to manage from the highlighted Manage Virtual Servers page, then click the link under the heading Error Log on the Virtual Server Manager page. You can specify the number of entries to view or entries with a conditional qualifier of your choice.
The following are two examples of entries in the error log; the first example shows an informational message indicating successful start up of the server, the second example indicates that the client
wiley.example.comrequested the filereport.html, but the file wasn't in the primary document directory on the server.
You can set up your access and error log files to be automatically archived. At a certain time, or after a specified interval, your logs will be rotated. Enterprise Server saves the old log files and stamps the saved file with a name that includes the date and time they were saved.
For example, you can set up your access log files to rotate every hour, and Enterprise Server saves and names the file "
access.199907152400," where name of the log file, year, month, day, and 24-hour time is concatenated together into a single character string. The exact format of the log archive file varies depending upon which type of log rotation you set up.Enterprise Server offers the two types of log rotation for archiving files: Internal-daemon log rotation and Cron-based log rotation.
This type of log rotation happens within the HTTP daemon and can only be configured at startup time. Internal daemon log rotation allows the server to rotate logs internally without requiring a server restart. Logs rotated using this method are saved in the following format:
access.<4-digit year><2-digit month><2-digit day><4-digit 24-hr time>
error.<4-digit year><2-digit month><2-digit day><4-digit 24-hr time>
You can specify the time used as a basis to rotate log files and start a new log file. For example, if the rotation start time is 12:00 a.m., and the rotation interval is 1440 minutes (one day), a new log file will be created immediately upon save regardless of the present time and collect information until the rotation start time. The log file will rotate every day at 12:00 a.m., and the access log will be stamped at 12:00 a.m. and saved as
access.199907152400. Likewise, if you set the interval at 240 minutes (4 hours), the 4 hour intervals begin at 12:00 a.m. such that the access log files will contain information gathered from 12:00 a.m. to 4:00 a.m., from 4:00 a.m. to 8:00 a.m., and so forth.If log rotation is enabled, log file rotation starts at server startup. The first log file to be rotated gathers information from the current time until the next rotation time. Using the previous example, if you set your start time at 12:00 a.m. and your rotation interval at 240 minutes, and the current time is 6:00 a.m., the first log file to be rotated will contain the information gathered from 6:00 a.m. to 8:00 a.m, and the next log file will contain information from 8:00 a.m. to 12:00 p.m. (noon), and so forth.
This type of log rotation is based on the time stored in the
cron.conffile in the server_root/https-admserv/config/directory. This method allows you to archive log files immediately or have the server archive log files at a specific time on specific days. The server's cron configuration options are stored inns-cron.confin the server_root/https-admserv/config/directory. Logs rotated using the cron based method are saved as the original filename followed by the date and time the file was rotated. For example,accessmight becomeaccess.24Apr-0430PMwhen it is rotated at 4:30 p.m.Log rotation is initialized at server startup. If rotation is turned on, Enterprise Server creates a time-stamped access log file and rotation starts at server startup.
Once the rotation starts, Enterprise Server creates a new time stamped log file when there is a request or error that needs to be logged to the access or error log file and it occurs after the prior-scheduled "next rotate time."
You should archive the server logs before running the log analyzer.
To archive log files and to specify whether to use the Internal daemon method or the cron based method, use the Archive Log page in the Server Manager.
During installation, an access log file named
accesswas created for the server. You can customize access logging for any resource by specifying whether to log accesses, what format to use for logging, and whether the server should spend time looking up the domain names of clients when they access a resource.To use one log file for multiple virtual servers, that log file should have
%vsid%in its format string for the access log andLogVsidshould be turned on in themagnus.conffile for the error log. Follow the steps below to access themagnus.conffile and the logging preferences in the Administration Server interface to make the needed changes. The changes are effected following restart of the Administration server.
- Access the Server Manager and choose the Preferences tab.
![]()
- Click the Magnus Editor link.
![]()
- Select the Logging Settings from the Select a Setting drop-down list and click Manage.
![]()
- Select On for the LogVsId value
![]()
- Click the OK button.
![]()
To add
%vsid%to the log file format string:
- Access the Server Manager and choose the Logs tab.
![]()
- Click the Log Preferences link.
![]()
- Enter a new log file location and filename in the Log File: text box.
![]()
- Click the Only Log: radio button.
![]()
- Click the Vsid check box. Alternatively to this, you can click the Custom Format: radio button and add the string
%vsid%.![]()
When adding the custom format string
%vsid%, you must use a new access log file.
For information on the
LogVsIddirective inmagnus.conf, see the section "Error Logging and Statistic Collection" in the Netscape Enterprise Server NSAPI Programmer's Guide.When changing the format of an existing log file, you should first delete/rename the existing log file OR use a different file name.
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 that provides a fixed amount of information about the server. The flexible log format allows you to choose what to log. A customizable format uses parameter blocks that you specify to control what gets logged. For a list of customizable format parameters, see the Netscape Enterprise Server NSAPI Programmer's Guide. Once an access log for a resource has been created, you cannot change its format unless you archive it or create a new access log file for the resource.
You can specify logging preferences using the Log Preferences page in the Server Manager, or you can manually configure the following directives in the
obj.conf(ormagnus.conf)file. Inmagnus.conf, the server calls the functionflex-initto initialize the flexible logging system and the functionflex-logto record request-specific data in a flexible log format. To log requests using the common log file format, the server callsinit-clfto initialize the Common Log subsystem which is used inobj.conf, andcommon-logto record request-specific data in the common log format (used by most HTTP servers).For more information on the NSAPI logging functions, including valid directives and parameters, see the Netscape Enterprise Server NSAPI Programmer's Guide.
Enterprise Server can log a specific cookie using the flexlog facility. Add "
Req->headers.cookie.cookie_name" to the line that initializes theflex-logsubsystem in the configuration fileobj.conf. This logs the value of the cookie variable cookie_nameif the cookie variable is present in the request's headers, and logs "-" if it is not present.
The server_root
/extras/log_anlydirectory contains the log analysis tool that runs through the Server Manager user interface. This log analyzer analyzes files in common log format only. The HTML document in thelog_anlydirectory that explains the tool's parameters. The server_root/extras/flex_anlgdirectory contains the command-line log analyzer for the flexible log file format. However, the Server Manager defaults to using the flexible log file reporting tool, regardless of whether you've selected common or flexible log file format.Use the log analyzer to generate statistics about your default 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 Enterprise Server or the command line. The log analyzer cannot generate statistics for virtual servers other than the default server. However, statistics can be viewed for each virtual server as described in Viewing an Access Log File
Before running the log analyzer, you should archive the server logs. For more information about archiving server logs, see Archiving Log Files.
To run the log analyzer from the Server Manager, follow these steps:
- From the Server Manager, click the Logs tab.
![]()
- Click Generate Report.
![]()
- Fill in the fields.
![]()
- Click OK.
![]()
- The report appears in a new window.
For more information, see the Generate Report Page in the online help.
To analyze access log files from the command line, run the tool,
flexanlg, which is in the directory server_root/extras/flex_anlg.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.
Viewing Events (Windows NT/Windows 2000)
In addition to logging errors to the server error log (see Viewing the Error Log File), Enterprise Server logs severe system errors to the Event Viewer. The Event Viewer lets you monitor events on your system. Use the Event Viewer to see errors resulting from fundamental configuration problems, which can occur before the error log can be opened.
To use the Event Viewer, perform the following steps:
- From the Start menu, select Programs and then Administrative Tools. Choose Event Viewer in the Administrative Tools program group.
![]()
- Choose Application from the Log menu.
![]()
The Application log appears in the Event Viewer. Errors from Enterprise Server have a source label of
https-serverid orWebServer6.1.
© 2001 Sun Microsystems, Inc. Portions copyright 1999, 2002 Netscape Communications Corporation. All rights reserved.
Last Updated August 02, 2002