This documentation is for WSO2 Enterprise Service Bus version 4.9.0 . View documentation for the latest release.

All docs This doc

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The access logs contain entries for service and REST API invocations and for Management Console access. The service/API invocation log resides in the Access logs keep track of access to parts of WSO2 ESB. There are two types of access logs in WSO2 ESB:

  1. Service and REST API invocation access log: tracks when a service or REST API is invoked 
  2. Management Console access log: tracks usage of the Management Console

Anchor
service
service
Service and REST API Invocations Access Log

By default, the service/API invocation access logs are disabled for performance reasons. 

If you want to enable them, change the log level from WARN to INFO for the following entry in the <ESB_HOME>/repository/conf/log4j.properties configuration file.

Code Block
languagexml
log4j.logger.org.apache.synapse.transport.http.access=INFO

Once enabled, the service/API invocation access logs will be written into the <ESB_HOME>/repository/logs folder and has a  folder with the default name of of http_access_<YYYY>_<MM>_<DD>.log. For example, such as  http_access_20132016_0108_0120.log will be created for activity on January 1August 20, 2013. Similarly, the Management Console access log is written to the file <ESB_HOME>/repository/logs/http_access_management_console_<YYYY>_<MM>_<DD>.log. Both access logs are rotated daily.To customize the Management Console access log, including the location where the file is written and the format, you can edit the < ESB2016. The log is rotated on a daily basis.

You can customize the format of this access log by using the following properties in the <ESB_HOME>/repository/conf/tomcat/catalina-server.xml  file. In the catalina-server.xml file, under valves you can find the following access log configuration where you can modify the  org.apache.catalina.valves.AccessLogValve attributes.

Code Block
languagexml
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="${carbon.home}/repository/logs"
               prefix="http_access_management_console_" suffix=".log"
               pattern="combined" />

The access log entries for service/API invocations use a modified version of the Apache combined log format, as follows:

...

access-log.properties configuration file:

  • File location:
    access_log_directory=/logs/wso2esblogs
  • File prefix:
    access_log_prefix=http_access_
  • File suffix:
    access_log_suffix=.log
  • File date format: 
    access_log_file_date_format=yyyy-MM-dd
  • Log pattern: 
    access_log_pattern=%{X-Forwarded-For}i

...

  • %h

...

  • %l

...

  • %u

...

  • %t

...

  • \"%r\"

...

  • %s

...

  • %b

...

  • \"%{

...

  • Referer}i\"

...

  • \"%{User-Agent}i\"

...


  • This default log pattern uses a modified version of the Apache combined log format. The X-Forwarded-For header is appended to the beginning of the usual combined log format

...

  • to correctly identify the original node that sent the request when requests may go through a proxy such as a load balancer. The X-Forwarded-For header must be present in the incoming request for this to be logged.

...

  • You can

...

You can log synapse/axis2 API requests in a configurable file using the <ESB_HOME>/repository/conf/access-log.properties file.

If you want to log synapse/axis2 API requests in a custom directory, add the access_log_directory property to the <ESB_HOME>/repository/conf/access-log.properties file and specify the path to the custom directory. For example, access_log_dire ctory="/logs/wso2esblogs"Similarly, you can configure the following properties in the <ESB_HOME>/repository/conf/access-log.properties file based on the log format you want to have for synapse/axis2 API requests.

  • Default access log pattern
    e.g.,modify this property to use other log patterns as follows:
  • %{X-Forwarded-For}i
    • %h %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-Agent}i\"
  • combined

  • e.g.,  

    • access_log_pattern=%h %l %u %t \"%r\" %s %b
  • \"%{Referer}i\" \"%{User-Agent}i\"
  • common log pattern
    e.g.,  access_log_pattern=%h %l %u %t \"%r\" %s %b

  • file prefix
    e.g.,  access_log_prefix=http_access_

  • file suffix
    e.g.,  access_log_suffix=.log

  • file date format
    e.g.,  access_log_file_date_format=yyyy-MM-dd

The Custom Logger supports the below attributes.

AttributeDescription
%a

Remote IP address

%A

Local IP address

%b

Bytes sent, excluding HTTP headers, or '-' if zero

%B

Bytes sent, excluding HTTP headers

%c

Cookie value

%C

Accept header

%e

Accept Encoding

%E

Transfer Encoding

%h

Remote host name (or IP address if enableLookups for the connector is false)

%l

Remote logical username from identd (always returns '-')

%L

Accept Language

%k

Keep Alive

%m

Request method (GET, POST, etc.)

%n

Content Encoding

%r

Request Element

%s

HTTP status code of the response

%S

Accept Chatset

%t

Date and time, in Common Log Format

%T

Content Type

%u

Remote user that was authenticated (if any), else '-'

%U

Requested URL path

%v

Local server name

%V

Vary Header

%x

Connection Header

%Z

Server Header

Anchor
mgmt
mgmt
Management Console Access Log

By default, the Management Console access log is written to the <ESB_HOME>/repository/logs/http_access_management_console_<YYYY>_<MM>_<DD>.log file. It is rotated on a daily basis. 

To customize the Management Console access log, including the location where the file is written and the format, you can edit the <ESB_HOME>/repository/conf/tomcat/catalina-server.xml file. In this file, under "Valves", you can find the following access log configuration where you can modify the org.apache.catalina.valves.AccessLogValve attributes.

Code Block
languagexml
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="${carbon.home}/repository/logs"
               prefix="http_access_management_console_" suffix=".log"
               pattern="combined" />

For more information, see AccessLogValve in the Apache Tomcat documentation.