{"id":70647,"date":"2023-02-13T20:27:35","date_gmt":"2023-02-13T20:27:35","guid":{"rendered":"https:\/\/merikebi.warrenmyers.com\/?p=70647"},"modified":"2023-02-13T20:27:35","modified_gmt":"2023-02-13T20:27:35","slug":"answer-by-warren-for-splunk-filter-one-search-by-another","status":"publish","type":"post","link":"https:\/\/merikebi.warrenmyers.com\/?p=70647","title":{"rendered":"Answer by warren for Splunk filter one search by another"},"content":{"rendered":"<p>I believe this is what you&#8217;re looking for:<\/p>\n<pre><code>index=main sourcetype=srctp orderNumber=* &quot;failed insert&quot; NOT\n    [search index=main sourcetype=srctp orderNumber=* &quot;successful insert&quot;\n    | stats count by orderNumber\n    | fields - count ]\n| stats count by orderNumber\n| fields - count\n<\/code><\/pre>\n<p>First, <code>stats<\/code> is going to be a lot more performant than <code>dedup<\/code><\/p>\n<p>Second, so long as your &quot;successful insert&quot; search is 10k items or fewer, it should complete<\/p>\n<p>If it&#8217;s longer than 10k items, you may need to do something like this:<\/p>\n<pre><code>index=main orderNumber=* (&quot;failed insert&quot; OR &quot;successful insert&quot;)\n| rex field=_raw &quot;(?&lt;insert&gt;\\w+ )insert&quot;\n| stats values(insert) as inserts by orderNumber\n| search inserts=&quot;*failed*&quot;\n| where mvcount(inserts)&lt;2\n<\/code><\/pre>\n<p>What this should do is extract the type of insert (&quot;failed&quot; or &quot;successful&quot;) into a new field named <code>insert<\/code><\/p>\n<p>Then <code>stats values()<\/code> all of the insert types each <code>orderNumber<\/code> had<\/p>\n<p>Then ensure we&#8217;re only looking at <code>orderNumber<\/code> entries that have a &quot;failed&quot; insert<\/p>\n<p>Then check to make sure there is only one entry in the <code>values()<\/code>&#8216;d field (ie there is no &quot;successful&quot; entry present<\/p>\n<p>from User warren &#8211; Stack Overflow https:\/\/stackoverflow.com\/questions\/75440402\/splunk-filter-one-search-by-another\/75440847#75440847<br \/>\nvia <a href=\"https:\/\/ifttt.com\/?ref=da&#038;site=wordpress\">IFTTT<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I believe this is what you&#8217;re looking for: index=main sourcetype=srctp orderNumber=* &quot;failed insert&quot; NOT [search index=main sourcetype=srctp orderNumber=* &quot;successful insert&quot; | stats count by orderNumber | fields &#8211; count ] | stats count by orderNumber | fields &#8211; count First, stats is going to be a lot more performant than dedup Second, so long as &hellip;<br \/><a href=\"https:\/\/merikebi.warrenmyers.com\/?p=70647\" class=\"more-link pen_button pen_element_default pen_icon_arrow_double\">Continue reading <span class=\"screen-reader-text\">Answer by warren for Splunk filter one search by another<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[991],"keyring_services":[],"class_list":["post-70647","post","type-post","status-publish","format-standard","hentry","category-blih","tag-stackexchange"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/70647","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=70647"}],"version-history":[{"count":1,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/70647\/revisions"}],"predecessor-version":[{"id":70648,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/70647\/revisions\/70648"}],"wp:attachment":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=70647"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=70647"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=70647"},{"taxonomy":"keyring_services","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fkeyring_services&post=70647"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}