<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Maneesha Wijesekara on Medium]]></title>
        <description><![CDATA[Stories by Maneesha Wijesekara on Medium]]></description>
        <link>https://medium.com/@maneesha?source=rss-288ffefd7261------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*Bh0n04JpNn9zmpzunR_DKg.jpeg</url>
            <title>Stories by Maneesha Wijesekara on Medium</title>
            <link>https://medium.com/@maneesha?source=rss-288ffefd7261------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 17:14:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@maneesha/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to Troubleshoot WSO2 Products — 2.]]></title>
            <link>https://maneesha.medium.com/how-to-troubleshoot-wso2-products-2-754ab3002d52?source=rss-288ffefd7261------2</link>
            <guid isPermaLink="false">https://medium.com/p/754ab3002d52</guid>
            <dc:creator><![CDATA[Maneesha Wijesekara]]></dc:creator>
            <pubDate>Fri, 09 Jul 2021 00:23:19 GMT</pubDate>
            <atom:updated>2023-04-24T20:05:46.175Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to Troubleshoot WSO2 Products — 2. How to log Message Payload in Request and Response with WSO2 API Manager</h3><p>Hi Everyone,</p><p>As the 2nd story on troubleshooting WSO2 products, I have thought to give some tips on message mediation with WSO2 API Manager.</p><p>As the heading suggests, logging request and response message payloads would definitely a plus point when troubleshooting the message mediation flow.</p><p>The proposed solution consists of a couple of custom mediation extensions for inflow and outflow with a logger mediator which prints the message body.</p><p>One benefit from this would be, you can enable this ‘per API’ or make it as a global configuration available for all the APIs easily.<br> <br><strong>Enable it as ‘Per API’</strong></p><ul><li>By following the documentation [1], create a couple of sequences as below,</li></ul><p><em>Sequence 1</em></p><pre>&lt;sequence xmlns=&quot;http://ws.apache.org/ns/synapse&quot; name=&quot;log_in_message&quot;&gt;<br>    &lt;log level=&quot;full&quot;&gt;<br>        &lt;property name=&quot;RequestBody&quot; value=&quot;IN_MESSAGE&quot;/&gt;<br>    &lt;/log&gt;<br>&lt;/sequence&gt;</pre><p><em>Sequence 2</em></p><pre>&lt;sequence xmlns=&quot;http://ws.apache.org/ns/synapse&quot; name=&quot;log_out_message&quot;&gt;<br>    &lt;log level=&quot;full&quot;&gt;<br>        &lt;property name=&quot;ResponseBody&quot; value=&quot;OUT_MESSAGE&quot;/&gt;<br>    &lt;/log&gt;<br>&lt;/sequence&gt;</pre><ul><li>Save the first sequence as inflow.xml and second one as outflow.xml.</li><li>Then edit the API and follow [2] and upload ‘inflow.xml’ for ‘In Flow’ and ‘outflow.xml’ for ‘Out Flow’ under ‘Message Mediation Policies’ and publish the API.</li><li>When you invoke the respective API, you can see the message body for request and response in the log.</li></ul><p><strong>Enable it as ‘Globally’</strong></p><p>If you want to make this globally without configuring each and every API in your environment, you can use this solution by exposing as a global extension.</p><ul><li>As per [2], we can create the sequence with the name as ‘WSO2AM — Ext — In’ and ‘WSO2AM — Ext — Out’.</li></ul><p><em>Sequence 1</em></p><pre>&lt;sequence xmlns=&quot;http://ws.apache.org/ns/synapse&quot;  name=&quot;WSO2AM--Ext--In&quot;&gt;     <br>    &lt;log level=&quot;full&quot;&gt;<br>        &lt;property name=&quot;RequestBody&quot; value=&quot;IN_MESSAGE&quot;/&gt;<br>    &lt;/log&gt;<br> &lt;/sequence&gt;</pre><p><em>Sequence 2</em></p><pre>&lt;sequence xmlns=&quot;http://ws.apache.org/ns/synapse&quot;  name=&quot;WSO2AM--Ext--Out&quot;&gt;     <br>    &lt;log level=&quot;full&quot;&gt;<br>        &lt;property name=&quot;ResponseBody&quot; value=&quot;OUT_MESSAGE&quot;/&gt;<br>    &lt;/log&gt;<br> &lt;/sequence&gt;</pre><ul><li>Save the first sequence as inflow.xml and second one as outflow.xml and added to &lt;API_Gateway&gt;/repository/deployment/server/synapse-configs/default/sequences directory.</li><li>Then restart the server.</li></ul><p>After that for each API, you can see the response and request body as below,</p><pre>[2021-04-21 21:32:42,642]  INFO - LogMediator To: /manee/1.0.0/order, MessageID: urn:uuid:b46528b3-cc65-4f73-b030-2be8ba4b1a5e, Direction: request, RequestBody = IN_MESSAGE, Envelope: &lt;?xml version=&#39;1.0&#39; encoding=&#39;utf-8&#39;?&gt;&lt;soapenv:Envelope xmlns:soapenv=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;&lt;soapenv:Body&gt;&lt;jsonObject&gt;&lt;customerName&gt;string&lt;/customerName&gt;&lt;delivered&gt;true&lt;/delivered&gt;&lt;address&gt;string&lt;/address&gt;&lt;pizzaType&gt;string&lt;/pizzaType&gt;&lt;creditCardNumber&gt;string&lt;/creditCardNumber&gt;&lt;quantity&gt;0&lt;/quantity&gt;&lt;orderId&gt;string&lt;/orderId&gt;&lt;/jsonObject&gt;&lt;/soapenv:Body&gt;&lt;/soapenv:Envelope&gt;</pre><pre>[2021-04-21 21:32:42,666]  INFO - LogMediator To: <a href="http://www.w3.org/2005/08/addressing/anonymous,">http://www.w3.org/2005/08/addressing/anonymous,</a> WSAction: , SOAPAction: , MessageID: urn:uuid:4838e13e-ca7a-4686-8d73-208136d09494, Direction: response, ResponseBody = OUT_MESSAGE, Envelope: &lt;?xml version=&#39;1.0&#39; encoding=&#39;utf-8&#39;?&gt;&lt;soapenv:Envelope xmlns:soapenv=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;&lt;soapenv:Body&gt;&lt;jsonObject&gt;&lt;orderId&gt;7ed9b351-4518-4002-8bc8-6ef37f2ec7c6&lt;/orderId&gt;&lt;pizzaType&gt;string&lt;/pizzaType&gt;&lt;quantity&gt;0&lt;/quantity&gt;&lt;customerName&gt;string&lt;/customerName&gt;&lt;creditCardNumber&gt;string&lt;/creditCardNumber&gt;&lt;address&gt;string&lt;/address&gt;&lt;delivered&gt;true&lt;/delivered&gt;&lt;/jsonObject&gt;&lt;/soapenv:Body&gt;&lt;/soapenv:Envelope&gt;</pre><p>As you can see you can filter the request and response with a log analyzed such as EFK with the strings we have added in extensions as ‘RequestBody’ and ‘ResponseBody’. These strings can be changed as per your wish by updating the sequences.</p><p>Hope this will help you to troubleshoot issues which requires to examine the request and response bodies.</p><p>Adiós until I come back with another interesting way of troubleshooting WSO2 products.</p><p>[1] <a href="https://docs.wso2.com/display/AM260/Adding+Mediation+Extensions">https://docs.wso2.com/display/AM260/Adding+Mediation+Extensions</a><br>[2] <a href="https://docs.wso2.com/display/AM260/Adding+Mediation+Extensions#AddingMediationExtensions-CreatinganduploadingmanuallyintheAPIPublisher">https://docs.wso2.com/display/AM260/Adding+Mediation+Extensions#AddingMediationExtensions-CreatinganduploadingmanuallyintheAPIPublisher</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=754ab3002d52" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to QA WSO2 Products — 1. How to get Average TPS with API Manager Analytics]]></title>
            <link>https://maneesha.medium.com/how-to-qa-wso2-products-1-how-to-get-average-tps-with-api-manager-analytics-1779a2d1f3a3?source=rss-288ffefd7261------2</link>
            <guid isPermaLink="false">https://medium.com/p/1779a2d1f3a3</guid>
            <category><![CDATA[quality-assurance]]></category>
            <category><![CDATA[stream-processing]]></category>
            <category><![CDATA[wso2]]></category>
            <category><![CDATA[troubleshooting]]></category>
            <category><![CDATA[analytics]]></category>
            <dc:creator><![CDATA[Maneesha Wijesekara]]></dc:creator>
            <pubDate>Wed, 29 Apr 2020 05:25:47 GMT</pubDate>
            <atom:updated>2021-07-09T00:15:36.852Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to Troubleshoot WSO2 Products — 1. How to get Average TPS with API Manager Analytics</h3><p>Hi Everyone,</p><p>I had this thought of writing a set of posts on how to troubleshoot and do quality assurance of WSO2 products.</p><p>As the first step, I’m writing this story regarding a way to get average TPS with API Manager Analytics 2.6.0. Currently, there’s no OOTB method to check the TPS in the analytics dashboard, so I hope this guide will be useful for you to have some understanding.</p><h4>How Analytics Works</h4><p>Before going on how to work with TPS, let me give you some understanding on basic flows. If you have fundamental knowledge on how APIM Analytics 2.6.0 works, you can skip this section.</p><p>As most of you know the underlying product of WSO2 API Manager Analytics 2.6.0 is WSO2 Stream Processor 4.3.0 [1], a streaming SQL based, high performant, open source stream processing platform can used for real time analytics.</p><p>When we configured API Manager with APIM Analytics as in [2], each and every invocation done in API Manager end will send as a ‘wso2event’ to APIM Analytics end. So in Analytics distribution, there are a set of siddhi files available with a pre-defined set of logics in order to receive the events and process accordingly.</p><p>There are 3 different event streams used by WSO2 API Manager to send events to analytics as follows,</p><ul><li>org.wso2.apimgt.statistics.request</li><li>org.wso2.apimgt.statistics.fault</li><li>org.wso2.apimgt.statistics.throttle</li></ul><p>As the name conveys, successful requests, faulty requests and throttled requests will be separately sent to analytics end using these streams. You can check [3] for more information.</p><p>In APIM analytics distribution, there’s a siddhi file available with the name ‘APIM_EVENT_RECEIVER.siddhi’ in &lt;APIM-Analytics-Home&gt;/wso2/worker/deployment/siddhi-files which contains the streams and other logics to process above events.</p><h4>Configure Analytics to get the record counts</h4><p>Hope now you have some understanding on how the flow works. So let’s go to configurations by following the below steps,</p><p><strong>1.</strong> As mentioned above, let’s enable analytics with API Manager if you haven’t done yet.</p><p><strong>2. </strong>Then go to &lt;APIM-Analytics-Home&gt;/wso2/worker/deployment/siddhi-files directory and open ‘APIM_EVENT_RECEIVER.siddhi’ file and add the following set of lines after ‘@App:description’</p><pre>define stream countRequestStream(count long);<br>define stream countFaultStream(count long);<br>define stream countThrottleStream(count long);</pre><pre><a href="http://twitter.com/sink">@sink</a>(type=&#39;log&#39;)<br>define stream requestLogStream(count long);</pre><pre><a href="http://twitter.com/sink">@sink</a>(type=&#39;log&#39;)<br>define stream faultLogStream(count long);</pre><pre><a href="http://twitter.com/sink">@sink</a>(type=&#39;log&#39;)<br>define stream throttleLogStream(count long);</pre><p>Here we’re defining 6 streams, 2 for each type of event (request, fault and throttle).</p><p>‘requestLogStream’, ‘faultLogStream’ and ‘throttleLogStream’ will be used for logging purposes which I will explain in next steps.</p><p><strong>3.</strong> In the same file, let’s add following set of lines at the end,</p><pre>from InComingRequestStream<br>select count() as count<br>insert into countRequestStream;</pre><pre>from FaultStream<br>select count() as count<br>insert into countFaultStream;</pre><pre>from ThrottledOutStream<br>select count() as count<br>insert into countThrottleStream;</pre><pre>from countRequestStream[count == 1 or count % 10000 == 0]<br>select count<br>insert into requestLogStream;</pre><pre>from countFaultStream[count == 1 or count % 500 == 0]<br>select count<br>insert into faultLogStream;</pre><pre>from countThrottleStream[count == 1 or count % 500 == 0]<br>select count<br>insert into throttleLogStream;</pre><p><strong>4. </strong>Then save the file and it will be hot deployed in the analytics worker node.</p><p><strong>5. </strong>Now starts the worker profile by executing worker.sh in &lt;APIM-Analytics-Home&gt;/bin</p><p><strong>6. </strong>After that start the API Manager instance and invoke an API a few times.</p><h4>What have we done ? :O</h4><p>Now let me explain what we did and what we got after following the above steps.</p><p>‘InComingRequestStream’, ‘FaultStream’ and ‘ThrottledOutStream’ are the streams defined by default in ‘APIM_EVENT_RECEIVER.siddhi’ file to receive the events of successful, faulty and throttled respectively with the Analytics. Let’s take the below section added in 3rd step above,</p><pre>from InComingRequestStream<br>select count() as count<br>insert into countRequestStream;</pre><p>As per this we will get the events which received to ‘InComingRequestStream’ stream and then use a count function to count the receiving events and insert the results to one of our predefined ‘countRequestStream’ streams. Similar to this event counts of ‘FaultStream’ will add to ‘countFaultStream’ and event counts of ‘ThrottledOutStream’ will add to ‘countThrottleStream’.</p><p>Now consider the latter configurations we added in 3rd step as below,</p><pre>from countRequestStream[count == 1 or count % 10000 == 0]<br>select count<br>insert into requestLogStream;</pre><p>As explained before ‘countRequestStream’ will contain the event count at the moment, so here we have defined a condition to have the first event received to analytics and every 10000th event and insert it to ‘requestLogStream’.</p><p>As you remember we have defined ‘requestLogStream’ in the 2nd step with a log sink, so the 1st event and every 10000th event (10000th, 20000th, 30000th) will be printed in the logs. We can log every receiving event to analytics with the logging function but it will lead to filling up the carbon.log file unnecessarily. That’s the reason for having this condition and print based on a defined frequency. You can change the log frequency by replacing the value ‘10000’ with a desired value if you feel your average TPS would be a low value.</p><p>Similarly ‘faultLogStream’ and ‘throttleLogStream’ will print the every 1st and 500th event of faulty and throttled out requests in the logs as defined in the 3rd step.</p><p>Following would be a similar set of logs in carbon.log of &lt;APIM-Analytics-Home&gt;/wso2/worker/logs generated after the invocations.</p><pre>[2020–04–24 00:03:56,695] INFO {org.wso2.siddhi.core.stream.output.sink.LogSink} — APIM_EVENT_RECEIVER : throttleLogStream : Event{timestamp=1587666836693, data=[1], isExpired=false}</pre><pre>[2020–04–24 00:03:56,704] INFO {org.wso2.siddhi.core.stream.output.sink.LogSink} — APIM_EVENT_RECEIVER : requestLogStream : Event{timestamp=1587666836704, data=[1], isExpired=false}</pre><pre>[2020–04–24 00:03:56,710] INFO {org.wso2.siddhi.core.stream.output.sink.LogSink} — APIM_EVENT_RECEIVER : faultLogStream : Event{timestamp=1587666836710, data=[1], isExpired=false}</pre><pre>[2020–04–27 00:03:54,065] INFO {org.wso2.siddhi.core.stream.output.sink.LogSink} — APIM_EVENT_RECEIVER : faultLogStream : Event{timestamp=1587945834065, data=[1000], isExpired=false}</pre><pre>[2020–04–27 00:03:55,626] INFO {org.wso2.siddhi.core.stream.output.sink.LogSink} — APIM_EVENT_RECEIVER : throttleLogStream : Event{timestamp=1587945835626, data=[2500], isExpired=false}</pre><pre>[2020–04–27 00:04:28,125] INFO {org.wso2.siddhi.core.stream.output.sink.LogSink} — APIM_EVENT_RECEIVER : requestLogStream : Event{timestamp=1587945868125, data=[35000000], isExpired=false}</pre><p>The first event will be the one received to analytics after you have saved the ‘APIM_EVENT_RECEIVER.siddhi’ file with the above changes. You can check the number of events inside the ‘data=[]’ section in logs and the event receiving timestamp will also be logged as ‘timestamp’.</p><h4>How to calculate Average TPS</h4><p>As per the above logs, you can run your environment for a few days to get a sufficient set of records. This duration can be different from scenario to scenario as you might need the TPS for peak hours or during non peak hours or during weekdays or during weekends or probably for a special time duration. Here we will be considering 3 days of data to explain the scenario.</p><p>The Average TPS would be the total events received during the time divided by the average time duration. The total events would be the sum of successful requests, faulty requests and throttled requests which we can get from above logs under ‘requestLogStream’, ‘faultLogStream’ and ‘throttleLogStream’ log lines. Please follow the below steps to do the calculation.</p><p>1. Check the last log printed for ‘requestLogStream’, ‘faultLogStream’ and ‘throttleLogStream’ and get the respective value inside the ‘data=[]’ section. Let’s assume following values,</p><p><strong>requestLogStream = 35000000 requests</strong></p><p><strong>faultLogStream = 1000 requests</strong></p><p><strong>throttleLogStream = 2500 requests</strong></p><p>So the<strong> total request count</strong> would be <strong>35003500</strong>.</p><p>2. To get the average time duration, we need to get the difference of timestamp value between the 1st event and the last event for each of the above streams and take the average. From above logs,</p><p><strong>Time taken for requestLogStream = (1587945868125–1587666836704) milliseconds = 279031421 milliseconds</strong></p><p><strong>Time taken for faultLogStream = (1587945834065–1587666836710) milliseconds = 278997355 milliseconds</strong></p><p><strong>Time taken for throttleLogStream = (1587945835626–1587666836693) milliseconds = 278998933 milliseconds</strong></p><p><strong>Average total time = (279031421 + 278997355 + 278998933)/3 = 279009236.33 milliseconds ~ 279009 seconds</strong></p><p>3. So the <strong>Average TPS</strong> would be = <strong>Total Request Count / Average total time = 35003500/279009 = 125 Transactions per second</strong>.</p><p>Just like this you can calculate average TPS within a specified time duration (ex- when a sale promotion goes in your organization during the next long weekend) based on your use case.</p><p>Hope you learn something new today. Let me know if you have any questions.</p><p>[1] <a href="https://docs.wso2.com/display/SP430/Stream+Processor+Documentation">https://docs.wso2.com/display/SP430/Stream+Processor+Documentation</a></p><p>[2] <a href="https://docs.wso2.com/display/AM260/Configuring+APIM+Analytics">https://docs.wso2.com/display/AM260/Configuring+APIM+Analytics</a></p><p>[3] <a href="https://docs.wso2.com/display/AM260/Introducing+the+WSO2+API+Manager+Statistics+Model">https://docs.wso2.com/display/AM260/Introducing+the+WSO2+API+Manager+Statistics+Model</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1779a2d1f3a3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Install API Manager features into DAS 3.1.0 Minimum HA Cluster]]></title>
            <link>https://maneesha.medium.com/install-api-manager-features-into-das-3-1-0-minimum-ha-cluster-e27f3f6854a7?source=rss-288ffefd7261------2</link>
            <guid isPermaLink="false">https://medium.com/p/e27f3f6854a7</guid>
            <category><![CDATA[data-analytics]]></category>
            <category><![CDATA[wso2]]></category>
            <category><![CDATA[api-management]]></category>
            <category><![CDATA[analytics]]></category>
            <category><![CDATA[oracle]]></category>
            <dc:creator><![CDATA[Maneesha Wijesekara]]></dc:creator>
            <pubDate>Sun, 29 Sep 2019 21:01:07 GMT</pubDate>
            <atom:updated>2019-10-02T19:43:09.188Z</atom:updated>
            <content:encoded><![CDATA[<h3><a href="http://maneeshawijesekara.blogspot.com/2017/08/install-api-manager-200-features-in-das.html">Install WSO2 API Manager Analytics features into DAS 3.1.0 Minimum HA Cluster</a></h3><p>Hi readers,</p><p>Today I’m going to write this story on how to use WSO2 Data Analytics Server to have a High Availability Environment (Cluster) and set it up as API Manager Analytics by installing features on it. So this article will contains few sections for you to follow.</p><p>When surfing through internet, you could find most of the articles on Analytics using Mysql, so I’m going to use Oracle as the DBMS to write this story.</p><h3><strong>1. Let’s create a DAS cluster,</strong></h3><p>So the first section is all about how to create a Data Analytics HA Cluster. Following are the steps,</p><p>1. First download Data Analytics Server 3.1.0 from <a href="https://wso2.com/analytics-and-stream-processing/previous-releases/">here</a> and extracted in both instances.</p><p>2. Then logged into oracle server and create users for following datasources. If you can browse through the downloaded DAS distribution, these datasources can be found in [DAS_HOME]/repository/conf/datasources directory.</p><ul><li>WSO2CarbonDB (create user as <strong>‘carbondb’</strong>)</li><li>WSO2REG_DB (create user as <strong>‘regdb’</strong>)</li><li>WSO2UM_DB (create user as <strong>‘userdb’</strong>)</li><li>WSO2_ANALYTICS_EVENT_STORE_DB (create user as <strong>‘eventstoredb’</strong>)</li><li>WSO2_ANALYTICS_PROCESSED_DATA_STORE_DB (create user as <strong>‘prosdatadb’</strong>)</li><li>WSO2_METRICS_DB (create user as <strong>‘metricsdb’</strong>)</li></ul><p>3. You need to add following User management datasource in &lt;DAS_HOME&gt;/repository/conf/datasources/master-datasources.xml. By default ‘WSO2CarbonDB’ will act as both User and Registry database but when doing the clustering we’re having separate datasource for each.</p><pre>&lt;datasource&gt;<br>        &lt;name&gt;WSO2UM_DB&lt;/name&gt;<br>        &lt;description&gt;The datasource used for user manager&lt;/description&gt;<br>        &lt;jndiConfig&gt;<br>            &lt;name&gt;jdbc/WSO2UM_DB&lt;/name&gt;<br>        &lt;/jndiConfig&gt;<br>        &lt;definition type=&quot;RDBMS&quot;&gt;<br>            &lt;configuration&gt;<br>               &lt;url&gt;jdbc:oracle:thin:@localhost:1521/oracledb&lt;/url&gt;<br>               &lt;username&gt;userdb&lt;/username&gt;<br>               &lt;password&gt;userdb&lt;/password&gt;                        &lt;driverClassName&gt;oracle.jdbc.driver.OracleDriver&lt;/driverClassName&gt;<br>           &lt;maxActive&gt;50&lt;/maxActive&gt;<br>           &lt;maxWait&gt;60000&lt;/maxWait&gt;<br>           &lt;testOnBorrow&gt;true&lt;/testOnBorrow&gt;<br>           &lt;validationQuery&gt;SELECT 1 FROM DUAL&lt;/validationQuery&gt;<br>           &lt;defaultAutoCommit&gt;false&lt;/defaultAutoCommit&gt;<br>           &lt;validationInterval&gt;30000&lt;/validationInterval&gt;<br>           &lt;/configuration&gt;<br>         &lt;/definition&gt;<br>     &lt;/datasource&gt;</pre><p>Note- oracledb is the database SID where the users were created.</p><p>4. Also add registry datasource in &lt;DAS_HOME&gt;/repository/conf/datasources/master-datasources.xml</p><pre>&lt;datasource&gt;<br>    &lt;name&gt;WSO2REG_DB&lt;/name&gt;<br>    &lt;description&gt;The datasource used by the registry&lt;/description&gt;<br>    &lt;jndiConfig&gt;<br>    &lt;name&gt;jdbc/WSO2REG_DB&lt;/name&gt;<br>        &lt;/jndiConfig&gt;<br>        &lt;definition type=&quot;RDBMS&quot;&gt;<br>           &lt;configuration&gt;<br>            &lt;url&gt;jdbc:oracle:thin:@localhost:1521/oracledb&lt;/url&gt;<br>            &lt;username&gt;regdb&lt;/username&gt;<br>            &lt;password&gt;regdb&lt;/password&gt;<br>&lt;driverClassName&gt;oracle.jdbc.driver.OracleDriver&lt;/driverClassName&gt;<br>           &lt;maxActive&gt;50&lt;/maxActive&gt;<br>           &lt;maxWait&gt;60000&lt;/maxWait&gt;<br>           &lt;testOnBorrow&gt;true&lt;/testOnBorrow&gt;<br>           &lt;validationQuery&gt;SELECT 1 FROM DUAL&lt;/validationQuery&gt;<br>           &lt;defaultAutoCommit&gt;false&lt;/defaultAutoCommit&gt;<br>           &lt;validationInterval&gt;30000&lt;/validationInterval&gt;<br>           &lt;/configuration&gt;<br>         &lt;/definition&gt;<br>     &lt;/datasource&gt;</pre><p>Change other datasources according to the created database users by changing url, username, password, driverClassName as above.</p><p>5. Open the &lt;DAS_HOME&gt;/repository/conf/user-mgt.xml file and modify the dataSource property of the &lt;configuration&gt; element as follows. This will make the created datasource in 3rd step to use as User Database.</p><pre>&lt;configuration&gt;<br>…<br>&lt;Property name=&quot;dataSource&quot;&gt;jdbc/WSO2UM_DB&lt;/Property&gt;<br>&lt;/configuration&gt;</pre><p>6. Add the dataSource attribute of the &lt;dbConfig name=”govregistry”&gt; in &lt;DAS_HOME&gt;/repository/conf/registry.xml file in order to do registry mounting. Make sure to keep the ‘wso2registry’ db config as it is.</p><pre>&lt;dbConfig name=&quot;govregistry&quot;&gt;<br>    &lt;dataSource&gt;jdbc/WSO2REG_DB&lt;/dataSource&gt;<br>&lt;/dbConfig&gt;<br>&lt;remoteInstance url=&quot;https://localhost:9443/registry&quot;&gt;<br>    &lt;id&gt;gov&lt;/id&gt;<br>    &lt;cacheId&gt;regdb@jdbc:oracle:thin:@localhost:1521/oracledb&lt;/cacheId&gt;<br>    &lt;dbConfig&gt;govregistry&lt;/dbConfig&gt;<br>    &lt;readOnly&gt;false&lt;/readOnly&gt;<br>    &lt;enableCache&gt;true&lt;/enableCache&gt;<br>    &lt;registryRoot&gt;/&lt;/registryRoot&gt;<br>&lt;/remoteInstance&gt;<br>&lt;mount path=&quot;/_system/governance&quot; overwrite=&quot;true&quot;&gt;<br>    &lt;instanceId&gt;gov&lt;/instanceId&gt;<br>    &lt;targetPath&gt;/_system/governance&lt;/targetPath&gt;<br>&lt;/mount&gt;<br>&lt;mount path=&quot;/_system/config&quot; overwrite=&quot;true&quot;&gt;<br>    &lt;instanceId&gt;gov&lt;/instanceId&gt;<br>    &lt;targetPath&gt;/_system/config&lt;/targetPath&gt;<br>&lt;/mount&gt;</pre><p>In &lt;cacheId&gt;, ‘regdb’ is the username of the WSO2REG_DB.</p><p>7. Now we’re going to enable Hazelcast clustering for DAS nodes. Set following properties in &lt;DAS_HOME&gt;/repository/conf/axis2/axis2.xml file.</p><p>a) Enable clustering by setting value as ‘true’ for clustering class=”org.wso2.carbon.core.clustering.hazelcast.HazelcastClusteringAgent” as below,</p><pre>&lt;clustering class=&quot;org.wso2.carbon.core.clustering.hazelcast.HazelcastClusteringAgent&quot; enable=&quot;true&quot;&gt;</pre><p>b) Enable well known address by changing the membershipScheme to ‘wka’</p><pre>&lt;parameter name=&quot;membershipScheme&quot;&gt;wka&lt;/parameter&gt;</pre><p>c) Add respective server IP address as the value for the localMemberHost property for each node. If the analytics nodes are in the same node, you can keep the same ip here.</p><pre>&lt;parameter name=&quot;localMemberHost&quot;&gt;10.100.1.89&lt;/parameter&gt;</pre><p>d) Change the localMemberPort accordingly. Both nodes should have different unique ports unless they are in different instances.</p><pre>&lt;parameter name=&quot;localMemberPort&quot;&gt;4000&lt;/parameter&gt;</pre><p>e) Add both the DAS nodes as well known addresses in the cluster by specifying under the &lt;members&gt; tag in each node as shown below.</p><pre>&lt;members&gt;<br>    &lt;member&gt;<br>        &lt;hostName&gt;10.100.1.89&lt;/hostName&gt;<br>        &lt;port&gt;4000&lt;/port&gt;<br>    &lt;/member&gt;<br>    &lt;member&gt;<br>        &lt;hostName&gt;10.100.1.90&lt;/hostName&gt;<br>        &lt;port&gt;4000&lt;/port&gt;<br>    &lt;/member&gt;<br>&lt;/members&gt;</pre><p>Note — Make sure to have different ports for both nodes as per ‘localMemberPort’ and include under &lt;members&gt; tag in each node if you have both nodes in same machine.</p><p>8. Enable HA mode in &lt;DAS_HOME&gt;/repository/conf/event-processor.xml in order to Cluster CEP in both nodes.</p><pre>&lt;mode name=&quot;HA&quot; enable=&quot;true&quot;&gt;</pre><p>9. Enter the respective server IP address under the HA mode Config for &lt;hostname&gt; in &lt;eventSync&gt; and &lt;management&gt; sections as below,</p><pre>&lt;eventSync&gt;<br>         &lt;hostName&gt;10.100.1.89&lt;/hostName&gt;<br> ..<br>  &lt;/eventSync&gt;</pre><pre>     &lt;management&gt;<br>         &lt;hostName&gt;10.100.1.89&lt;/hostName&gt;<br>  ..<br>&lt;/management&gt;</pre><p>10. Modify &lt;DAS_HOME&gt;/repository/conf/analytics/spark/spark-defaults.conf as follows,</p><p>a) Keep carbon.spark.master as ’local’. This creates a spark cluster with Hazelcast cluster.</p><p>b) Set ‘carbon.spark.master.count’ as 2 since both node works as master (active and passive)</p><pre>carbon.spark.master local<br>carbon.spark.master.count 2</pre><p>11. If the path to &lt;DAS_HOME&gt; is different in the two nodes, please do the following (ex- if 1st node’s DAS directory is /ubuntu/user1/wso2das-3.1.0 and 2nd node’s directory is /ubuntu/user2/wso2das-3.1.0). If it is same you can skip this step.</p><p>Create identical symbolic links to &lt;DAS_HOME&gt; in both nodes and ensure that we can use a common path. Uncomment and change carbon.das.symbolic.link accordingly by setting the symlink path.</p><pre>carbon.das.symbolic.link /home/ubuntu/das/das_symlink/</pre><p>12. As the last step download the Oracle <a href="https://www.oracle.com/database/technologies/appdev/jdbc-downloads.html">database JDBC driver</a> and copy it to &lt;DAS_HOME&gt;/repository/components/lib in both nodes</p><p>Make sure to apply changes accordingly in both nodes and change ip address and ports (ex- localmemberport, port offset in carbon.xml if both are in same machine, etc).</p><p>13. Start at least one server with -Dsetup since we need to populate tables for the created databases and other node with/without -Dsetup . Go to &lt;DAS_HOME&gt;/bin and run</p><pre>sh wso2server.sh -Dsetup</pre><p>Now we have a functional DAS minimum HA cluster. So we need to turn this into an API manger Analytics Cluster (Not using Magic, I promise).</p><h3><strong>Steps to install APIM Analytics features</strong></h3><p>WSO2 products are compatible to install features from other products from same carbon version. For this there’s a repository called ‘P2’ which contains all the features which you can use. Let’s install features,</p><ol><li>Let’s got to Features section in DAS management console after starting the server.</li></ol><p><strong>Management console -&gt; Main -&gt; Configure -&gt; Features</strong></p><p>2. Click Repository Management and go to Add Repository.</p><p>3. Give a name and browse or add url to add the repository.</p><p>Note — You can get the p2 repo from <a href="http://product-dist.wso2.com/p2/carbon/releases/wilkes/">here</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*kgwln0fxAUMvEoU2.png" /></figure><p>Name — Any preferred name (ex — p2 repo)<br>Location (from URL) — <a href="http://product-dist.wso2.com/p2/carbon/releases/wilkes">http://product-dist.wso2.com/p2/carbon/releases/wilkes</a></p><p>4. Go to ‘Available Features’ tab, untick ‘Group features by category’ and click ‘Find Features’</p><p>5. Following features needed to be installed from listed set of features.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*sCEVNYA_527UFogB.png" /></figure><p>Tick the above features and click install and features will be installed.</p><p>Note — Make sure to do the same for both nodes.</p><h3><strong>Steps to Configure Statistic Datasource</strong></h3><p>Now we have an APIM Analytics Cluster. Congratulations 🔥🔥.</p><p>So how we’re going to use this to process API Manager events ?</p><p>After installing features into DAS cluster, there will be a datasource file created inside &lt;DAS_HOME&gt;/repository/conf/datasources as stats-datasources.xml. What we need to do is create a statistics database in oracle and point that in this datasource file since we have followed other required steps when doing the clustering. So these are the steps.</p><p>1. Shut down both Analytics servers.</p><p>2. Create a database user for statistics database in oracle (ex- user — statdb)</p><p>3. Go to &lt;DAS_HOME&gt;/repository/conf/datasources and open stats-datasources.xml and change the properties as below,</p><pre>&lt;datasource&gt;<br>      &lt;name&gt;WSO2AM_STATS_DB&lt;/name&gt;<br>      &lt;description&gt;The datasource used for setting statistics to API Manager&lt;/description&gt;<br>      &lt;jndiConfig&gt;<br>     &lt;name&gt;jdbc/WSO2AM_STATS_DB&lt;/name&gt;<br>     &lt;/jndiConfig&gt;<br>      &lt;definition type=&quot;RDBMS&quot;&gt;<br>     &lt;configuration&gt;<br>        &lt;url&gt;jdbc:oracle:thin:@localhost:1521/oracledb&lt;/url&gt;<br>        &lt;username&gt;statdb&lt;/username&gt;<br>        &lt;password&gt;statdb&lt;/password&gt;     &lt;driverClassName&gt;oracle.jdbc.driver.OracleDriver&lt;/driverClassName&gt;<br>       &lt;maxActive&gt;50&lt;/maxActive&gt;<br>       &lt;maxWait&gt;60000&lt;/maxWait&gt;<br>       &lt;testOnBorrow&gt;true&lt;/testOnBorrow&gt;<br>       &lt;validationQuery&gt;SELECT 1 FROM DUAL&lt;/validationQuery&gt;<br>       &lt;validationInterval&gt;30000&lt;/validationInterval&gt;<br>     &lt;defaultAutoCommit&gt;false&lt;/defaultAutoCommit&gt;<br>       &lt;/configuration&gt;<br>     &lt;/definition&gt;<br>   &lt;/datasource&gt;</pre><p>Now we have a complete API Manager Analytics 2 node Minimum HA cluster. You can follow,</p><p><a href="https://docs.wso2.com/display/AM250/Configuring+APIM+Analytics">API Manager 2.5.0 Documentation</a> to configure API Manager 2.5.0 with Analytics.</p><p><a href="https://docs.wso2.com/display/AM220/Configuring+APIM+Analytics">API Manager 2.2.0 Documentation</a> to configure API Manager 2.2.0 with Analytics.</p><p><a href="https://docs.wso2.com/display/AM210/Configuring+APIM+Analytics">API Manager 2.1.0 Documentation</a> to configure API Manager 2.1.0 with Analytics.</p><p><a href="https://docs.wso2.com/display/AM200/Configuring+APIM+Analytics">API Manager 2.0.0 Documentation</a> to configure API Manager 2.0.0 with Analytics.</p><p><strong>Have Questions ? Add in the comment section.</strong></p><p><strong>Also don’t forget to Clap hard for this story. Bravo…!!!!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e27f3f6854a7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Let’s take a TCP Dump in Windows]]></title>
            <link>https://maneesha.medium.com/lets-take-a-tcp-dump-in-windows-6ad5513284c5?source=rss-288ffefd7261------2</link>
            <guid isPermaLink="false">https://medium.com/p/6ad5513284c5</guid>
            <category><![CDATA[windump]]></category>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[tcpdump]]></category>
            <dc:creator><![CDATA[Maneesha Wijesekara]]></dc:creator>
            <pubDate>Wed, 18 Sep 2019 05:34:16 GMT</pubDate>
            <atom:updated>2023-06-26T22:31:02.438Z</atom:updated>
            <content:encoded><![CDATA[<p>There’re a lot of documentations available to take tcp dump in Linux based distributions but for windows, you may not find much. So I thought to write a story on how to take tcpdump in Windows.</p><p>For this purpose we can use a tool called ‘Windump’. Get more details from <a href="https://www.winpcap.org/windump/docs/default.htm">here</a>.</p><p><strong>Steps to Follow,</strong></p><p>1. Download ‘<a href="https://www.winpcap.org/windump/install/default.htm">Windump</a>’ and install it</p><p>2. Download ‘<a href="https://www.winpcap.org/install/default.htm">WinPcap</a>’ [3] and install it.</p><p>In order to run ‘windump’ you need to have this library called ‘WinPcap’. It includes a driver to support capturing packets.</p><p>3. <strong>Go to the downloaded location of ‘Windump’ </strong>through terminal and execute following command to print the available network interfaces on the system and on which tcpdump can capture packets.</p><pre>windump -D</pre><p>You will get an output just like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/525/1*1vp3AQzFAEVYYH7Nq8eh-g.png" /></figure><p>4. Now we are going to export a tcpdump to a file while following the scenario where we can observe an excpetion. To do that, execute the below command first,</p><pre>windump -i {network_Interface_id} -w {filename}.pcap</pre><p><strong><em>network_Interface_id</em></strong><em> — </em>the number of the network interface you’re printed in step 3 (if it listed only 1 interface, the number would be ‘1’. If multiple interfaces were returned, select a number from the list of interfaces and use itin here)</p><p><strong><em>filename</em></strong> — you can give any name to the file and save with .pcap (packet capturing extension)</p><p>Sample command would be like below,</p><pre>windump -i 1 -w tcpdump.pcap</pre><p>5. Run a scenario which you need to capture tcpdump and press ‘ctrl’ + ‘c’ to stop the packet capturing after the scenario. The captured packets will save in above file (tcpdump.pcap)</p><p>Hope this will help you to take a tcpdump in Windows.</p><p>Don’t forget to Clap hard if this helps you. Also let me know in comment section if you have any questions to discuss. Bye Bye for now.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6ad5513284c5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stepping into Medium (Not talking about cloths)]]></title>
            <link>https://maneesha.medium.com/stepping-into-medium-not-talking-about-cloths-21f887eb5bb6?source=rss-288ffefd7261------2</link>
            <guid isPermaLink="false">https://medium.com/p/21f887eb5bb6</guid>
            <category><![CDATA[medium]]></category>
            <category><![CDATA[opening-post]]></category>
            <dc:creator><![CDATA[Maneesha Wijesekara]]></dc:creator>
            <pubDate>Wed, 18 Sep 2019 04:37:17 GMT</pubDate>
            <atom:updated>2019-09-18T07:08:26.487Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Hi Everyone,</strong></p><p>Mmm this would be my first story in Medium.</p><p>Every good story needs a beginning right ? (Yeah, even bad stories have ones)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*NQ6AxaIZFgKVCr3d57nXcA.jpeg" /></figure><p>I used to blog a way back, not just about technical stuff, I used to write poems and verses when I was free. But for some time I was a bit away from writing and just thought to starts writing again in Medium about the things I learn, I heard and probably I know.</p><p>So if you read this, Wish me a ton of good luck (one for each story) ❤</p><p>Thanks and Regards</p><p>Maneesha</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=21f887eb5bb6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>