Possible changes to log settings
search cancel

Possible changes to log settings

book

Article ID: 51115

calendar_today

Updated On:

Products

Clarity PPM SaaS Clarity PPM On Premise

Issue/Introduction

How can I change my app-system.log settings so that it will roll over on a monthly, weekly, or daily basis?

or

How can I change my app-system.log settings so that it contains more detail?

Symptoms:

My app-system log is getting very large. I want to change the settings so that it will not grow too large.

Resolution

  1. Open deploy.xml in the \clarity_home\.setup\scripts\j2ee\tomcat folder.
     
  2. Locate the following section.
    <apply parent="/Server/Service/Engine/Host" select="Valve"><![CDATA[<Valve className="org.apache.catalina.valves.FastCommonAccessLogValve"directory="${install.dir}/logs" prefix="${app.id}-access-" suffix=".log"pattern="common" resolveHosts="false"/>]]></apply>
  3. In order to get more meaningful data out of the access.log you can change the pattern= parameter so that it contains any of the following settings:

    Values for the pattern attribute are made up of literal text strings, combined with pattern identifiers prefixed by the "%" character to cause replacement by the corresponding variable value from the current request and response. The following pattern codes are supported:
     
    • %a - Remote IP address
    • %A - Local IP address
    • %b - Bytes sent, excluding HTTP headers, or '-' if zero
    • %B - Bytes sent, excluding HTTP headers
    • %h - Remote host name (or IP address if resolveHosts is false)
    • %H - Request protocol
    • %l - Remote logical username from identd (always returns '-')
    • %m - Request method (GET, POST, etc.)
    • %p - Local port on which this request was received
    • %q - Query string (prepended with a '?' if it exists)
    • %r - First line of the request (method and request URI)
    • %s - HTTP status code of the response
    • %S - User session ID
    • %t - Date and time, in Common Log Format
    • %u - Remote user that was authenticated (if any), else '-'
    • %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)

      You may also write information from the cookie, incoming header, outgoing response headers, the Session or other items in the ServletRequest. The format is modeled after the apache syntax:
       
    • %{xxx}i for incoming request headers
    • %{xxx}o for outgoing response headers
    • %{xxx}c for a specific request cookie
    • %{xxx}r xxx is an attribute in the ServletRequest
    • %{xxx}s xxx is an attribute in the HttpSession

      The shorthand pattern name "common" (which is also the default) corresponds to '%h %l %u %t "%r" %s %b'.

      The shorthand pattern name "combined" appends the values of the Referer and User-Agent headers, each in double quotes, to the common pattern described in the previous paragraph.

      EXAMPLE:
      <apply parent="/Server/Service/Engine/Host" select="Valve"><![CDATA[<Valve className="org.apache.catalina.valves.AccessLogValve"directory="${install.dir}/logs" prefix="${app.id}-access-" suffix=".log"pattern="%h|%t|%r|%s|%b|%D|%{sessionId}c" resolveHosts="false"/>]]></apply>
      If these choices are applied, the access log will now produce the following in a "|" separated format:

      IP address of requestor|
      DateTime of the completed request|
      URL request|
      HTTP Status Code|
      Bytes sent back to the client (excluding the header)|
      Elapsed time of the request (in ms, can be subtracted from the DateTime to
      get the request startTime)|
      Clarity sessionId cookie (a distinct way to group requests, can be tied
      back to the sessions tables in Clarity to find the user)|
       
  4. 4. If you want your logs to rollover on a regular basis, you can add the following parameter:

    fileDateFormat="yyyy-MM-dd.HH"

    This setting will make your logs roll hourly. Other possible values are:

    yyyy-MM Rollover at the beginning of each month
    yyyy-ww Rollover at the first day of each week.
    yyyy-MM-dd Rollover at midnight each day.
    yyyy-MM-dd-a Rollover at midnight and midday of each day
    yyyy-MM-dd-HH Rollover at the top of every hour
    yyy-MM-dd-HH-mm Rollover at the beginning of every minnute.

    Example:
    <apply parent="/Server/Service/Engine/Host" select="Valve"><![CDATA[<Valve className="org.apache.catalina.valves.AccessLogValve"directory="${install.dir}/logs" prefix="${app.id}-access-" suffix=".log"pattern="%h|%t|%r|%s|%b|%D|%{sessionId}c" fileDateFormat="yyyy-ww"resolveHosts="false"/>]]></apply>
  5. Save the file
     
  6. From the command prompt on the Clarity App server run the following commands:
     
    • Niku stop remove app
       
    • Niku add deploy start app

      If you have more than one app service on the server, repeat these commands for all apps on the server.
       
  7. If you have a clustered system, repeat the above step for all app servers in the cluster.

Additional Information