<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to search against multiple elements in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-against-multiple-elements/m-p/491758#M137248</link>
    <description>&lt;P&gt;Be sure to try mine; it should scale better and is much shorter.&lt;/P&gt;</description>
    <pubDate>Fri, 22 Nov 2019 15:49:14 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2019-11-22T15:49:14Z</dc:date>
    <item>
      <title>How to search against multiple elements</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-against-multiple-elements/m-p/491754#M137244</link>
      <description>&lt;P&gt;I'm trying to capture occurrences when multiple criteria are true in an event where elements can exist multiple times in the message.&lt;BR /&gt;&lt;BR /&gt;
For example, with the below event I want to capture how often events have an element that is both id=A and width&amp;gt;600.&lt;/P&gt;

&lt;P&gt;Because there are multiple walls I can easily filter when any element has an id=A or a width&amp;gt;600, but I cannot figure out how to filter where both criteria are met.&lt;/P&gt;

&lt;P&gt;Example message below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;elements: [
   {
      id: A
      width: 585
   }
   {
      id: B
      width: 605
   }
]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Nov 2019 16:52:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-against-multiple-elements/m-p/491754#M137244</guid>
      <dc:creator>47024</dc:creator>
      <dc:date>2019-11-20T16:52:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to search against multiple elements</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-against-multiple-elements/m-p/491755#M137245</link>
      <description>&lt;P&gt;You can either leverage the &lt;CODE&gt;spath&lt;/CODE&gt; command &lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.0/SearchReference/Spath" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.0/SearchReference/Spath&lt;/A&gt; to make the data easier to work with, or look at the answer posted here: &lt;A href="https://answers.splunk.com/answers/784418/dynamic-loop-through-a-json-array-looking-for-trig.html#answer-785479" target="_blank"&gt;https://answers.splunk.com/answers/784418/dynamic-loop-through-a-json-array-looking-for-trig.html#answer-785479&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Essentially, you need to create a pairing between id and width, separate them into their own rows, index them out, and then run your search:&lt;/P&gt;

&lt;P&gt;{code}&lt;BR /&gt;
your_base_search &lt;BR /&gt;
| eval id_zip_width=mvzip(id,width) &lt;BR /&gt;
| mvexpand id_zip_width&lt;BR /&gt;
| eval id_zip_width=split(id_zip_width,",") &lt;BR /&gt;
| eval id=mvindex(id_zip_width,0) &lt;BR /&gt;
| eval width=mvindex(id_zip_width,1) &lt;BR /&gt;
| search id="A" and width&amp;gt;600&lt;BR /&gt;
{code}&lt;/P&gt;

&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:02:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-against-multiple-elements/m-p/491755#M137245</guid>
      <dc:creator>aberkow</dc:creator>
      <dc:date>2020-09-30T03:02:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to search against multiple elements</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-against-multiple-elements/m-p/491756#M137246</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval _raw = mvzip(id, width, "=")
| kv
| where A&amp;gt;600
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Nov 2019 22:46:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-against-multiple-elements/m-p/491756#M137246</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-11-20T22:46:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to search against multiple elements</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-against-multiple-elements/m-p/491757#M137247</link>
      <description>&lt;P&gt;This worked!  Thank you very much.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 14:19:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-against-multiple-elements/m-p/491757#M137247</guid>
      <dc:creator>47024</dc:creator>
      <dc:date>2019-11-22T14:19:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to search against multiple elements</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-against-multiple-elements/m-p/491758#M137248</link>
      <description>&lt;P&gt;Be sure to try mine; it should scale better and is much shorter.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 15:49:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-against-multiple-elements/m-p/491758#M137248</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-11-22T15:49:14Z</dc:date>
    </item>
  </channel>
</rss>

