<?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 Re: SPL search pattern efficiency: join vs eventstats in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/SPL-search-pattern-efficiency-join-vs-eventstats/m-p/323368#M96524</link>
    <description>&lt;P&gt;Yes, this should be much better than the join. &lt;/P&gt;

&lt;P&gt;I'd tend to do it this way, which is pretty much equivalent to yours performance-wise... &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="blocklist"  (status="submitted" OR status="approved" OR status="rejected")
| eventstats max(eval(case(status="rejected" OR status="approved","Yes"))) as decisioned 
     BY action indicator
| where status="submitted" AND isnull(decisioned)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;P&gt;updated to use &lt;CODE&gt;where&lt;/CODE&gt;.&lt;/P&gt;</description>
    <pubDate>Tue, 23 Jan 2018 15:57:08 GMT</pubDate>
    <dc:creator>DalJeanis</dc:creator>
    <dc:date>2018-01-23T15:57:08Z</dc:date>
    <item>
      <title>SPL search pattern efficiency: join vs eventstats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/SPL-search-pattern-efficiency-join-vs-eventstats/m-p/323367#M96523</link>
      <description>&lt;P&gt;We have a Splunk app that was developed in-house to track indicators that are submitted to a blocklist. Here's a simplified version of the workflow:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Analyst submits indicator to be blocked/unblocked/whitelisted. An event like this is logged: &lt;CODE&gt;index="blocklist" user="jsmith" indicator="badguy@test.com" source="threatfeed" status="submitted" action="block"&lt;/CODE&gt;. (Additional, sensitive fields are present in real events.)&lt;/LI&gt;
&lt;LI&gt;Lead analyst reviews submissions and approves or rejects each indicator. An event like this is logged: &lt;CODE&gt;index="blocklist" user="dtownsend" indicator="badguy@test.com" source="threatfeed" status="approved" action="block"&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;Lead analyst complies newly-approved indicators and sends them to an operations team for implementation. An event like this is logged: &lt;CODE&gt;index="blocklist" user="dtownsend" indicator="badguy@test.com" source="threatfeed" status="distributed" action="block"&lt;/CODE&gt;&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;I am trying to revise the queries that populate some of that dashboards that analysts use to interact with the blocklist data, and I'd like some guidance on search patterns. I've been running local tests on the various approaches, but the results aren't as conclusive as I'd like.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Approval/Rejection Dashboard&lt;/STRONG&gt;&lt;BR /&gt;
This page should display all indicators that have been submitted in the last seven days and have not yet been approved. The engineer who built this app used the following query structure to populate the dashboard:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="blocklist" status="submitted"
| join type=left indicator action source 
[ index="blocklist" (status="approved" OR status="rejected")
  | eval has_been_reviewed="true" ]
| search NOT (has_been_reviewed="true")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I've learned to be wary anytime I see &lt;CODE&gt;join&lt;/CODE&gt;, and I understand that negative searches (i.e. searches using &lt;CODE&gt;NOT&lt;/CODE&gt;) are less efficient than positive searches. So I was planning to revise the above into this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="blocklist" (status="submitted" OR status="approved" OR status="rejected")
| eventstats dc(status) AS status_count values(status) AS status BY action indicator
| search status_count=1 status="submitted"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However, I wanted to first ask - is &lt;CODE&gt;eventstats&lt;/CODE&gt; more efficient? Or is there an even better pattern I could be using for this search? Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2018 21:02:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/SPL-search-pattern-efficiency-join-vs-eventstats/m-p/323367#M96523</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2018-01-22T21:02:05Z</dc:date>
    </item>
    <item>
      <title>Re: SPL search pattern efficiency: join vs eventstats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/SPL-search-pattern-efficiency-join-vs-eventstats/m-p/323368#M96524</link>
      <description>&lt;P&gt;Yes, this should be much better than the join. &lt;/P&gt;

&lt;P&gt;I'd tend to do it this way, which is pretty much equivalent to yours performance-wise... &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="blocklist"  (status="submitted" OR status="approved" OR status="rejected")
| eventstats max(eval(case(status="rejected" OR status="approved","Yes"))) as decisioned 
     BY action indicator
| where status="submitted" AND isnull(decisioned)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;P&gt;updated to use &lt;CODE&gt;where&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2018 15:57:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/SPL-search-pattern-efficiency-join-vs-eventstats/m-p/323368#M96524</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2018-01-23T15:57:08Z</dc:date>
    </item>
  </channel>
</rss>

