<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic API request and comparison- Can this be achieved? in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/API-request-and-comparison-Can-this-be-achieved/m-p/617180#M14423</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I have a scenario that I need to confirm if it works with splunk.&lt;/P&gt;
&lt;P&gt;I have 2 environments&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Cluster1&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;Cluster2&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;I have the same application setup on both environments&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Appxyz&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Now I need to check that the versions of Appxyz on Cluster1 and Cluster2 are the same&lt;/P&gt;
&lt;P data-unlink="true"&gt;and I send a curl request to https://cluster.Appxyz&amp;nbsp;and &lt;A href="https://cluster2.Appxyz" target="_blank" rel="noopener"&gt;https://cluster2.Appxyz&lt;/A&gt;&lt;/P&gt;
&lt;P data-unlink="true"&gt;the request returns json values like name: thisname, clustername: thisclustername and version: v123 or V321.&lt;/P&gt;
&lt;P data-unlink="true"&gt;I need to extract only the version values from the json i.e v123 or v321&lt;/P&gt;
&lt;P&gt;where Cluster.Appxyz.version =&amp;gt; v123 and Cluster2.Appxyz.version=&amp;gt; v321&lt;/P&gt;
&lt;P&gt;In this case:&lt;/P&gt;
&lt;P&gt;if Cluster1.Appxyz.version is != to Cluster2.Appxyz.version&lt;/P&gt;
&lt;P&gt;throw some alert stating "mismatched versions"&lt;/P&gt;
&lt;P&gt;if Cluster1.Appxyz.version is == to Cluster2.Appxyz.version&lt;/P&gt;
&lt;P&gt;Can this be achieved using splunk?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Mon, 17 Oct 2022 14:28:00 GMT</pubDate>
    <dc:creator>cheanaydoo</dc:creator>
    <dc:date>2022-10-17T14:28:00Z</dc:date>
    <item>
      <title>API request and comparison- Can this be achieved?</title>
      <link>https://community.splunk.com/t5/Alerting/API-request-and-comparison-Can-this-be-achieved/m-p/617180#M14423</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I have a scenario that I need to confirm if it works with splunk.&lt;/P&gt;
&lt;P&gt;I have 2 environments&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Cluster1&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;Cluster2&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;I have the same application setup on both environments&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Appxyz&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Now I need to check that the versions of Appxyz on Cluster1 and Cluster2 are the same&lt;/P&gt;
&lt;P data-unlink="true"&gt;and I send a curl request to https://cluster.Appxyz&amp;nbsp;and &lt;A href="https://cluster2.Appxyz" target="_blank" rel="noopener"&gt;https://cluster2.Appxyz&lt;/A&gt;&lt;/P&gt;
&lt;P data-unlink="true"&gt;the request returns json values like name: thisname, clustername: thisclustername and version: v123 or V321.&lt;/P&gt;
&lt;P data-unlink="true"&gt;I need to extract only the version values from the json i.e v123 or v321&lt;/P&gt;
&lt;P&gt;where Cluster.Appxyz.version =&amp;gt; v123 and Cluster2.Appxyz.version=&amp;gt; v321&lt;/P&gt;
&lt;P&gt;In this case:&lt;/P&gt;
&lt;P&gt;if Cluster1.Appxyz.version is != to Cluster2.Appxyz.version&lt;/P&gt;
&lt;P&gt;throw some alert stating "mismatched versions"&lt;/P&gt;
&lt;P&gt;if Cluster1.Appxyz.version is == to Cluster2.Appxyz.version&lt;/P&gt;
&lt;P&gt;Can this be achieved using splunk?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 17 Oct 2022 14:28:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/API-request-and-comparison-Can-this-be-achieved/m-p/617180#M14423</guid>
      <dc:creator>cheanaydoo</dc:creator>
      <dc:date>2022-10-17T14:28:00Z</dc:date>
    </item>
    <item>
      <title>Re: API request and comparison</title>
      <link>https://community.splunk.com/t5/Alerting/API-request-and-comparison-Can-this-be-achieved/m-p/617233#M14429</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/250358"&gt;@cheanaydoo&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;It's possible. Please find below a sample&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Cluster 1&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
  "name": "cluster1",
  "clustername": "cluster1_name",
  "version": "v123"
}&lt;/LI-CODE&gt;&lt;P&gt;&lt;STRONG&gt;Cluster 2&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
  "name": "cluster2",
  "clustername": "cluster2_name",
  "version": "v321"
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Search&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="api" sourcetype="_json"
| stats latest(version) as version by name,clustername
| stats first(version) as version1,last(version) as version2
| eval result=if(version1 == version2,"yes","no")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Output&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="clusters_output.jpg" style="width: 200px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/22017i2DB65FC5D7280EFF/image-size/small?v=v2&amp;amp;px=200" role="button" title="clusters_output.jpg" alt="clusters_output.jpg" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;clusters_output.jpg&lt;/span&gt;&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;When you compare the result, it should be based on a parameter such as common keys, timestamp etc. In the above example, we compared based on time stamp, i.e. takes the latest from both outputs and compared them.&lt;/P&gt;</description>
      <pubDate>Sat, 15 Oct 2022 03:19:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/API-request-and-comparison-Can-this-be-achieved/m-p/617233#M14429</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2022-10-15T03:19:01Z</dc:date>
    </item>
    <item>
      <title>Re: API request and comparison</title>
      <link>https://community.splunk.com/t5/Alerting/API-request-and-comparison-Can-this-be-achieved/m-p/617236#M14430</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/136781"&gt;@renjith_nair&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks very much for your response.&lt;/P&gt;&lt;P&gt;Will it be possible to CURL or make an API get request to retrieve the json before exracting?&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Cluster 1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;curl https://cluster1.Appxyz

{
  "name": "cluster1",
  "clustername": "cluster1_name",
  "version": "v123"
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Cluster 2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;curl https://cluster2.Appxyz

{
  "name": "cluster2",
  "clustername": "cluster2_name",
  "version": "v321"
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created a python script to do that, i.e send requests to two URL endpoint -- respond with json key/values.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Extracted the "version" key from both responses and assert that the version values from both endpoints are the same or no.&lt;/P&gt;&lt;P&gt;Will splunk be able to run all the flows, starting from making the API call request? or CURL the url/endpoint?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 15 Oct 2022 04:18:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/API-request-and-comparison-Can-this-be-achieved/m-p/617236#M14430</guid>
      <dc:creator>cheanaydoo</dc:creator>
      <dc:date>2022-10-15T04:18:30Z</dc:date>
    </item>
  </channel>
</rss>

