Configure API Gateway

For the transaction event logs to be correctly recorded, you must check the Policy Studio and the Entity Explorer settings for each monitored API Gateway node.

Policy Studio settings

(tick) Transaction Event logs are generated.


(tick) The processed event logs retention period should be at least a few hours to allow old data catch up after an ADI crash or maintenance period. To allow this, a conversion of a time period into disk space consumption is needed to adapt the parameter "Maximum disk space for event logs"

You can use this formula to determine the space without margin:
     Retention period (in Hours) x 3600 x Message log size (in ko) / 1024 x Throughput (in message log per second)

For example:
2 h x 3600 x 2 ko / 1024 x 250 tr/s = 3515 → 4096 Mo

(info) Message log per second correspond to API Gateway transactions per second

(tick) Best practice: Instances and groups "pretty names" are used in Prebuilt Dashboards. Ensure that they are defined in a user friendly way in API Gateway.

(tick) In Prebuilt Dashboards, each transaction's API Method field might be marked as uncategorized in the case that API Gateway is not running in parallel with API Manager.

In that situation, adapting the policies can help correctly provision values for field API Method: each policy should store a value for the attribute soap.request.method  (even in the case of a REST API). This can be done using the  Set Attribute Filter , and should take place before the Set Service Context filter is executed (see below):

When setting the method this way, small updates are needed in ADI in the 04-API-Integration > collectAndProcessEvents route:

  1. Insert after this line :

            <setHeader headerName="organization"><simple>${body[serviceContexts][0][org]}</simple></setHeader>

    the following line

            <setHeader headerName="methodName"><simple>${body[serviceContexts][0][method]}</simple></setHeader>
  2. Replace this block

            <choice>
              <when>
                <simple>${body[operation]} == null</simple>
                <u:setMapValue key="methodName"><constant>uncategorized method</constant></u:setMapValue>      
              </when>
              <otherwise><u:setMapValue key="methodName"><simple>${body[operation]}</simple></u:setMapValue></otherwise>   
            </choice>


    with

            <choice>
              <when>
                <simple>${header.methodName} == null</simple>
                <u:setMapValue key="methodName"><constant>uncategorized method</constant></u:setMapValue>      
              </when>
              <otherwise><u:setMapValue key="methodName"><header>methodName</header></u:setMapValue></otherwise>   
            </choice>

(tick) In Prebuilt Dashboards, each transaction's APIClient Application and Organization fields might be marked as uncategorized in the case that API Gateway is not running in parallel with API Manager. 

In that situation, adapting the policies can help correctly provision values for fields API and Client Application:

A policy can begin with a "Set Service Context" filter as below, which allows you to define a value in event logs fields transaction.ServiceContext[0].API and transaction.ServiceContext[0].client

By default, the client name is taken from message attribute authentication.subject.id. This is often populated automatically by authentication filters, but if not, you can manually set it using a filter such as the Set Attribute Filter

When setting the Client and Service Name this way, small updates are needed in ADI in the 04-API-Integration > collectAndProcessEvents route to:

  1. Provision each transaction's Client Application attribute with the value found in the transaction.ServiceContect[0].client log field instead of transaction.ServiceContect[0].app field: 

    Replace

    <setHeader headerName="clientApplication"><simple>${body[serviceContexts][0][app]}</simple></setHeader>

    with

    <setHeader headerName="clientApplication"><simple>${body[serviceContexts][0][client]}</simple></setHeader>
  2. Provision each transaction's API attribute with the value found in transaction.ServiceContect[0].service log field instead of transaction.log[0].serviceName field: 

    1. Insert just after this line : 

      <setHeader headerName="clientApplication"><simple>${body[serviceContexts][0][client]}</simple></setHeader>

      the following line: 

      <setHeader headerName="serviceName"><simple>${body[serviceContexts][0][service]}</simple></setHeader>
    2. Replace this block:

      <choice>
        <when>
          <simple>${body[serviceName]} == null</simple>
          <u:setMapValue key="serviceName"><constant>uncategorized service</constant></u:setMapValue>      
        </when>
      </choice> 

      with the following code:

      <choice>
        <when>
          <simple>${header.serviceName} == null</simple>
          <u:setMapValue key="serviceName"><constant>uncategorized service</constant></u:setMapValue> 
        </when>
        <otherwise><u:setMapValue key="serviceName"><header>serviceName</header></u:setMapValue></otherwise>   
      </choice> 

Entity Explorer settings

(tick) Processed event logs should not be deleted

This is needed, if API Analytics is running simultaneously with Embedded Analytics, to prevent any loss of data in case of an ADI maintenance or crash. By default the Node Manager removes event logs files after processing. The following steps are only needed once for each API Gateway node:

  • Launch esexplorer :
    • Under Linux, assuming API Gateway is installed in the /opt/Axway/API/apigateway folder, on a graphical console and connected as axway user, open a terminal window and enter the following commands: 
cd /opt/Axway/API/apigateway/posix/bin
./esexplorer
    • Under Windows, assuming API Gateway is installed in the c:\Axway\apigateway folder, open a command prompt and enter the following commands: 
cd c:\Axway\apigateway\Win32\bin
esexplorer.bat
  • Go to Menu Store > Connect
  • Browse to [apigateway install folder]/conf/fed/configs.xml
  • Select Federated... > System Components > Metrics Generation Configuration
  • Ensure that the following parameters are configured as follows:
    • retainProcessedEventLogs = true
    • dirSizeMb = the configured size should allow retaining at least a few hours of transaction event logs

Related Links