Setting up the z/OS Connect file system logger interceptor

The file system logger interceptor enables z/OS Connect users to log request information in a file system file.

About this task

This function is available when you configure the zosConnect-1.0 or zosConnect-1.2 features and it requires configuration.

Stabilized features: The zosConnect-1.0 and zosConnect-1.2 features are stabilized. You can continue to use the features. However, consider using the IBM z/OS Connect Enterprise Edition product.
Table 1. Descriptions of the entries that are in the generated log file
Entry Description
DateTime The date and time that is calculated by the logger interceptor before the service invocation
ThreadID The ID of the thread under which the service request is being processed
UserName The user name for which the request is being processed
RequestID The request tracking ID that is generated by z/OS Connect
RemoteAddress The Internet Protocol (IP) address of the client who originated the request or last proxy that sent the request
LocalAddress The Internet Protocol (IP) address of the interface on which the request was received
MessageType Identifies whether the payload is from a request or a response
MessageSize The character size of the payload
MessageData A request or response payload
*****************************************************************************
ServerName: com.ibm.ws.zos.connect.interceptor.logger.fs
*****************************************************************************
DateTime:2015-07-19_12-14-02 | ThreadId:47 | UserName:Fred | RequestID:0000000000000001000000000000000000000000000000 | 
RemoteAddress:127.0.0.1 | LocalAddress:127.0.0.1
MessageType:REQUEST
MessageSize:27
MessageData:{"payload":"HELLO_SERVICE"}

DateTime:2015-07-19_12-14-02 | ThreadId:47 | UserName:Fred | RequestID:0000000000000001000000000000000000000000000000 | 
RemoteAddress:127.0.0.1 | LocalAddress:127.0.0.1
MessageType:RESPONSE
MessageSize:26
MessageData:{"payload":"HELLO_CALLER"}

Procedure

  1. Configure the fileSystemloggerInterceptor element globally.
    <fileSystemloggerInterceptor id="globalFileSystemLogger" logName="globalLog_%SERVERNAME%"/>
    <zosConnectInterceptors id="globalInterceptorList" interceptorRef="globalFileSystemLogger" />
    <zosConnectManager globalInterceptorsRef="globalInterceptorList/>

    In the example, all z/OS Connect service requests are logged in a file that is called globalLog_myServer1_yyyy-MM-dd_HH_mm_ss_SSS.log where myServer1 is the name of the server. The only required configuration element is the logName attribute definition. The configuration element accepts a %SERVERNAME% string that is replaced with the name of the server when the log is created. The default log file location is ${server.output.dir}/logs/zosConnect. For more information on the available configuration attributes and default values see the documentation for z/OS Connect 1.0 and z/OS Connect 1.2.

    You can also configure the fileSystemloggerInterceptor element for specific services.
     <fileSystemloggerInterceptor id="serviceYFileSystemLogger" 
                                     logName="service1Log" 
                                     logPath="/zosConnect/logs"
                                     logOption="RESPONSE"
                                     maxPayloadSize="30720"/>
    <zosConnectInterceptors id="serviceYInterceptorList" interceptorRef="serviceYFileSystemLogger" />
    <zosConnectService serviceName="serviceY" serviceRef="serviceY" interceptorsRef="serviceYInterceptorList"/>
    <usr_myService id="serviceY"/>

    In the example, all z/OS Connect service requests are logged in a file that is called service1Log_yyyy-MM-dd_HH_mm_ss_SSS.log and is located in the path /zosConnect/logs. The log path is a fully qualified path. Only response data is logged for all incoming requests that target serviceY. Because the maximum JSON payload is configured to be 30,720 characters, any JSON (response) payload that is greater than 30,720 characters is truncated to the configured maximum payload size.

  2. (Optional) Configure the bufferedLogging and the bufferSize attribute definitions to enable buffered logging. The default buffer size is 8 kilobytes. All records in the buffer are flushed to the disk when the buffer becomes full. Using buffered logging is appropriate when performance is a concern and when loss of unflushed records during a failure condition is acceptable.
     <fileSystemloggerInterceptor id="globalFileSystemLogger" 
                                     logName="globalLog_%SERVERNAME%"
                                     bufferedLogging="true"
                                     bufferSize="16384"/>
  3. (Optional) Configure the rollOffLogPolicy attribute. This policy states that when the active log file reaches the specified or default file size of 50 megabytes, a new file is created. A new file can also be created when the specified or default time of 24 hours expires since the active log file was created. In the following example, a file is created when the file reaches 16 kilobytes in size. The naming schema is the same: globalLog_myServer1_yyyy-MM-dd_HH_mm_ss_SSS.log. The difference between the names of the created log files is the time stamp that is used when a given file is created:
    <fileSystemloggerInterceptor id="globalFileSystemLogger" 
                                     logName="globalLog_%SERVERNAME%"
                                     rollOffLogPolicy="SIZE"
                                     rollOffLogPolicySize="16384"/>