{"id":60730,"date":"2022-07-19T19:28:05","date_gmt":"2022-07-19T19:28:05","guid":{"rendered":"https:\/\/merikebi.warrenmyers.com\/?p=60730"},"modified":"2022-07-19T19:28:05","modified_gmt":"2022-07-19T19:28:05","slug":"answer-by-warren-for-splunk-rex-command-to-search-exception-and-count-the-error-codes","status":"publish","type":"post","link":"https:\/\/merikebi.warrenmyers.com\/?p=60730","title":{"rendered":"Answer by warren for splunk rex command to search exception and count the error codes"},"content":{"rendered":"<p>Based on <a href=\"https:\/\/regex101.com\/r\/b3IL0u\/1\" rel=\"nofollow noreferrer\">your sample data<\/a>, this <a href=\"https:\/\/docs.splunk.com\/Documentation\/Splunk\/latest\/SearchReference\/rex\" rel=\"nofollow noreferrer\"><code>rex<\/code><\/a> will pull what you&#8217;re looking for into a new field <code>msg<\/code>:<\/p>\n<pre><code>| rex field=_raw &quot;:\\s+(?&lt;msg&gt;\\d+\\s+\\w+.+)&quot;\n<\/code><\/pre>\n<p>You can then <a href=\"https:\/\/docs.splunk.com\/Documentation\/Splunk\/latest\/SearchReference\/stats\" rel=\"nofollow noreferrer\"><code>stats<\/code><\/a> it into a table:<\/p>\n<pre><code>| stats count by msg\n<\/code><\/pre>\n<p>from User warren &#8211; Stack Overflow https:\/\/stackoverflow.com\/questions\/73039433\/splunk-rex-command-to-search-exception-and-count-the-error-codes\/73042485#73042485<br \/>\nvia <a href=\"https:\/\/ifttt.com\/?ref=da&#038;site=wordpress\">IFTTT<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Based on your sample data, this rex will pull what you&#8217;re looking for into a new field msg: | rex field=_raw &quot;:\\s+(?&lt;msg&gt;\\d+\\s+\\w+.+)&quot; You can then stats it into a table: | stats count by msg from User warren &#8211; Stack Overflow https:\/\/stackoverflow.com\/questions\/73039433\/splunk-rex-command-to-search-exception-and-count-the-error-codes\/73042485#73042485 via IFTTT<\/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-60730","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\/60730","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=60730"}],"version-history":[{"count":1,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/60730\/revisions"}],"predecessor-version":[{"id":60731,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/60730\/revisions\/60731"}],"wp:attachment":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=60730"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=60730"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=60730"},{"taxonomy":"keyring_services","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fkeyring_services&post=60730"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}