APIM manage workflow with multiple roles APIM 3.0.0 per API based subscription workflow Logging internal HTTP requests Log APIM analytics events to a file Monetization and sample with WSO2 API Manager 2.6.0 Share application and subscription among a set of specific groups or roles WSO2 APIM Correlating analytics event with correlationID APIM analytics distinguish production and sandbox traffic APIM 2.x.x analytics internal and analytics tuneup Configure APIM(Next release) Key Manager User stores APIM(Next release) working with key manager DAS 3.x Parse system variables to Spark Context Revoke OAuth application In APIM 2.1.0 Next WSO2 APIM powered by WSO2 Ballerina Configure WSO2 APIM Analytics on Cluster environment Configure WSO2 DAS 3.1.0 for WSO2 APIM 2.0.0 Analytics WSO2 APIM publishing custom statistics WSO2 APIM Error codes Working with WSO2 message tracer Use DAS admin service to query using Spark SQL Configure WSO2 APIM Analytics using XML WSO2 APIM Generating and Retrieving Custom Statistics Understanding WSO2 APIM Statistics Model Publishing WSO2 APIM 1.10.x Runtime Statistics to DAS with RDBMS Publishing_APIM_1100_Runtime_Statistics_to_DAS Aggregate functions with WSO2 DAS REST API Create a cApp for WSO2 DAS Debugging WSO2 Products using OSGI console. Publishing APIM Runtime Statistics to DAS Deploy cApp on WSO2 DAS How to configure and start the Accumulo minicluster How to setup DNS server on Ubuntu and Ubuntu server How to use Java Reflection how to install apache web server on ubuntu and ubuntu server How to install Mail server on Ubuntu and Ubuntu server How to install squirrelmail webmail client on Ubuntu and Ubuntu Server Pass and return String value to JNI method Pass and return numeric value to JNI method Calling a C Function from the Java Programming Language using JNI AXIS 2 Sample web service Client with maven and eclipse How to setup AXIS 2 with Apache Tomcat AXIS 2 Sample web service with maven and eclipse Robot framework Sample with Selenium Robot framework Custom Library Sample Behaviour-Driven Development with JBehave and Eclipse Play Audio with Netbeans and linking with LibVLC Implement LibVLC based player with QT-part2 Simple Audio playing sample with LibVLC How to install LibVLC on Ubuntu Implement LibVLC based player with QT-part1
Configure WSO2 APIM Analytics using XML
  1. Introduction

    This document describes how to enable APIM analytics with wso2 DAS using a file. Note that in order to configure analytics using XML, APIM should be started or restart after the configuration done.

  2. Configure analytics in APIM 1.10.x

    In 1.10.x analytics can be configured using both UI and XML based. UI configuration is straightforward and the document can be found from here. To configure using XML follow steps mentioned here

      • Open /repository/conf/api-manager.xml
      • Find the Tag APIUsageTracking in the XML and edit the configuration
      • To enable analytics uncomment or set true the Enabled tag
      • Set the DASServerURL value according to DAS receivers
        • Ex: {tcp://localhost:7612/,tcp://localhost:7613/}
      • Set DASUsername and DASPassword according to DAS receivers
      • DASRestApiURL is used to fetch data from DAS REST API
      • Set it as according to DAS master node
      • Set DASRestApiUsername and DASRestApiPassword according to DAS REST
      • Leave other configuration as default
      • Configure Statistics client
          • By default, APIM is configured for DAS REST client
          • In order to select RDBMS Client set the StatisticClientProvider as follow in <APIM_HOME>/repository/conf/api-manager.xml
        	<!-- For APIM implemented Statistic client for DAS REST API -->
                <StatisticClientProvider>org.wso2.carbon.apimgt.usage.client.impl.APIUsageStatisticsRestClientImpl</StatisticClientProvider>
        
          • Since RDBMS client need to define Datasource, define following configuration on both <APIM_HOME>/repository/conf/datasources/master-datasources.xml and <DAS_HOME>/repository/conf/datasources/master-datasources.xml
        <datasource>
            <name>WSO2AM_STATS_DB</name>
            <description>The datasource used for registry and user manager</description>
            <jndiConfig>
                <name>jdbc/WSO2AM_STATS_DB</name>
            </jndiConfig>
            <definition type="RDBMS">
                <configuration>
                    <url>jdbc:mysql://localhost:3306/APIM_STAT?autoReconnect=true&</url>
                    <username>root</username>
                    <password>pass</password>
                    <driverClassName>com.mysql.jdbc.Driver</driverClassName>
                    <maxActive>50</maxActive>
                    <maxWait>60000</maxWait>
                    <testOnBorrow>true</testOnBorrow>
                    <validationQuery>SELECT 1</validationQuery>
                    <validationInterval>30000</validationInterval>
                    <defaultAutoCommit>false</defaultAutoCommit>
                </configuration>
            </definition>
        </datasource>
        
        • Copy appropriate RDBMS driver into both DAS and APIM /repository/components/lib directory
      • Deploy cApp
        • Since summarization logic need is defined in the DAS capp, it needs to be deployed in the all the DAS nodes. When analytics configure using UI cApp will deploy automatically. In when configured using XML it needs to be deployed manually. APIM analytics Capp can be find in <APIM_HOME>/statistics/ directory. Used API_Manager_Analytics_RDBMS.car for RDBMS configuration and API_Manager_Analytics_REST.car for REST client. There are two way to deploy capp into DAS
          • Copy <APIM_HOME>/statistics/API_Manager_Analytics_RDBMS.car into <DAS_HOME>/repository/deployment/server/carbonapps/ directory. If carbonapps not exist create a directory. Then restart the DAS
          • Start DAS and logging the DAS management Console. Then find the “Carbon Applications” section under the main menu. Select Add and deploy the Capp form <APIM_HOME>/statistics/ directory.
    <!--
            API usage tracker configuration used by the DAS data publisher and
            Google Analytics publisher in API gateway.
        -->
        <APIUsageTracking>
    
            <!--
                Below property is used to enable API Manager analytics configuration via api-manager.xml
                Enabling analytics via a configuration file can be useful in scenarios such as automated deployments where
                UI integration is inconvenient.
    
                If you uncomment this property, analytics configurations added via admin-dashboard UI will
                get overwritten by tha configuration details provided below when you restart the server.
            -->
            <Enabled>true</Enabled>
    
            <!--
                Server URL of the remote DAS/CEP server used to collect statistics. Must
                be specified in protocol://hostname:port/ format.
    
                An event can also be published to multiple Receiver Groups each having 1 or more receivers. Receiver
                Groups are delimited by curly braces whereas receivers are delimited by commas.
            Ex - Multiple Receivers within a single group
             tcp://localhost:7612/,tcp://localhost:7613/,tcp://localhost:7614/
            Ex - Multiple Receiver Groups with two receivers each
                     {tcp://localhost:7612/,tcp://localhost:7613},{tcp://localhost:7712/,tcp://localhost:7713/}
            -->
            <DASServerURL>{tcp://localhost:7612/}</DASServerURL>
    
            <!--
                Administrator username to login to the remote DAS server.
            -->
            <DASUsername>admin</DASUsername>
    
            <!--
                Administrator password to login to the remote DAS server.
            -->
            <DASPassword>admin</DASPassword>
    
            <!--
                DAS REST API configuration
                    Set the values if .'org.wso2.carbon.apimgt.usage.client.impl.APIUsageStatisticsRestClientImpl'
                    is used as Statistic Client
            -->
            <DASRestApiURL>https://localhost:9444</DASRestApiURL>
            <DASRestApiUsername>admin</DASRestApiUsername>
            <DASRestApiPassword>admin</DASRestApiPassword>
    
            <!--
                Below property is used to skip trying to connect to event receiver nodes when publishing events even if
                the stats enabled flag is set to true.
            -->
            <SkipEventReceiverConnection>false</SkipEventReceiverConnection>
    
            <!--
                API Usage Data Publisher.
            -->
            <PublisherClass>org.wso2.carbon.apimgt.usage.publisher.APIMgtUsageDataBridgeDataPublisher</PublisherClass>
    
            <!--
                If below property set to true,then the response message size will be calculated and publish
                with each successful API invocation event.
            -->
            <PublishResponseMessageSize>false</PublishResponseMessageSize>
            <!--
                    Data publishing stream names and versions of API requests, responses and faults. If the default values
                    are changed, the toolbox also needs to be changed accordingly.
            -->
            <Streams>
                <Request>
                    <Name>org.wso2.apimgt.statistics.request</Name>
                    <Version>1.0.0</Version>
                </Request>
                <Response>
                    <Name>org.wso2.apimgt.statistics.response</Name>
                    <Version>1.0.0</Version>
                </Response>
                <Fault>
                    <Name>org.wso2.apimgt.statistics.fault</Name>
                    <Version>1.0.0</Version>
                </Fault>
                <Destination>
                    <Name>org_wso2_apimgt_statistics_destination</Name>
                    <Version>1.0.0</Version>
                    <BAMProfileName>bam-profile</BAMProfileName>
                </Destination>
                <Throttle>
                    <Name>org.wso2.apimgt.statistics.throttle</Name>
                    <Version>1.0.0</Version>
                </Throttle>
                <Workflow>
                    <Name>org.wso2.apimgt.statistics.workflow</Name>
                    <Version>1.0.0</Version>
                </Workflow>
            </Streams>
    
        </APIUsageTracking>
    
        <!-- For APIM implemented Statistic client for DAS REST API -->
        <StatisticClientProvider>org.wso2.carbon.apimgt.usage.client.impl.APIUsageStatisticsRestClientImpl</StatisticClientProvider>
        <!-- For APIM implemented Statistic client for RDBMS -->
        <!--StatisticClientProvider>org.wso2.carbon.apimgt.usage.client.impl.APIUsageStatisticsRdbmsClientImpl</StatisticClientProvider-->
    
  3. Configure analytics in APIM 2.0.x
      • In APIM 2.0.x UI based analytics configuration is not available and needs to use XML based configuration. APIM 2.0.x it is compatible to APIM analytics by default. APIM analytics is Special distribute of DAS with additional APIM related functionalities. So here we used APIM-analytics and it can be download from here. To configure analytics follow the below steps.
      • Open <APIM_HOME>/repository/conf/api-manager.xml
      • Find the Tag Analytics in the XML and edit the configuration
      • To enable analytics set Enabled value to true
      • Set the DASServerURL value according to DAS receivers
        • Ex: {tcp://localhost:7612/,tcp://localhost:7613/}
      • Set DASUsername and DASPassword according to DAS receivers
      • DASRestApiURL is used to fetch data from DAS REST API
      • Set it as according to DAS master node
      • Set DASRestApiUsername and DASRestApiPassword according to DAS REST
      • Leave other configuration as default
      • Configure Statistics client
          • By default,lt APIM is configured for DAS REST client
          • In order to select RDBMS Client set the StatsProviderImpl as follow
        	<!-- For APIM implemented Statistic client for DAS REST API -->
                <StatsProviderImpl>org.wso2.carbon.apimgt.usage.client.impl.APIUsageStatisticsRestClientImpl</StatsProviderImpl>
        
          • Since RDBMS client need to define Datasource, define following configuration on both <APIM_HOME>/repository/conf/datasources/master-datasources.xml and <DAS_HOME>
        <datasource>
            <name>WSO2AM_STATS_DB</name>
            <description>The datasource used for registry and user manager</description>
            <jndiConfig>
                <name>jdbc/WSO2AM_STATS_DB</name>
            </jndiConfig>
            <definition type="RDBMS">
                <configuration>
                    <url>jdbc:mysql://localhost:3306/APIM_STAT?autoReconnect=true&</url>
                    <username>root</username>
                    <password>pass</password>
                    <driverClassName>com.mysql.jdbc.Driver</driverClassName>
                    <maxActive>50</maxActive>
                    <maxWait>60000</maxWait>
                    <testOnBorrow>true</testOnBorrow>
                    <validationQuery>SELECT 1</validationQuery>
                    <validationInterval>30000</validationInterval>
                    <defaultAutoCommit>false</defaultAutoCommit>
                </configuration>
            </definition>
        </datasource>
        
        • Copy appropriate RDBMS driver into both DAS and APIM /repository/components/lib directory
      • Deploy Capp
        • By default, APIM analytics contain all the analytics related capp with it. So no need to deploy capp manually. But by default, it has deployd REST car. Thus when you need to configure RDBMS it should deploy manually. APIM analytics Capp can be find in <APIM_HOME>/statistics/ directory. Used API_Manager_Analytics_RDBMS.car for RDBMS configuration and API_Manager_Analytics_REST.car for REST client. There are two way to deploy capp into DAS
          • Copy <APIM_HOME>/statistics/API_Manager_Analytics_RDBMS.car into <DAS_HOME>/repository/deployment/server/carbonapps/ directory. If carbonapps do not exist create a directory. Then restart the DAS
          • Start DAS and logging the DAS management Console. Then find the “Carbon Applications” section under the mail menu. Select Add and deploy the Capp form <APIM_HOME>/statistics/ directory.
    <!--
            API usage tracker configuration used by the DAS data publisher and
            Google Analytics publisher in API gateway.
        -->
        <Analytics>
            <!-- Enable Analytics for API Manager -->
            <Enabled>false</Enabled>
    
            <!-- Server URL of the remote DAS/CEP server used to collect statistics. Must
                 be specified in protocol://hostname:port/ format.
    
                 An event can also be published to multiple Receiver Groups each having 1 or more receivers. Receiver
                 Groups are delimited by curly braces whereas receivers are delimited by commas.
                 Ex - Multiple Receivers within a single group
                 tcp://localhost:7612/,tcp://localhost:7613/,tcp://localhost:7614/
    
                 Ex - Multiple Receiver Groups with two receivers each
                 {tcp://localhost:7612/,tcp://localhost:7613},{tcp://localhost:7712/,tcp://localhost:7713/} -->
            <DASServerURL>{tcp://localhost:7612}</DASServerURL>
            <!-- Administrator username to login to the remote DAS server. -->
            <DASUsername>admin</DASUsername>
            <!-- Administrator password to login to the remote DAS server. -->
            <DASPassword>admin</DASPassword>
    
            <!-- For APIM implemented Statistic client for DAS REST API -->
            <StatsProviderImpl>org.wso2.carbon.apimgt.usage.client.impl.APIUsageStatisticsRestClientImpl</StatsProviderImpl>
            <!-- For APIM implemented Statistic client for RDBMS -->
            <!--StatsProviderImpl>org.wso2.carbon.apimgt.usage.client.impl.APIUsageStatisticsRdbmsClientImpl</StatsProviderImpl-->
    
            <!-- DAS REST API configuration
                 Set the values if .'org.wso2.carbon.apimgt.usage.client.impl.APIUsageStatisticsRestClientImpl'
                 is used as Statistic Client -->
            <DASRestApiURL>https://localhost:9444</DASRestApiURL>
            <DASRestApiUsername>admin</DASRestApiUsername>
            <DASRestApiPassword>admin</DASRestApiPassword>
    
            <!-- Below property is used to skip trying to connect to event receiver nodes when publishing events even if
                the stats enabled flag is set to true. -->
            <SkipEventReceiverConnection>false</SkipEventReceiverConnection>
    
            <!-- API Usage Data Publisher. -->
            <PublisherClass>org.wso2.carbon.apimgt.usage.publisher.APIMgtUsageDataBridgeDataPublisher</PublisherClass>
    
            <!-- If below property set to true,then the response message size will be calculated and publish
                 with each successful API invocation event. -->
            <PublishResponseMessageSize>false</PublishResponseMessageSize>
            <!-- Data publishing stream names and versions of API requests, responses and faults. If the default values
                are changed, the toolbox also needs to be changed accordingly. -->
            <Streams>
                <Request>
                    <Name>org.wso2.apimgt.statistics.request</Name>
                    <Version>1.1.0</Version>
                </Request>
                <Response>
                    <Name>org.wso2.apimgt.statistics.response</Name>
                    <Version>1.1.0</Version>
                </Response>
                <Fault>
                    <Name>org.wso2.apimgt.statistics.fault</Name>
                    <Version>1.0.0</Version>
                </Fault>
                <Destination>
                    <Name>org_wso2_apimgt_statistics_destination</Name>
                    <Version>1.0.0</Version>
                    <BAMProfileName>bam-profile</BAMProfileName>
                </Destination>
                <Throttle>
                    <Name>org.wso2.apimgt.statistics.throttle</Name>
                    <Version>1.0.0</Version>
                </Throttle>
                <Workflow>
                    <Name>org.wso2.apimgt.statistics.workflow</Name>
                    <Version>1.0.0</Version>
                </Workflow>
                <ExecutionTime>
                    <Name>org.wso2.apimgt.statistics.execution.time</Name>
                    <Version>1.0.0</Version>
                </ExecutionTime>
    	    <AlertTypes>
                    <Name>org.wso2.analytics.apim.alertStakeholderInfo</Name>
                    <Version>1.0.0</Version>
                </AlertTypes>
            </Streams>
    
        </Analytics>
    

Add Comment

* Required information
1000
Powered by Commentics

Comments (0)

No comments yet. Be the first!