Oracle HTTP Server generate log files containing messages that record all types of events, including startup and shutdown information, errors, warning messages, access information on HTTP requests, and additional information. This chapter describes how to find information about the cause of an error and its corrective action, to view and manage log files to assist in monitoring system activity and to diagnose problems.
This chapter includes the following sections:
There are two types of logs for Oracle HTTP Server:
Error logs, which record server problems.
Access logs, which record which components and applications are being accessed and by whom.
You can view Oracle Fusion Middleware log files using either Fusion Middleware Control or a text editor. The log files for Oracle HTTP Server are located in the following directory:
ORACLE_INSTANCE/diagnostics/logs/OHS/<ohs_name>
See Also:
For information about searching and viewing log files, see Oracle Fusion Middleware Administrator's GuideOracle HTTP Server enables you to choose the format in which you want to generate log messages. You can choose to generate log messages in the legacy Apache message format, or use Oracle Diagnostic Logging (ODL) to generate log messages in text or XML-formatted logs, which complies with Oracle standards for generating error log messages.
By default, Oracle HTTP Server error logs use ODL for generating diagnostic messages. It provides a common format for all diagnostic messages and log files, and a mechanism for correlating the diagnostic messages from various components across Oracle Fusion Middleware.
The default name of the error log file is <ohs_name>.log
.
Access logs record all requests processed by the server. The logs contain basic information about every HTTP transaction handled by the server. The access log contains the following information:
Host name
Remote log name
Remote user and time
Request
Response code
Number of transferred bytes
The default name of the access log file is access_log
.
You can specify the information to include in the access log, and the manner in which it is written. The default format is the Common Log Format (CLF).
The CLF format contains the following fields:
host ident authuser date request status bytes
host: This is the client domain name or its IP number. Use %h
to specify the host field in the log.
ident: If IdentityCheck is enabled and the client system runs identd, this is the client identity information. Use %i
to specify the client identity field in the log.
authuser: This is the user ID for the authorized user. Use %a
to specify the authorized user field in the log.
date: This is the date and time of the request in the day/month/year:hour:minute:second format. Use %t
to specify date and time in the log.
request: This is the request line, in double quotes, from the client. Use %r
to specify request in the log.
status: This is the three-digit status code returned to the client. Use %s
to specify the status in the log. If the request will be forwarded from another server, use %>s
to specify the last server in the log.
bytes: This is the number of bytes, excluding headers, returned to the client. Use %b
to specify number of bytes in the log. Use %i
to include the header in the log.
See Also:
Access LogIt is important to have log files periodically rotated on a moderately busy server. Oracle HTTP Server supports two types of log rotation policies: size-based and time-based. You can configure both error log and access log to use either one of these two rotation polices.
In addition to the rotatelogs
binary from Apache, Oracle HTTP Server comes with another rotation binary called odl_rotatelogs
, which provides all the functionality of rotatelogs
binary plus the extra functionality of log retention. By default, Oracle HTTP Server uses odl_rotatelogs
for both error and access logs. odl_rotatelogs
takes the following arguments:
odl_rotatelogs [-u:<utc offset in seconds>] LOGFILENAME {size based rotation options OR time based rotation options}
Size-based rotation options: <maxFileSize>M [<allFilesSize>M]
For example, when configured as 10M 70M
, the rotation will happen whenever log file reaches 10MB in size, and a total of 70MB is allowed for all log files (a maximum of 70/10=7 log files will be retained).
Time-based rotation options: <frequency in sec> [<retentionTime in sec>] [<startTime in YYYY-MM-DDThh:mm:ss>
]
For example, when configured as 43200 604800 2009-05-08T10:53:29
, the rotation will happen every 43200 seconds (that is, 12 hours), rotated log files will be retained for maximum of 604800 seconds (7 days), starting from May 5, 2009 at 10:53:29
You can use Fusion Middleware Control to configure error and access logs. The following logging tasks can be set from the Log Configuration page:
To configure an error log for Oracle HTTP Server using Fusion Middleware Control, do the following:
Navigate to the Oracle HTTP Server home page.
Select Log Configuration from the Administration menu.
The Log Configuration page is displayed, as shown in the following figure.
The following error log configuration tasks can be set from this page:
Oracle HTTP Server by default uses ODL-Text as the error log format and creates the log file with the name <ohs_name>.log
under ORACLE_INSTANCE
/diagnostics/logs/OHS/
<ohs_name>
directory. To use a different format or log location, do the following:
From the Log Configuration page, navigate to the General section under the Error Log section.
Select the desired file format. Although both ODL-Text and ODL-XML formats provide the same information, the ODL-XML file includes XML elements and wrappers, and so may be easier to read.
ODL-Text – the format of the diagnostic messages conform to an Oracle standard and are written in text format.
ODL-XML – the format of the diagnostic messages conform to an Oracle standard and are written in XML format.
Apache – the format of the diagnostic messages conform to the legacy Apache message format.
Enter a path for the error log in the Log File/Directory field. This directory must exist before you enter it here.
Review the settings. If the settings are correct, click Apply to apply the changes. If the settings are incorrect, or you decide to not apply the changes, click Revert to return to the original settings.
Restart Oracle HTTP Server. See Section 4.1.4.
You can configure the amount and type of information written to log files by specifying the message type and level. Error log level for Oracle HTTP Server by default is configured to WARNING:32. To use a different error log level do the following:
From the Log Configuration page, navigate to the General section under the Error Log section.
Select a level for the logging from the Level menu. The higher the log level, the more information that is included in the log.
Review the settings. If the settings are correct, click Apply to apply the changes. If the settings are incorrect, or you decide to not apply the changes, click Revert to return to the original settings.
Restart Oracle HTTP Server. See Section 4.1.4.
Note:
The log levels are different for the Apache log format from ODL-Text and the ODL-XML log format.For details on ODL log levels, refer to "Setting the Level of Information Written to Log Files" in the Oracle Fusion Middleware Administrator's Guide.
For details on Apache log levels, refer to the LogLevel Directive in the Apache Server documentation.
Log rotation policy for error logs can either be time-based, such as once a week, or sized-based, such as 120MB. By default, the error log file is rotated when it reaches 10 MB in size and a maximum of 7 error log files will be retained. To use a different rotation policy for error log file do, the following:
From the Log Configuration page, navigate to the General section under the Error Log section.
Select a rotation policy.
No Rotation – if you do not want to have the log file rotated ever.
Size Based – rotate the log file whenever it reaches a configured size. Set the maximum size for the log file in Maximum Log File Size (MB) field and the maximum number of error log files to retain in Maximum Files to Retain field.
Time Based – rotate the log file whenever configured time is reached. Set the start time, rotation frequency, and retention period.
Review the settings. If the settings are correct, click Apply to apply the changes. If the settings are incorrect, or you decide to not apply the changes, click Revert to return to the original settings.
Restart Oracle HTTP Server. See Section 4.1.4.
To configure an access log for Oracle HTTP Server using Fusion Middleware Control, do the following:
Navigate to the Oracle HTTP Server home page.
Select Log Configuration from the Administration menu.
The following access log configuration tasks can be set from this page:
Log format specifies the information included in the access log file and the manner in which it is written. To add a new access log format or to edit or remove an existing format, do the following:
From the Log Configuration page, navigate to the Access Log section.
Click Manage Log Formats.
The Manage Custom Access Log Formats page is displayed, as shown in the following figure.
Select an existing format to change or remove, or click Add Row to create a new format.
If you choose to create a new format, then enter the new log format in the Log Format Name field and the log format in the Log Format Pattern field.
See Also:
Refer to the Apache documentationClick OK to save the new format.
To configure an access log for file Oracle HTTP Server, do the following:
From the Log Configuration page, navigate to the Access Log section.
Click Create to create a new access log, or select a row from the table and click Edit button to edit an existing access log file.
The Create or Edit Access Log page is displayed.
Enter the path for the access log in the Log File Path field. This directory must exist before you enter it.
Select an existing access log format from the Log Format menu.
Select a rotation policy.
No Rotation – if you do not want to have the log file rotated ever.
Size Based – rotate the log file whenever it reaches a configured size. Set the maximum size for the log file in Maximum Log File Size (MB) field and the maximum number of error log files to retain in Maximum Files to Retain field.
Time Based – rotate the log file whenever configured time is reached. Set the start time, rotation frequency, and retention period.
Click OK to continue.
Note that you can create multiple access log files.
This section discuss Oracle HTTP Server error and access log-related directives in the httpd.conf
file. The directives discussed are:
Oracle HTTP Server by default uses Oracle Diagnostic Logging (ODL) for generating diagnostic messages. The following directives are used to setup logging using ODL:
Enables you to choose the format in which you want to generate log messages. You can choose to generate log messages in the legacy Apache, ODL text, or ODL XML format.
OraLogMode Apache | ODL-Text | ODL-XML
Default value: ODL-Text
For example: OraLogMode ODL-XML
Note:
The Apache log directivesErrorLog
and LogLevel
are only effective when OraLogMode
is set to Apache
. When OraLogMode
is set to either ODL-Text
or ODL-XML
, the ErrorLog
and LogLevel
directives are ignored.Specifies the path to the directory that contains all log files. This directory must exist.
This directive is used only when OraLogMode
is set to either ODL-Text
or ODL-XML
. When OraLogMode
is set to Apache
, OraLogDir
is ignored and ErrorLog
is used instead.
OraLogDir <path>
Default value: ORACLE_INSTANCE
/diagnostics/logs/OHS/<ohs_name>
For example: OraLogDir /tmp/logs
Enables you to set message severity. The message severity specified with this directive is interpreted as the lowest desired message severity, and all messages of that severity level and higher are logged.
This directive is used only when OraLogMode
is set to either ODL-Text
or ODL-XML
. When OraLogMode
is set to Apache
, OraLogSeverity
is ignored and LogLevel
is used instead.
OraLogSeverity <msg_type>[:msg_level]
Default value: WARNING:32
For example: OraLogSeverity NOTIFICATION:16
Message types can be specified in upper or lower case, but appear in the message output in upper case. This parameter must be of one of the following values:
INCIDENT_ERROR
ERROR
WARNING
NOTIFICATION
TRACE
This parameter must be an integer in the range of 1–32, where 1 is the most severe, and 32 is the least severe. Using level 1 will result in fewer messages than using level 32.
Enables you to choose the rotation policy for an error log file. This directive is used only when OraLogMode
is set to either ODL-Text
or ODL-XML
. When OraLogMode
is set to Apache
, OraLogRotationParams
is ignored.
OraLogRotationParams <rotation_type> <rotation_policy>
Default value: S 10:70
For example: OraLogRotationParams T 43200:604800 2009-05-08T10:53:29
This parameter can either be S
(for sized-based rotation) or T
(for time-based rotation).
When rotation_type is set to S
(sized-based), set the rotation_policy parameter to:
maxFileSize:allFilesSize
(in MB)
For example, when configured as 10:70
, the error log file is rotated whenever it reaches 10MB in size and a total of 70MB is allowed for all error log files (a maximum of 70/10=7 error log files will be retained).
When rotation_type is set to T
(time-based), set the rotation_policy parameter to:
frequency(in sec) retentionTime(in sec) startTime(in YYYY-MM-DDThh:mm:ss)
For example, when configured as 43200:604800 2009-05-08T10:53:29
, the error log is rotated every 43200 seconds (that is, 12 hours), rotated log files are retained for maximum of 604800 seconds (7 days) starting from May 5, 2009 at 10:53:29.
Although Oracle HTTP Server uses ODL by default for error logs, you can configure the OraLogMode
directive to Apache
to generate error log messages in the legacy Apache message format. The following directives are discussed in this section:
The ErrorLog
directive sets the name of the file where the server logs any errors it encounters. If the file-path is not absolute then it is assumed to be relative to the ServerRoot.
This directive is used only when OraLogMode
is set to Apache
. When OraLogMode
is set to either ODL-Text
or ODL-XML
, ErrorLog
is ignored and OraLogDir
is used instead.
The LogLevel
directive adjusts the verbosity of the messages recorded in the error logs.
This directive is used only when OraLogMode
is set to Apache
. When OraLogMode
is set to either ODL-Text
or ODL-XML
, LogLevel
is ignored and OraLogSeverity
is used instead.
The LogFormat
directive specifies the format of the access log file. By default, Oracle HTTP Server comes with the following four access log formats defined:
LogFormat "%h %l %u %t \"%r\" %>s %b" common LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined LogFormat "%{Referer}i -> %U" referer LogFormat "%{User-agent}i" agent
The CustomLog
directive is used to log requests to the server. A log format is specified and the logging can optionally be made conditional on request characteristics using environment variables. By default, the access log file is configured to use the common log format.
You can search, view, and list Oracle HTTP Server log files using Fusion Middleware Control, or you can download a log file to your local client and view the log files using another tool.
You can also use the text editor of your choice to view Oracle HTTP Server log files directly from the ORACLE_INSTANCE
directory. By default, Oracle HTTP Server log files for are located in the ORACLE_INSTANCE
/diagnostics/logs/OHS/<ohs_name>
directory.
As discussed in Section 7.1, "Introducing Server Logs", there are mainly two types of log files for Oracle HTTP Server: error logs and access logs. The error log file is an important source of information for maintaining a well-performing server. The error log records all of the information about problem situations so that the system administrator can easily diagnose and fix the problems. The access log file contains basic information about every HTTP transaction that the server handles. This information can be used to generate statistical reports about the server's usage patterns.
See Also:
For information about searching and viewing log files, see Oracle Fusion Middleware Administrator's Guide