KB Article #176899

Access Log support for Apache Server Access Log format

Problem

The API Gateway User Guide states that the Access Log supports Apache HTTP Server Access Log format.

http://httpd.apache.org/docs/current/mod/mod_log_c...

What variables from this list does the API Gateway support?

Resolution

The following variables will be available in the API Gateway Access Log pattern :-

%a - Remote IP address *
%A - Local IP address *
%b - Bytes sent, excluding HTTP headers, or '-' if no bytes * were sent *
%B - Bytes sent, excluding HTTP headers *
%h - Remote host name (or IP address if enableLookups for the connector is false) *
%H - Request protocol *
%l - Remote logical username from identd (always returns '-') *
%m - Request method *
%p - Local port *
%q - Query string (prepended with a '?' if it exists, otherwise * an empty string *
%r - First line of the request *
%s - HTTP status code of the response *
%S - User session ID *
%t - Date and time, in Common Log Format format *
%{format}t - Date and time, in any format supported by SimpleDateFormat *
%u - Remote user that was authenticated *
%U - Requested URL path *
%v - Local server name *
%D - Time taken to process the request, in millis *
%T - Time taken to process the request, in seconds *
%I - current Request thread name (can compare later with stacktraces) *


Note that any message attribute would work in the pattern also.

e.g. %{http.request.url}r

Here is the Access Log default settings in 7.3.1. To switch on the access log make sure "Enable Apache Access File Logger" is enabled and Access Logging is switched on in the required path as below.

imageecb84d0438f4a8b4670b76422f53c94a_000.png

imagec53bba73c2380271f7d95374f872409b_000.png