<?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 Compare data between 2 indexes in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Compare-data-between-2-indexes/m-p/490588#M136984</link>
    <description>&lt;P&gt;Hi i am using below query to get the results for  Ip&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=shinken sourcetype=shinken_alarms Level=HARD Status!=UP Status!=OK Status!=UNKNOWN NOT [|inputlookup Shinken_Flapping_Devices.csv | rename Hostname as Device | fields Device] | lookup   KV_UNICORN.csv  Device output  "Infrastructure Name" Environment Type Ip| fillnull "Infrastructure Name"  | search "Infrastructure Name"!=0 | search Environment="Production"  OR Environment="Production - Backup"  | stats count by Ip
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then i have another query which give me results by IP&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="spectrum"  * | spath "alarm.@id" |spath "alarm.attribute{}.$" | spath "alarm.attribute{}.@id" | search "alarm.attribute{}.$"=psehlx20| eval foo=_cd | rename "alarm.attribute{}.$" as value "alarm.attribute{}.@id" as attr | table _time foo attr value| eval id=_cd | eval value=mvzip(attr,value) | mvexpand value | eval attr=mvindex(split(value,","),0) | eval value=mvindex(split(value,","),1) | lookup attr_alarm_spectrum.csv attr OUTPUT field | table _time,field,value,foo | fillnull field,value,foo  | eval {field}=value | fields - field,value | stats values(*) as * by _time,foo | fields - foo  | eval Severity=if(Severity="3","Critical",if(Severity="2","Major","Minor")) | search Severity=* (Name="***" OR IP="*")  | lookup  State_of_the_Asset_List_on_Unicorn.csv Ip as IP output  "Infrastrucure Name" | lookup spectrum_database_v2.csv Network_Address as IP  output Topology_Model_Name_String
| table _time, Severity,Name,IP,Secure_Domain,Type,Title,Landscape,Acknowledged,Ticket_ID "Topology_Model_Name_String" "Infrastrucure Name"  
| sort -_time | stats count by IP 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now  i have to show in the dashboard to show ips common to both indexes and the respective counts. So that we can see the difference of count for one ip in both the indexes. &lt;/P&gt;</description>
    <pubDate>Thu, 23 Jan 2020 14:22:38 GMT</pubDate>
    <dc:creator>surekhasplunk</dc:creator>
    <dc:date>2020-01-23T14:22:38Z</dc:date>
    <item>
      <title>Compare data between 2 indexes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-data-between-2-indexes/m-p/490588#M136984</link>
      <description>&lt;P&gt;Hi i am using below query to get the results for  Ip&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=shinken sourcetype=shinken_alarms Level=HARD Status!=UP Status!=OK Status!=UNKNOWN NOT [|inputlookup Shinken_Flapping_Devices.csv | rename Hostname as Device | fields Device] | lookup   KV_UNICORN.csv  Device output  "Infrastructure Name" Environment Type Ip| fillnull "Infrastructure Name"  | search "Infrastructure Name"!=0 | search Environment="Production"  OR Environment="Production - Backup"  | stats count by Ip
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then i have another query which give me results by IP&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="spectrum"  * | spath "alarm.@id" |spath "alarm.attribute{}.$" | spath "alarm.attribute{}.@id" | search "alarm.attribute{}.$"=psehlx20| eval foo=_cd | rename "alarm.attribute{}.$" as value "alarm.attribute{}.@id" as attr | table _time foo attr value| eval id=_cd | eval value=mvzip(attr,value) | mvexpand value | eval attr=mvindex(split(value,","),0) | eval value=mvindex(split(value,","),1) | lookup attr_alarm_spectrum.csv attr OUTPUT field | table _time,field,value,foo | fillnull field,value,foo  | eval {field}=value | fields - field,value | stats values(*) as * by _time,foo | fields - foo  | eval Severity=if(Severity="3","Critical",if(Severity="2","Major","Minor")) | search Severity=* (Name="***" OR IP="*")  | lookup  State_of_the_Asset_List_on_Unicorn.csv Ip as IP output  "Infrastrucure Name" | lookup spectrum_database_v2.csv Network_Address as IP  output Topology_Model_Name_String
| table _time, Severity,Name,IP,Secure_Domain,Type,Title,Landscape,Acknowledged,Ticket_ID "Topology_Model_Name_String" "Infrastrucure Name"  
| sort -_time | stats count by IP 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now  i have to show in the dashboard to show ips common to both indexes and the respective counts. So that we can see the difference of count for one ip in both the indexes. &lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 14:22:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-data-between-2-indexes/m-p/490588#M136984</guid>
      <dc:creator>surekhasplunk</dc:creator>
      <dc:date>2020-01-23T14:22:38Z</dc:date>
    </item>
  </channel>
</rss>

