For z/OS platforms

Enabling request logging for Liberty on z/OS

The z/OS® Request Logging feature, zosRequestLogging-1.0, collects information about HTTP requests and records the information to the z/OS SMF data store. When the z/OS Request Logging feature is activated and RACF® is set up correctly, SMF type 120 subtype 11 version 2 and version 3 records are generated. No data is captured for portions of the request that are created asynchronously.

Procedure

  1. Enable request logging by adding the zosRequestLogging-1.0 feature in the featureManager element of the server.xml configuration file.
    <feature>zosRequestLogging-1.0</feature>
  2. Configure RACF to write the SMF records by issuing the following commands:
    RDEFINE FACILITY BPX.SMF UACC(NONE)                      
    PERMIT BPX.SMF ID(MSTONE1) ACCESS(READ) CLASS(FACILITY)  
    SETROPTS GENERIC(FACILITY) REFRESH                       
    SETROPTS RACLIST(FACILITY) REFRESH 
  3. Optional: Add user data to the SMF records by invoking the UserData API in your servlets.

    A servlet can use the UserData add method to add its own request-specific data to the SMF 120, subtype 11, version 2 and version 3 record that gets written for the HTTP request. The UserData interface is in the com.ibm.websphere.zos.request.logging package.

    The following example shows how a servlet can add its own request-specific data to the SMF record:
    InitialContext ic = new InitialContext();
        try {
                UserData userData = (UserData) ic.lookup("com/ibm/websphere/zos/request/logging/UserData");
                int rc = userData.add(65535,"My request-specific data");
        } catch (NamingException e) {
    }

Results

Your Liberty server will log information about HTTP requests in SMF 120, subtype 11, version 2 and version 3 records. For information about how the resulting data is mapped, see SMF type 120, subtype 11, version 2 and version 3 record mapping.