Select language:

Background documentationicm/HTTP/logging_<xx>

 

You use this parameter to control the HTTP logging in the ICM (or Web dispatcher) if the ICM is functioning as a server. If the ICM has the client role, you use parameter icm/HTTP/logging_client_<xx> to log the HTTP requests.

More information about logging: Logging in the ICM and Web Dispatcher.

Structure

Work area

Internet Communication Manager, SAP Web Dispatcher

Unit

Character string

Standard value

-

Dynamically changeable

No

Value Range and Syntax

This parameter has the following syntax:

Syntax Syntax

  1. icm/HTTP/logging_<xx> =  PREFIX=<URL prefix>, LOGFILE=<log file name> 
    [, LOGFORMAT=<format>, FILTER=<filter>, MAXSIZEKB=<size in KBytes>, 
    SWITCHTF=<options>, FILEWRAP=on]
End of the code.

This is explained below.

PREFIX

URL prefix that is called for this HTTP subhandler (for example, /).

For more information, see Processing HTTP Requests

LOGFILE

Name of the output file in the file system.

With each restart the ICM checks whether the file specified as the log file exists. If it does it continues to write to this file, if it does not, it creates a new file.

You can attach another timestamp to the actual file name. The options below are available for specifying the log file.

%d

Day of the month (1-31)

%m

Month (1-12)

%y

Year, in the format YYYY

%h

Hour (0-23)

%t

Minute (0-59)

%s

Second (0-59)

%%

% character

Example Example

If you want to assign the date and time to the file name, you can set parameter icm/HTTP/logging_<xx> as follows: LOGFILE=access_log-%d-%m-%y_%h:%t:%s

This creates a log file with the name: access_log-15-10-2007_16:51:53.

Caution: In Windows colons are not permitted in file names.

If you want a log file to be written once a month set the name as follows: LOGFILE=access_log-%y-%m. This creates a log file with the name: access_log-2007-10.

End of the example.
LOGFORMAT

There are the following predefined formats for log files:

  • CLF

    Common log file format:

    10.18.104.36 - - [15/Oct/2007:16:18:35 +0100] "GET /dummy?para=100&user=sap HTTP/1.0" 200 86

    The following string creates the CLF format: %h %l %u %t "%r" %s %b

  • CLFMOD

    Modifiied common log file format: The form fields and URI parameters are not written to the trace file (for security reasons these values are not saved to the log file.) Example from above:

     10.18.104.36 - - [15/Oct/2007:16:18:35 +0100] "GET /dummy HTTP/1.0" 200 86

    The following string creates the CLFMOD format: %h %l %u %t "%r2" %s %b

  • SAP

    SAP log file format - here the processing time in milliseconds in the application server is also logged:

     [15/Oct/2007:15:41:35 +0100] 10.18.104.36 - - "GET /dummy HTTP/1.0" 200 86 10

    The SAP format is created by the following string: %t %h %u - "%r2" %s %b %L.

  • SAPSMD

    Log format for tracking HTTP requests using the HTTP header field X Correlation ID:

    [15/Oct/2007:15:41:35 +0100] - "GET /dummy HTTP/1.0" 200 86 [10] h[A7594F39ED9F7C41BABA7397F8070718-1-5] |

    The following string creates the SAPSMD format: %t - "%r0" %s %b [%L] h[%{X-CorrelationID}i]

  • SAPSMD2

    Log format for tracking HTTP requests using the HTTP header field X Correlation ID:

    This log format contains the output of the full request and response header.

    The SAPSMD2 format is created by the following string: %t - "%r0" {%{[?]}i} %s %b [%L] {%{[?]}o}

  • User-Defined Formats

    If you want to use another format, you can configure this using the format string.

    You can use the following place holders for this:

    Properties of Request and Response

    %b

    Length of the response in bytes

    %r0 or %r

    1. Line of an HTTP request with the original path and form fields: For example, GET /sap(bD1kZSZjPTAwMA==)/bc/ping?lang=de HTTP/1.0

    %r1

    1. Line of an HTTP request with the original path without form fields: For example, GET /sap(bD1kZSZjPTAwMA==)/bc/ping HTTP/1.0

    %r2

    1. Line of an HTTP request with URL-decoded path without form fields: For example, GET /sap/bc/ping HTTP/1.0

    %f

    Name of requested object without form fields

    %U

    Whole URI of a request (with form fields)

    %s

    OK code of the response

    %p0

    Whole original URI of a request (with form fields), equivalent to %U

    %p1

    Whole original URI of a request (without form fields)

    %p2

    URL-decoded path without form fields, equivalent to %f

    %p3

    URL-decoded path with form fields

    %{name}i

    Name of a request header field, e.g. %{user-agent}i

    %{[?]}i

    Output of all request header fields in format [name1 : value1][name2 : valuet2]...

    %{?;}i

    Output of all request header fields in format name1 : value1;name2 : value2; … ;name_n : value_n

    You are free to choose the separators between each header field.

    %{name}o

    Name of a response header field, e.g. %{server}o

    %{[?]}o

    Output of all response header fields in format [name1 : value1][name2 : valuet2]...

    %{?;}o

    Output of all response header fields in format name1 : value1;name2 : value2; … ;name_n : value_n

    You are free to choose the separators between each header field.

    %{cookie}c

    Output of a request cookie

    %{cookie}C

    Output of a response cookie

    %{formfield}F

    Name of a request form field, for example, %{sap-client{F

    %{semfield}E

    Name of a semicolon field

    %T

    Duration of a request in seconds

    %L

    The duration of a request in milliseconds

    %j

    Protocol: HTTP or HTTPS

    Hosts and Ports

    %h

    Name of the remote host (the client, such as the browser)

    %h0

    Like %h

    %h1

    If the header field x-forwarded-for is set, this is the value of the header field, otherwise it is the name of the host directly in front of the ICM (or the Web dispatcher), that is, the client, for example, the browser.

    %H

    Name of local host

    %V

    Fully-qualified host name (FQHN) of the server (value of parameter icm/host_name_full or FQHN of the operating system).

    %v

    Name of the virtual host (IP address or name of the server with which the client is linked)

    %a

    IP address of the remote host

    %S

    Local port name or service

    Other

    %l

    Specifies the “remote log name”. This name is the result of an IDENT query to the client. This only works if the identity check is activated there.

    %u

    User name of 401 authentication

    Caution Caution

    If single sign-on is active, you will only see a - here.

    End of the caution.

    %t

    Time specification in CLF format: [15/Dec/2007:16:18:35 +0100]

    %q

    HTTP request ID in following notation: <conn slot>/<conn uid>/<rq id>

    The following applies here: <conn slot>/<conn uid> describes the ICM connection.

    <rq id> is the sequential number of the HTTP request in the connection. The HTTP request ID is unique for the life span of the ICM process.

    %M1

    Recording of HTTP requests in microseconds, in the form

    t0(pfclock):…;dt1(us):…;dt2(us):…;dt3(us):…;dt4(us):-;total(us):

    The times of the recording are:

    • 0: Start of HTTP request processing

    • 1: Request is sent to the server

    • 2: End of HTTP request processing

    • 3: Start of HTTP response processing

    • 4: End of HTTP response processing

      Since this time point comes after the HTTP log entry has been written, it is not recorded in the HTTP log.

    The absolute value of the time point 0 is the value of the ABAP command GET RUN TIME. The remaining values are recorded as delta values.

    %M2

    Recording of HTTP requests in microseconds, in the form

    t0(timeofday):…;dt1(us):…;dt2(us):…;dt3(us):…;dt4(us):-;total(us):…

    As with placeholder %M1, the absolute value of the time point 0 is the value of the operating system function gettimeofday.

    %m1

    like %M1, but in milliseconds

    %m2

    like %M2, but in milliseconds

    %B1

    Back-end type, possible values: ABAP, JAVA, NET.

    • ABAP: Logging is active in the ICM and the request is forwarded to AS ABAP

    • JAVA: Logging is active in the ICM and the request is forwarded to AS JAVA

    • NET: Logging is active in the Web Dispatcher. The request is sent through the network to an ICM of the SAP system.

    %B2

    Backend information is output; the WP number is output for ABAP and the cluster ID for JAVA.

    Example Example

    With the format: %h %l %u %t "%r" %s %b %B1:%B2 the following entries are written:

    127.0.0.1 - - [08/Mar/2007:21:19:25 +0100] "GET /sap/public/icf_info/icr_urlprefix HTTP/1.0" 200 11376 ABAP:1

    10.18.203.72 - - [08/Mar/2007:21:20:03 +0100] "GET /images/title.gif HTTP/1.1" 304 - JAVA:606993150

    In the first case, the request went from the ICM to the AS ABAP and was processed there by work process 1. In the second case, the request went from the ICM to the AS Java and was processed by the server process with the cluster ID 606993150.

    End of the example.

    Example Example

    You can reproduce the “NCSA Combined Log Format” known to other Web servers by using the following format string:

    LOGFORMAT=%h %l %u %t "%r" %s %b "%{referer}i" "%{user-agent}i"

    End of the example.

    Note Note

    Performance is significantly better when predefined log file formats are used rather than your own format strings, as with predefined formats each element of the format string has to be determined and output separately.

    End of the note.
FILTER

The filter property specifies that an HTTP request is logged only when a certain header field (for example, an HTTP header field) is in the request or response. If more than one field is specified in a filter, the fields are linked with an "or".

Specification of a value is optional. If no value is specified, a check is made to confirm whether the field exists.

If an \ precedes the name or value of the field, the characters '=', '}', and '\' can be escaped. The attribute filter has the following syntax:

Syntax Syntax

  1. FILTER= {name}typ[={wert}] [ ; {name}type[={wert}] ] ...
End of the code.

A filter can contain the following fields:

  • {name}i[={value}] filter for a request header field, e.g. {X Correlation ID}i

  • {name}o[={value}] filter for a response header field

  • {name}c[={value}] filter for a request cookie

  • {name}F[i][={value}] filter for a request form field, e.g. {color}F={green} or {color}Fi={green}

  • {name}E[i][={value}] filter for a request semicolon field

Example Example

The FILTER attribute can, for instance, have the following value:

FILTER={color}F={green};{color}F={yellow};{size}F

The HTTP request is then logged if the request contains a form field, color that has the value green or yellow, or if it contains a form field size with any value.

End of the example.

Names of header fields and cookie fields are not case-sensitive. Names of form fields and semicolon fields are case-sensitive, except if an i is specified after the type. The "i" means that the case of the field name is relevant for this filter.

There are the following predefined filters:

SAPSMD: with the form {X Correlation ID}i

If this predefined filter is set, only those requests that contain the header field X.CorrelationId are logged. The filter is independent of the selected log file format (see above)

MAXSIZEKB

MAXSIZEKB is the maximum size of the log file in kilobytes.

If this size is exceeded, the current file is closed and a new one (with a new name) is opened.

The new file name is unique (this is achieved by specifying time and date fields, see above), or else is made unique by adding _xx to the end (where xx is a number increasing from 0).

Note Note

If FILEWRAP=on was selected, no new file is opened (see below).

End of the note.
SWITCHTF

A new log file can not only be created if the file has reached a certain size, but also when the time data changes:

Hour

A new log file is opened every hour

Day

A new log file is opened every day

Month

A new log file is opened every month

FILEWRAP

If FILEWRAP=on is active, every time a new file is opened, the existing log file is reset and overwritten. Therefore, there is always only one log file with the current log data.

If you omit this option, once the size has been exceeded a new file is written (see above).

Example Example

PREFIX=/, LOGFILE=dev_http_access_log, SWITCHTF=day, FILEWRAP=on

End of the example.

Example

  • Example of Predefined Log Format:

    icm/HTTP/logging_0 = PREFIX=/, LOGFILE=access_log-%y-%m, MAXSIZEKB=10000, SWITCHTF=day, LOGFORMAT=SAPSMD

  • Example of Predefined Log Format:

    icm/HTTP/logging_0 = PREFIX=/, LOGFILE=access_log-%y-%m, MAXSIZEKB=10000, SWITCHTF=day, LOGFORMAT=%t %h %u - "%r2" %s %b %L

    This user-defined format correponds to the SAP format SAPSMD.

More Information

Note the following documentation associated with this parameter:

Generic Profile Parameters with Ending _<xx>

icm/HTTP/logging_Client_<xx>

Logging in the ICM and Web Dispatcher

Was this page helpful to you?