{"id":70523,"date":"2023-02-09T02:07:34","date_gmt":"2023-02-09T02:07:34","guid":{"rendered":"https:\/\/merikebi.warrenmyers.com\/?p=70523"},"modified":"2023-02-09T02:07:34","modified_gmt":"2023-02-09T02:07:34","slug":"answer-by-warren-for-splunk-subsearch-is-not-returning-the-data-i-expect-it-to-return","status":"publish","type":"post","link":"https:\/\/merikebi.warrenmyers.com\/?p=70523","title":{"rendered":"Answer by warren for Splunk subsearch is not returning the data I expect it to return"},"content":{"rendered":"<p>You should be able to combine it all in one go:<\/p>\n<pre><code>index=ndx (souerce=source1 OR source=source2)\n| rex field=_raw &quot;Naam[^:]+:\\s(?&lt;user1&gt;\\S+)\n| rex field=_raw &quot;User:(?&lt;user2&gt;\\S+)\\s(?&lt;msg&gt;.+)\n| eval user=coalesce(user1,user2)\n| stats max(_time) as _time latest(lsg) as msg by user\n<\/code><\/pre>\n<p>What this does: extract two field (<code>user1<\/code> &amp; <code>user2<\/code>) from your two sources<\/p>\n<p><code>coalesce<\/code> them into one field named &quot;<code>user<\/code>&quot;<\/p>\n<p>Report the most recent <code>msg<\/code> for that <code>user<\/code> and the most recent <code>_time<\/code> you have an event for<\/p>\n<hr \/>\n<p>(You <em>should<\/em> be able to abbreviate this slightly by using the same named field extraction (<code>user<\/code>) instead of two with a <code>coalesce<\/code>, I just wanted it to be clear)<\/p>\n<p>from User warren &#8211; Stack Overflow https:\/\/stackoverflow.com\/questions\/75386658\/splunk-subsearch-is-not-returning-the-data-i-expect-it-to-return\/75393485#75393485<br \/>\nvia <a href=\"https:\/\/ifttt.com\/?ref=da&#038;site=wordpress\">IFTTT<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>You should be able to combine it all in one go: index=ndx (souerce=source1 OR source=source2) | rex field=_raw &quot;Naam[^:]+:\\s(?&lt;user1&gt;\\S+) | rex field=_raw &quot;User:(?&lt;user2&gt;\\S+)\\s(?&lt;msg&gt;.+) | eval user=coalesce(user1,user2) | stats max(_time) as _time latest(lsg) as msg by user What this does: extract two field (user1 &amp; user2) from your two sources coalesce them into one field named &hellip;<br \/><a href=\"https:\/\/merikebi.warrenmyers.com\/?p=70523\" class=\"more-link pen_button pen_element_default pen_icon_arrow_double\">Continue reading <span class=\"screen-reader-text\">Answer by warren for Splunk subsearch is not returning the data I expect it to return<\/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-70523","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\/70523","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=70523"}],"version-history":[{"count":1,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/70523\/revisions"}],"predecessor-version":[{"id":70524,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/70523\/revisions\/70524"}],"wp:attachment":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=70523"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=70523"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=70523"},{"taxonomy":"keyring_services","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fkeyring_services&post=70523"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}