The access log records a summary of the request and response messages that pass through the
API Gateway. By default, the API Gateway records this in the access.log
file
in the log
directory. This file rolls over with a version number added
for each new version of the file (for example, access.log.0
,
access.log.1
, and so on).
The transaction access log file format is based on that used by Apache HTTP Server. This means that the log file can be consumed by third-party Web analytics tools such as Webtrends to generate charts and statistics.
The syntax used to specify the access log file is based on the syntax of available patterns used by the access log files in Apache HTTP Server. For example:
%h %l %u %t "%r" %s %b
The log format strings in this example are explained as follows:
%h |
Remote hostname or IP address. |
%l |
Remote logical username. |
%u |
Remote user that was authenticated (for example, Distinguished Name of a certificate). |
%t |
Date and time of the request in Common Log Format. |
%r |
First line of the request that originated at the client. |
%s |
HTTP status code returned to the client in the response. |
%b |
Bytes sent, excluding HTTP headers. |
The following extract from the access.log
file illustrates the resulting
log format:
s1.oracle.com - lisa [09/05/2012:18:24:48 00] "POST / HTTP/1.0" 200 429 s2.oracle.com - dave [09/05/2012:18:25:26 00] "POST / HTTP/1.0" 200 727 s3.oracle.com - fred [09/05/2012:18:27:12 00] "POST / HTTP/1.0" 200 596 ................ ................ ................
For more details on Apache HTTP Server access log formats, see the following:
To configure the access log in the Policy Studio tree, select the Server Settings node, and click Logging > Transaction Access Log. Alternatively, in the Policy Studio main menu, select Tasks > Manage Gateway Settings > Logging > Transaction Access Log. To confirm updates to these settings, click Apply changes at the bottom right of the window.
You can configure the following fields to enable the server to write an access log to file:
Writing to Transaction Access Log:
Select whether to configure the API Gateway instance to start writing event data to the transaction access log. This setting is disabled by default.
File name:
Enter the name of the access log file. When the file rolls over (because the maximum
file size has been reached, or because the date has changed), a suitable increment is
appended to the file name. Defaults to access
.
File extension:
Enter the file extension for the log file. Defaults to .log
.
Directory:
Enter the directory for the access log file. Defaults to the logs/access
directory of your product installation.
File size (MB):
Specify the maximum size that the log file is allowed reach before it rolls over to a
new file. Defaults to 1000
MB.
Roll log daily:
Select whether to roll over the log file at the start of each day. This is enabled by default.
Number of log files:
Specify the number of log files that are stored. Defaults to 20
.
Format:
Enter the access log file format. This is based on the syntax used in Apache HTTP Server access log files, for example:
%h %l %u %t "%r" %s %b
For more details, see the section called “Access log format”.
![]() |
Important |
---|---|
These settings configure the access log at the API Gateway level. You must also configure the access log at the service level on a specific relative path. For example, in the Policy Studio tree, select the relative path, right-click it in the Resolvers pane, and select Edit. Then click the Logging Settings tab, and select Include in server access log records. For more details, see the API Gateway Policy Developer Guide. |
The default syntax for the access log is as follows:
%h %l %u %t "%r" %s %b
The %r
format string results in the entire HTTP request line being added to the access
log file, including the query string. For example:
127.0.0.1 - - [02/07/2014:12:39:29 00] "POST /healthcheck?name=value HTTP/1.0" 200 19
The query string may contain sensitive information (for example, credit card number, or social security number). If you do not wish the query string to be included in the access log, it is recommended that you use the following format instead:
%h %l %u %t "%m %U% %H" %s %b
For example, this results in the following output instead:
127.0.0.1 - - [02/07/2014:12:39:29 00] "POST /healthcheck HTTP/1.0" 200 19
The "%m %U %H"
options log the method, path, and HTTP version. This results in the same
output as %r
, but without the query string.
To confirm updates to these settings, click Apply changes at the bottom right of the screen. Click Deploy in the toolbar to deploy the updated configuration to the API Gateway.