<?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 Can you help me create a search that would match fields for two different indexes and stats? in Splunk Enterprise Security</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Can-you-help-me-create-a-search-that-would-match-fields-for-two/m-p/453358#M6362</link>
    <description>&lt;P&gt;Hi team!&lt;/P&gt;

&lt;P&gt;I need help with a search. &lt;/P&gt;

&lt;P&gt;I have 2 indexes and I want to match both for an IP field. If they match, I want stats for the first one.&lt;/P&gt;

&lt;P&gt;This is my search right now.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=AAA Ip=*) OR (index=BBB src_ip=* (threat_name="SCAN: Host Sweep(8002)" OR threat_name="SCAN: TCP Port Scan(8001)" OR threat_name="TCP Flood(8501)" OR threat_name="UDP Flood(8502)" OR threat_name="TCP SYN with data(8723)") (src_zone!="Inet-WAN1" AND src_zone!="Inet-WAN2") (dest_zone!="Inet-WAN1" AND dest_zone!="Inet-WAN2") src_ip != 191.100.200.27 AND src_ip != 191.100.200.71 AND src_ip != 191.100.200.56) | eval match_ip=coalesce(Ip,src_ip) | stats values(*) AS * by match_ip | search src_ip=* Ip=* | stats count, values(src_zone) as Source_zone,values(dest_zone) as Destination_zone, values(threat_name) as "Threat name", values(vendor_action) as Action, values(severity) as Severity by user,src_ip, generated_time, dest_ip |table generated_time,"Threat name", Action,Severity src_ip, dest_ip,user, Source_zone, Destination_zone | rename src_ip as Source_IP, dest_ip as Destination_IP, user as User, generated_time as Date
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Right now it finds the match IP. But the problem is it didn't show the fields well. I should have 55 events and I have 2000. Every IP has multiple times, dest zones etc. Obviously, this is not true.&lt;/P&gt;

&lt;P&gt;Thank you!&lt;/P&gt;</description>
    <pubDate>Mon, 10 Sep 2018 15:13:53 GMT</pubDate>
    <dc:creator>christianubeda</dc:creator>
    <dc:date>2018-09-10T15:13:53Z</dc:date>
    <item>
      <title>Can you help me create a search that would match fields for two different indexes and stats?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Can-you-help-me-create-a-search-that-would-match-fields-for-two/m-p/453358#M6362</link>
      <description>&lt;P&gt;Hi team!&lt;/P&gt;

&lt;P&gt;I need help with a search. &lt;/P&gt;

&lt;P&gt;I have 2 indexes and I want to match both for an IP field. If they match, I want stats for the first one.&lt;/P&gt;

&lt;P&gt;This is my search right now.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=AAA Ip=*) OR (index=BBB src_ip=* (threat_name="SCAN: Host Sweep(8002)" OR threat_name="SCAN: TCP Port Scan(8001)" OR threat_name="TCP Flood(8501)" OR threat_name="UDP Flood(8502)" OR threat_name="TCP SYN with data(8723)") (src_zone!="Inet-WAN1" AND src_zone!="Inet-WAN2") (dest_zone!="Inet-WAN1" AND dest_zone!="Inet-WAN2") src_ip != 191.100.200.27 AND src_ip != 191.100.200.71 AND src_ip != 191.100.200.56) | eval match_ip=coalesce(Ip,src_ip) | stats values(*) AS * by match_ip | search src_ip=* Ip=* | stats count, values(src_zone) as Source_zone,values(dest_zone) as Destination_zone, values(threat_name) as "Threat name", values(vendor_action) as Action, values(severity) as Severity by user,src_ip, generated_time, dest_ip |table generated_time,"Threat name", Action,Severity src_ip, dest_ip,user, Source_zone, Destination_zone | rename src_ip as Source_IP, dest_ip as Destination_IP, user as User, generated_time as Date
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Right now it finds the match IP. But the problem is it didn't show the fields well. I should have 55 events and I have 2000. Every IP has multiple times, dest zones etc. Obviously, this is not true.&lt;/P&gt;

&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 10 Sep 2018 15:13:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/Can-you-help-me-create-a-search-that-would-match-fields-for-two/m-p/453358#M6362</guid>
      <dc:creator>christianubeda</dc:creator>
      <dc:date>2018-09-10T15:13:53Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me create a search that would match fields for two different indexes and stats?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Can-you-help-me-create-a-search-that-would-match-fields-for-two/m-p/453359#M6363</link>
      <description>&lt;P&gt;Maybe using a subsearch? It has limits but for small amounts of data or time ranges it is fine.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=AAA 
    [search index=BBB ... 
    | stats count by src_ip
    | table src_ip
    | format]
| ...etc
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/7.1.2/Search/Aboutsubsearches"&gt;https://docs.splunk.com/Documentation/Splunk/7.1.2/Search/Aboutsubsearches&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Sep 2018 13:08:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/Can-you-help-me-create-a-search-that-would-match-fields-for-two/m-p/453359#M6363</guid>
      <dc:creator>osakachan</dc:creator>
      <dc:date>2018-09-13T13:08:26Z</dc:date>
    </item>
  </channel>
</rss>

