{"id":29209,"date":"2021-01-26T14:37:22","date_gmt":"2021-01-26T14:37:22","guid":{"rendered":"https:\/\/merikebi.warrenmyers.com\/?p=29209"},"modified":"2021-01-26T14:37:22","modified_gmt":"2021-01-26T14:37:22","slug":"answer-by-warren-for-how-do-i-access-an-array-value-inside-a-case-in-splunk","status":"publish","type":"post","link":"https:\/\/merikebi.warrenmyers.com\/?p=29209","title":{"rendered":"Answer by warren for How do I access an array value inside a case in Splunk?"},"content":{"rendered":"<p>Splunk doesn&#8217;t have &quot;arrays&quot;<\/p>\n<p>It has <a href=\"https:\/\/docs.splunk.com\/Documentation\/Splunk\/latest\/Search\/Parsemultivaluefields\" rel=\"nofollow noreferrer\">multivalue fields<\/a><\/p>\n<p>To access\/do anything with them, you need to use multivalue commands\/functions<\/p>\n<ul>\n<li>multivalue eval functions &#8211; <a href=\"https:\/\/docs.splunk.com\/Documentation\/Splunk\/latest\/SearchReference\/MultivalueEvalFunctions\" rel=\"nofollow noreferrer\">https:\/\/docs.splunk.com\/Documentation\/Splunk\/latest\/SearchReference\/MultivalueEvalFunctions<\/a><\/li>\n<li>multivalue stats functions &#8211; <a href=\"https:\/\/docs.splunk.com\/Documentation\/Splunk\/latest\/SearchReference\/Multivaluefunctions\" rel=\"nofollow noreferrer\">https:\/\/docs.splunk.com\/Documentation\/Splunk\/latest\/SearchReference\/Multivaluefunctions<\/a><\/li>\n<\/ul>\n<p>In your example, you&#8217;d want to do something <em>like<\/em> the following:<\/p>\n<pre><code>&lt;search&gt;\n| eval EventType=case(mvindex(http.request.queryParameters.authIndexValue,0)==Login_FooBar,&quot;LOGIN&quot;, mvindex(http.request.queryParameters.authIndexValue,0)==Login_BarFoo,&quot;not a good login&quot;,1=1,&quot;error state&quot;)\n<\/code><\/pre>\n<p>from User warren &#8211; Stack Overflow https:\/\/stackoverflow.com\/questions\/65892385\/how-do-i-access-an-array-value-inside-a-case-in-splunk\/65903207#65903207<br \/>\nvia <a href=\"https:\/\/ifttt.com\/?ref=da&#038;site=wordpress\">IFTTT<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Splunk doesn&#8217;t have &quot;arrays&quot; It has multivalue fields To access\/do anything with them, you need to use multivalue commands\/functions multivalue eval functions &#8211; https:\/\/docs.splunk.com\/Documentation\/Splunk\/latest\/SearchReference\/MultivalueEvalFunctions multivalue stats functions &#8211; https:\/\/docs.splunk.com\/Documentation\/Splunk\/latest\/SearchReference\/Multivaluefunctions In your example, you&#8217;d want to do something like the following: &lt;search&gt; | eval EventType=case(mvindex(http.request.queryParameters.authIndexValue,0)==Login_FooBar,&quot;LOGIN&quot;, mvindex(http.request.queryParameters.authIndexValue,0)==Login_BarFoo,&quot;not a good login&quot;,1=1,&quot;error state&quot;) from User warren &#8211; Stack Overflow &hellip;<br \/><a href=\"https:\/\/merikebi.warrenmyers.com\/?p=29209\" class=\"more-link pen_button pen_element_default pen_icon_arrow_double\">Continue reading <span class=\"screen-reader-text\">Answer by warren for How do I access an array value inside a case in Splunk?<\/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-29209","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\/29209","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=29209"}],"version-history":[{"count":1,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/29209\/revisions"}],"predecessor-version":[{"id":29210,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/29209\/revisions\/29210"}],"wp:attachment":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=29209"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=29209"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=29209"},{"taxonomy":"keyring_services","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fkeyring_services&post=29209"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}