WSO2 API : how to create custom api usage statistics in wso2 api manager and analytics - wso2

I am fairly new in this tool. I need some guidance and help to create custom api usage statistics in wso2 api manager and analytics.
Right now I am using H2 database which is embedded in wso2 and need to generate report from database which has custom information.
I have been able to extract the data from various usage table like (API_RESOURCE_USAGE_SUMMARY and API_REQUEST_SUMMARY) but not able to include other details in this which is necessary for the use case on which I am working right now.
Guidance in this would be really helpful.

Related

API Manager Analytics

We are working on a solution built on top of WSO2 APIM.
Problem Statement:
We want to add custom capability in existing APIM. Right now if we consume a single api endpoint it gives us meaningful statics some of them are:
API Usage API
API Usage per Application
Top Users per Application
Resource Usage per Application
But what we need is to store some/all incoming request data into database and extract meaningful information over time.
Example:
Suppose we have a api endpoint like below:
HTTP-Verb: POST
URL: http://localhost:9444/subscriptions/1/create_subscription
Params: name:sample_name, type:sample_type, user_id:12345
What we want?
It could be WSO2, OpenAM or any other opensource API manager.
We need to store parameter values e.g. sample_name, sample_type
and user_id in database.
Observations?
Looks like WSO Stream Processor can provide this functionality.
As it has a solution for HTTP Analytics. But we are not certain
to proceed with this option.
Another possible candidate is to Extend API Manager. But docs doesn't have anything to target what we wanted to do.
I am not sure but we can use RequestInterceptor?
Anyone has a experience with this kind of problem please let me know.
There are two problems you have to solve here,
1. Capture the required data from the APIM side
2. Publish to Analytics Server
3. Perform Analytics on received events
As you have observed WSO2 SP can be used for 3.
For 1 & 2, please see blog (https://medium.com/#naduni_pamudika/how-to-publish-custom-attributes-from-wso2-api-manager-to-wso2-analytics-38dd83e8aea2) for extending the publishers to capture and publish additional data.
You can also take a look at OpenIG, it is easy to extend and you can implement your own filter to store request data in database. Another approach is develop your own gateway based on Netflix Zuul or Spring Cloud Gateway

WSO2 API Analytics: From where the data gets into WSO2AM_STATS_DB

I am fairly new with WSO2 products and currently checking on the ApiM and Analytics products.
I am able to configure the WSO2 APIM and Analytics products successfully with SQL database and now able to get the stats as well.
In further exploring, I want to know from where the data gets inserted into various tables inside WSO2AM_STATS_DB.
If its through events, then can some one please throw light on the same.
Thanks
Yes it is though a collection of Siddhi Apps running in APIM Analytics which is based on Stream Processor. You can find corresponding siddhi apps under /wso2/worker/deployment/siddhi-files. Below are the files
APIM_ACCESS_SUMMARY.siddhi
APIM_FAULT_SUMMARY.siddhi
APIM_REQUEST_PROCESSOR.siddhi
APIM_WORKFLOW.siddhi
These are written using Siddhi and here is the link to siddhi query guide if you need to understand.

WSO2-APIM Analytics : Can we export raw data to excel or csv?

I am currently experimenting with WSO2 API Manager 2.0.0 Analytics features. I have question as following.
If I want to query raw data (not the summary data) from APIM Analytics is this the correct URL for the documentation about the API?[https://docs.wso2.com/display/DAS300/Analytics+REST+API+Guide]
Is there feature to export raw data from APIM Analytics table to excel or csv file without having to write program to call the provided API?
Thank you very much
Please find the answers below.
To configure analytics for APIM 2.0.0, you are using API Manager Analytics distribution as described in API Manager docs. The documentation that you refer is DAS 3.0.0 that gives you the DAS REST API to explore the data.
In API Manager analytics, it is using the RDBMS approach and you can use the Data Explorer in Management Console of API Manager Analytics distribution to explore data. It consist of some filters too.
After login to the API Manager Analytics, go to Manage > Interactive Analytics > Data Explorer to view raw data.
WSO2 API Manager do not have the capability of exporting raw data directly to CSVs. You can use SQL commands on tables of raw data to export them as CSVs.

WSO2 API Manager Mashup

Is there any way to create a mash up service using WSO2 API Manager? My goal is to create two Web services, then generate some data on which business logic is applied. This final data then needs to be fed into a third Web service.
I think you can use Apache Camel to create a mashup API easily.

Creation Dashboard using WSO2 BAM already defined dashboards

I have question. I need to provide the report for my master work to compare BAM tools and one of them is WSO2 BAM.I am beginner in it. I have to provide dashboards in WSO2BAM which will take information from my own database, from Oracle. According to the theoretical introduction of WSO2BAM it has already defined dashboards and is it possible to configure it for my own database and how? and Is there some tutorials, some documentation or examples?
Check under user defined data in the BAM documentation. It should tell you how to do send custom events. After this is stored in the BAM database. You have to write a gadget and a data service or a back end component to pull out the data and display the data.