Analyzing Logs with the Log Analyzer
The Log Analytics in WSO2 API Manager helps you to view your API related statistics and helps you to analyze it.
This feature is deprecated (to be removed in a future release) and is disabled by default. To enable the WSO2 Log Analyzer,
- Unzip the portal.zip file to the
repository/deployment/server/jaggeryapps
folder. - Add the shinding.war file to the
repository/deployment/server/webapps
folder. - Set the
enableLogAnalyzer
property totrue
in the/repository/deployment/server/jaggeryapps/admin/site/conf/site.json
file.
Follow the procedure below to view reports in WSO2 Log Analyzer.
Start the WSO2 API-M Analytics server. Then start the WSO2 API Manager server by running one of the following commands from the
<API-M_ANALYTICS_HOME>/bin
directory.- On Windows:
wso2server.bat --run
On Linux/Mac OS:
sh wso2server.sh
To update the Log Analyzer with the most recent information, execute the
APIM_LOGANALYZER_SCRIPT
script as follows. This script is automatically run every 15 minutes based on the cron job.- Log into the API-M Analytics Management Console using the
https://<ANALYTICS-APIM_Host_Name>:<ANALYTICS-APIM_Port_Name>/carbon/
URL. - In the Main tab, click Scripts to open the Available Analytics Scripts page.
- Click Execute for the
APIM_LOGANALYZER_SCRIPT
script to update the Log Analyzer.
- On Windows:
- Access the WSO2 API Manager Admin Portal using the
https://<Host_Name>:<Port_Name>/admin
URL. Log into the portal using your credentials. As default credentials use both username and password as "admin". - In the left navigator, click Log Analyzer to expand the Log Analyzer section. Then click on one of the following depending on the information you want to view.
- LIVE LOG VIEWER: To view logs that are currently being generated. For more information about how to use the gadgets in this page, see Viewing Live Logs.
- OVERVIEW: To view the overall statistics for each log category generated. For more information about how to use the gadgets in this page, see Analyzing the Log Overview.
- APPLICATION ERRORS: To view detailed information about different categories of errors that have occurred. For more information about how to use the gadgets in this page, see Analyzing Application Errors.
- API DEPLOYMENT STATS: To view overall statistics relating to all the APIs that are deployed in WSO2 API Manager. For more information about how to use the gadgets in this page, see Analyzing API Deployment Statistics.
- LOGIN ERRORS: To view overall statistics for login errors that have occurred for your WSO2 API Manager installation. For more information about how to use the gadgets in this page, see Analyzing Login Errors.
- NUMBER OF API FAILURES: To view statistics relating to instances where the APIs deployed in your WSO2 API Manager installation have failed. For more information about how to use the gadgets in this page, see Analyzing the Number of API Failures.
- ACCESS TOKEN ERRORS: To view detailed statistics relating to access token errors. For more information about how to use the gadgets in this page, see Analyzing Access Token Errors.
Configuring Log Analyzer for reverse proxy enabled Admin Portal
If you have enabled a reverse proxy for the Admin Portal of API Manager, follow the additional steps below to configure the Log Analyzer.
Configure API Manager to work with reverse proxy as described in Adding a Reverse Proxy Server.
The documentation page linked above describes how to apply a reverse proxy to the Store and Publisher applications. You can follow the same steps for the Admin Portal as well.
Add two entries in your load balancer level for the portal and shindig apps. An example Nginx configuration is shown below.
Note that, at the moment you have to use a context with no prefixes/suffixes as mapping for these two apps. These entries are internal but needed for the functionality of the Admin Portal.
Location /portal { index index.html; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass https://localhost:9443/portal; proxy_redirect https://localhost:9443/portal https://myhost/portal; proxy_cookie_path /portal /portal; }
In the API Manager node from which you are accessing the Admin Portal, open the
<API-M_HOME>/repository/deployment/server/jaggeryapps/portal/store/carbon.super/fs/gadget/gadget-commons/js/gadget-utils.js
file.Comment out the following line.
{ name: "APIM", svrUrl: "https://"+location.hostname +":"+ location.port +"/admin/modules/la/log-analyzer-proxy.jag"}
Add a new line representing the reverse proxy URL for the Admin Portal, which replaces
location.hostname +":"+ location.port
in the above commented out line.If your Admin Portal URL is
https://myhost/apimanager/admin
, after applying a reverse proxy, the new line looks like the following:{ name: "APIM", svrUrl: "https://myhost/apimanager/admin/modules/la/log-analyzer-proxy.jag"}
The final configuration looks like the following.
//{ name: "APIM", svrUrl: "https://"+location.hostname +":"+ location.port +"/admin/modules/la/log-analyzer-proxy.jag"} { name: "APIM", svrUrl: "https://myhost/apimanager/admin/modules/la/log-analyzer-proxy.jag"}
In the same API Manager instance, open the
<API-M_HOME>/repository/deployment/server/webapps/shindig/WEB-INF/web.xml
file and navigate to the following section.<context-param> <param-name>system.properties</param-name> <param-value> <![CDATA[ shindig.host= shindig.port= aKey=/shindig/gadgets/proxy?container=default&url=]]> </param-value> </context-param>
Set values as per your load balancer configuration for the
shindig.host
andshindig.port
parameters. Enter the server hostname ashost
and the server HTTPS port asport
.If you use the same load balancer configuration used in this documentation, the resulting configuration looks like the following:
<context-param> <param-name>system.properties</param-name> <param-value> <![CDATA[ shindig.host=myhost shindig.port=443 aKey=/shindig/gadgets/proxy?container=default&url= ]]> </param-value> </context-param>
Save the configurations and start the API Manager server.