This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
Enabling Geolocation Based Statistics
Follow the steps below to configure WSO2 IS Analytics Server to display the regions of the users authenticated though WSO2 Identity Server.
- Download the geolocation data from here .
- Unzip the file that you downloaded in step 1.
Create the database by executing one of the scripts in theÂ
Geolocation Data/dbscripts
 directory. In this example,Âmysql.sql
 is executed.ÂSign in to the mysql client by executing the command.
mysql -u <MYSQL_USERNAME> -p
Provide the
mysql password
when prompted.Create the database by executing the following command.
CREATE DATABASE GEO_LOCATION_DATA; USE GEO_LOCATION_DATA;
Run theÂ
Geolocation Data/dbscripts/mysql.sql
script.Âsource <PATH_OF_mysql.sql_SCRIPT>
You can also run the scripts using MySQL Workbench. For detailed instructions, see MySQL Documentation - The Workbench Scripting Shell.
Populate the data to the BLOCKS and LOCATION tables from the following files.
Geolocation Data/data/BLOCKS.csv
Geolocation Data/data/LOCATION.csv
For more information, see MySQL Documentation - Data Export and Import.
Alternatively you can navigate to the
Geolocation Data/data
directory and run the following commands.ÂÂ The command to populate data to the BLOCKS table:Â
mysqlimport -u <mysql username> -p --ignore-lines=2 --fields-terminated-by=, --fields-optionally-enclosed-by='"' --local GEO_LOCATION_DATA <PATH_OF_BLOCKS.csv_FILE>
Provide the mysql password when prompted.
The command to populate data to the LOCATION table:
mysqlimport -u <mysql username> -p --ignore-lines=2 --fields-terminated-by=, --fields-optionally-enclosed-by='"' --local GEO_LOCATION_DATA <PATH_OF_LOCATION.csv_FILE>
Provide the
mysql password
when prompted.
- Download a JDBC provider depending on the database you are using (MySQL in this example) from here, and extract it.
- Copy theÂ
mysql-connector-java-<VERSION>.jar
toÂ<IS_ANALYTICS_HOME>/lib
 directory. Configure the following in
<IS_ANALYTICS_HOME>/conf/worker/deployment.yaml
file as given below.name: GEO_LOCATION_DATA description: "The data source used for geo location database" jndiConfig: name: jdbc/GEO_LOCATION_DATA definition: type: RDBMS configuration: jdbcUrl: '<GEO_LOCATION_DATBASE_URL>' username: <MYSQL_USERNAME> password: <MYSQL_PASSWORD> driverClassName: <MYSQL_DRIVER_CLASS_NAME> maxPoolSize: 50 idleTimeout: 60000 validationTimeout: 30000 isAutoCommit: false
jdbcUrl
: This is the URL of the geo location data base, e.g.,Âjdbc:mysql://localhost:3306/GEO_LOCATION_DATA
.username
: This is the mysql user name, e.g.,wso2carbon
.password
: This is the mysql password, e.g,wso2carbon
.driverClassName
: This is the package name of the JDBC driver of your mysql connector, e.g.,Âcom.mysql.jdbc.Driver
.Â
- Open the
<IS_ANALYTICS_HOME>/wso2/worker/deployment/siddhi-files/IS_ANALYTICS_AUTHENTICATION_COMMON.sidddhi
file.- Uncomment the line 120:
(ifThenElse(geo:findCountryFromIP(remoteIp)=="", "N/A", geo:findCountryFromIP(remoteIp)) as region,)
. - Comment out the line 121:Â
(region,)
.
For testing purposes
Follow the steps below to load test data to the system.
- Naviagte to the
<IS_ANALYTICS_HOME>/samples/sample-clients/is-analytics-client
directory on a command prompt. Run the following command.
ant -Dport=7612 -Dhost=0.0.0.0
- Uncomment the line 120:
- Restart WSO2 IS Analytics worker node.Â