{"id":75867,"date":"2023-07-27T12:33:00","date_gmt":"2023-07-27T12:33:00","guid":{"rendered":"https:\/\/merikebi.warrenmyers.com\/?p=75867"},"modified":"2023-07-27T12:33:00","modified_gmt":"2023-07-27T12:33:00","slug":"answer-by-warren-for-list-unique-values-from-splunk-events","status":"publish","type":"post","link":"https:\/\/merikebi.warrenmyers.com\/?p=75867","title":{"rendered":"Answer by warren for List unique values from splunk events"},"content":{"rendered":"<p><a href=\"https:\/\/docs.splunk.com\/Documentation\/Splunk\/latest\/SearchReference\/stats\" rel=\"nofollow noreferrer\"><code>stats<\/code><\/a> will be your friend here:<\/p>\n<pre><code>index=myIndex container_name=&quot;abc-mno-pqr&quot; &quot;status code :: 50*&quot;\n| stats latest(status) as Status-Code by transactionId\n<\/code><\/pre>\n<p>If the fields <code>transactionId<\/code> and <code>status<\/code> are not yet extracted, you&#8217;ll need to pull them out<\/p>\n<p>A way to do this at search time is with <a href=\"https:\/\/docs.splunk.com\/Documentation\/Splunk\/latest\/SearchReference\/rex\" rel=\"nofollow noreferrer\"><code>rex<\/code><\/a>:<\/p>\n<pre><code>| rex field=_raw &quot;code\\D+(?&lt;status&gt;\\d+)&quot;\n| rex field=_raw &quot;^\\[(?&lt;transactionId&gt;[^\\]]+)&quot;\n<\/code><\/pre>\n<p>regex101 verifications: <a href=\"https:\/\/regex101.com\/r\/JDgzya\/1\" rel=\"nofollow noreferrer\">https:\/\/regex101.com\/r\/JDgzya\/1<\/a> &amp;&amp; <a href=\"https:\/\/regex101.com\/r\/O5qTJ9\/1\" rel=\"nofollow noreferrer\">https:\/\/regex101.com\/r\/O5qTJ9\/1<\/a><\/p>\n<p>from User warren &#8211; Stack Overflow https:\/\/stackoverflow.com\/questions\/76777324\/list-unique-values-from-splunk-events\/76779761#76779761<br \/>\nvia <a href=\"https:\/\/ifttt.com\/?ref=da&#038;site=wordpress\">IFTTT<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>stats will be your friend here: index=myIndex container_name=&quot;abc-mno-pqr&quot; &quot;status code :: 50*&quot; | stats latest(status) as Status-Code by transactionId If the fields transactionId and status are not yet extracted, you&#8217;ll need to pull them out A way to do this at search time is with rex: | rex field=_raw &quot;code\\D+(?&lt;status&gt;\\d+)&quot; | rex field=_raw &quot;^\\[(?&lt;transactionId&gt;[^\\]]+)&quot; regex101 &hellip;<br \/><a href=\"https:\/\/merikebi.warrenmyers.com\/?p=75867\" class=\"more-link pen_button pen_element_default pen_icon_arrow_double\">Continue reading <span class=\"screen-reader-text\">Answer by warren for List unique values from splunk events<\/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-75867","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\/75867","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=75867"}],"version-history":[{"count":1,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/75867\/revisions"}],"predecessor-version":[{"id":75868,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/75867\/revisions\/75868"}],"wp:attachment":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=75867"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=75867"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=75867"},{"taxonomy":"keyring_services","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fkeyring_services&post=75867"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}