<?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: Filter data from MultiValue field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Filter-data-from-MultiValue-field/m-p/706350#M239048</link>
    <description>&lt;P&gt;Ok that's way too much logic for me to follow on a Monday morning before I have even had coffee.&amp;nbsp; I would split the fields into mv unique options.&amp;nbsp; Then start evaluating a new field based upon your logic flow.&amp;nbsp; Anything with a TRUE outcome can be your final results.&lt;/P&gt;</description>
    <pubDate>Mon, 09 Dec 2024 14:58:58 GMT</pubDate>
    <dc:creator>dural_yyz</dc:creator>
    <dc:date>2024-12-09T14:58:58Z</dc:date>
    <item>
      <title>Filter data from MultiValue field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filter-data-from-MultiValue-field/m-p/706328#M239042</link>
      <description>&lt;P&gt;Hi Splunk Experts,&lt;BR /&gt;&lt;BR /&gt;I'v been trying to apply three condition, but I'm bit complicating. So would like to have some inputs.&lt;BR /&gt;I have a runtime search which will produce three fields&amp;nbsp;Category, Data, Percent and I join/ append some data from lookup using User. The lookup has multi-value fields which are prefixed with Lookup.&lt;/P&gt;&lt;TABLE border="1" width="92.24874049976553%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="6.25%"&gt;User&lt;/TD&gt;&lt;TD width="6.25%" height="24px"&gt;Category&lt;/TD&gt;&lt;TD width="6.25%" height="24px"&gt;Data&lt;/TD&gt;&lt;TD width="6.25%" height="24px"&gt;Percent&lt;/TD&gt;&lt;TD width="12.5%" height="24px"&gt;LookupCategory&lt;/TD&gt;&lt;TD width="12.5%" height="24px"&gt;LookupData&lt;/TD&gt;&lt;TD width="12.5%" height="24px"&gt;LookupPercent&lt;/TD&gt;&lt;TD width="12.5%" height="24px"&gt;LookupND1&lt;/TD&gt;&lt;TD width="12.5%" height="24px"&gt;LookupND2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="6.25%"&gt;User094&lt;/TD&gt;&lt;TD width="6.25%" height="68px"&gt;103&lt;/TD&gt;&lt;TD width="6.25%" height="68px"&gt;2064&lt;/TD&gt;&lt;TD width="6.25%" height="68px"&gt;3.44&lt;/TD&gt;&lt;TD width="12.5%" height="68px"&gt;101&lt;BR /&gt;102&lt;BR /&gt;104&lt;/TD&gt;&lt;TD width="12.5%" height="68px"&gt;7865&lt;BR /&gt;4268&lt;BR /&gt;1976&lt;/TD&gt;&lt;TD width="12.5%" height="68px"&gt;7.10&lt;BR /&gt;3.21&lt;BR /&gt;3.56&lt;/TD&gt;&lt;TD width="12.5%" height="68px"&gt;4.90&lt;BR /&gt;2.11&lt;BR /&gt;3.10&lt;/TD&gt;&lt;TD width="12.5%" height="68px"&gt;2.20&lt;BR /&gt;1.10&lt;BR /&gt;0.46&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="6.25%"&gt;User871&lt;/TD&gt;&lt;TD width="6.25%" height="24px"&gt;102&lt;/TD&gt;&lt;TD width="6.25%" height="24px"&gt;5108&lt;/TD&gt;&lt;TD width="6.25%" height="24px"&gt;5.58&lt;/TD&gt;&lt;TD width="12.5%" height="24px"&gt;103&lt;/TD&gt;&lt;TD width="12.5%" height="24px"&gt;3897&lt;/TD&gt;&lt;TD width="12.5%" height="24px"&gt;7.31&lt;/TD&gt;&lt;TD width="12.5%" height="24px"&gt;5.23&lt;/TD&gt;&lt;TD width="12.5%" height="24px"&gt;2.08&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="6.25%"&gt;User131&lt;/TD&gt;&lt;TD width="6.25%" height="68px"&gt;104&lt;/TD&gt;&lt;TD width="6.25%" height="68px"&gt;664&lt;/TD&gt;&lt;TD width="6.25%" height="68px"&gt;0.71&lt;/TD&gt;&lt;TD width="12.5%" height="68px"&gt;103&lt;BR /&gt;104&lt;BR /&gt;105&lt;/TD&gt;&lt;TD width="12.5%" height="68px"&gt;2287&lt;BR /&gt;1576&lt;BR /&gt;438&lt;/TD&gt;&lt;TD width="12.5%" height="68px"&gt;0.22&lt;BR /&gt;0.30&lt;BR /&gt;0.82&lt;/TD&gt;&lt;TD width="12.5%" height="68px"&gt;0.11&lt;BR /&gt;0.08&lt;BR /&gt;0.50&lt;/TD&gt;&lt;TD width="12.5%" height="68px"&gt;0.11&lt;BR /&gt;0.02&lt;BR /&gt;0.32&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="6.25%"&gt;User755&lt;/TD&gt;&lt;TD width="6.25%" height="46px"&gt;104&lt;/TD&gt;&lt;TD width="6.25%" height="46px"&gt;1241&lt;/TD&gt;&lt;TD width="6.25%" height="46px"&gt;1.23&lt;/TD&gt;&lt;TD width="12.5%" height="46px"&gt;102&lt;BR /&gt;104&lt;/TD&gt;&lt;TD width="12.5%" height="46px"&gt;4493&lt;BR /&gt;975&lt;/TD&gt;&lt;TD width="12.5%" height="46px"&gt;0.97&lt;BR /&gt;1.12&lt;/TD&gt;&lt;TD width="12.5%" height="46px"&gt;0.42&lt;BR /&gt;1.01&lt;/TD&gt;&lt;TD width="12.5%" height="46px"&gt;0.55&lt;BR /&gt;0.11&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;My conditions are as follow:&lt;BR /&gt;1. Use Precedence Category if it's greater than current Category.&lt;BR /&gt;For Ex below dataset: The Category is 103, I have to check which is the max(LookupPercent) between 101 to 103 and use it if the value in (101 or 102) is greater than 103.&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="6.25%"&gt;User094&lt;/TD&gt;&lt;TD width="6.25%" height="68px"&gt;103&lt;/TD&gt;&lt;TD width="6.25%" height="68px"&gt;2064&lt;/TD&gt;&lt;TD width="6.25%" height="68px"&gt;3.44&lt;/TD&gt;&lt;TD width="12.5%" height="68px"&gt;101&lt;BR /&gt;102&lt;BR /&gt;104&lt;/TD&gt;&lt;TD width="12.5%" height="68px"&gt;7865&lt;BR /&gt;4268&lt;BR /&gt;1976&lt;/TD&gt;&lt;TD width="12.5%" height="68px"&gt;7.10&lt;BR /&gt;3.21&lt;BR /&gt;3.56&lt;/TD&gt;&lt;TD width="12.5%" height="68px"&gt;4.90&lt;BR /&gt;2.11&lt;BR /&gt;3.10&lt;/TD&gt;&lt;TD width="12.5%" height="68px"&gt;2.20&lt;BR /&gt;1.10&lt;BR /&gt;0.46&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;2. Ignore if the LookupCategory has no CategoryValue equal to or greater than&lt;/P&gt;&lt;P&gt;In below case Category is 102, but the lookup has only 103, but no data between 101 to 102. So ignore.&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="6.25%"&gt;User871&lt;/TD&gt;&lt;TD width="6.25%" height="24px"&gt;102&lt;/TD&gt;&lt;TD width="6.25%" height="24px"&gt;5108&lt;/TD&gt;&lt;TD width="6.25%" height="24px"&gt;5.58&lt;/TD&gt;&lt;TD width="12.5%" height="24px"&gt;103&lt;/TD&gt;&lt;TD width="12.5%" height="24px"&gt;3897&lt;/TD&gt;&lt;TD width="12.5%" height="24px"&gt;7.31&lt;/TD&gt;&lt;TD width="12.5%" height="24px"&gt;5.23&lt;/TD&gt;&lt;TD width="12.5%" height="24px"&gt;2.08&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;3. If the Lookup Current Category Percent is lesser than immediate following category, then find abs difference of Current Category with lookup Category and immediate following Category using Data field and if immediate following is near then use&amp;nbsp;immediate following category.&lt;BR /&gt;LookupCategory 104's Percent 0.30 is less than 105's 0.82. So as further step abs(664 - 1576) and abs(664 - 438), as (664 - 438) is less than (664 - 1576), the 105's row data should be filtered/ used.&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="6.25%"&gt;User131&lt;/TD&gt;&lt;TD width="6.25%" height="68px"&gt;104&lt;/TD&gt;&lt;TD width="6.25%" height="68px"&gt;664&lt;/TD&gt;&lt;TD width="6.25%" height="68px"&gt;0.71&lt;/TD&gt;&lt;TD width="12.5%" height="68px"&gt;103&lt;BR /&gt;104&lt;BR /&gt;105&lt;/TD&gt;&lt;TD width="12.5%" height="68px"&gt;2287&lt;BR /&gt;1576&lt;BR /&gt;438&lt;/TD&gt;&lt;TD width="12.5%" height="68px"&gt;0.22&lt;BR /&gt;0.30&lt;BR /&gt;0.82&lt;/TD&gt;&lt;TD width="12.5%" height="68px"&gt;0.11&lt;BR /&gt;0.08&lt;BR /&gt;0.50&lt;/TD&gt;&lt;TD width="12.5%" height="68px"&gt;0.11&lt;BR /&gt;0.02&lt;BR /&gt;0.32&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;4. Straight forward, none of above condition matches Same lookupCatagory 104's row should be used for Category 104.&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="6.25%"&gt;User755&lt;/TD&gt;&lt;TD width="6.25%" height="46px"&gt;104&lt;/TD&gt;&lt;TD width="6.25%" height="46px"&gt;1241&lt;/TD&gt;&lt;TD width="6.25%" height="46px"&gt;1.23&lt;/TD&gt;&lt;TD width="12.5%" height="46px"&gt;102&lt;BR /&gt;104&lt;/TD&gt;&lt;TD width="12.5%" height="46px"&gt;4493&lt;BR /&gt;975&lt;/TD&gt;&lt;TD width="12.5%" height="46px"&gt;0.97&lt;BR /&gt;1.12&lt;/TD&gt;&lt;TD width="12.5%" height="46px"&gt;0.42&lt;BR /&gt;1.01&lt;/TD&gt;&lt;TD width="12.5%" height="46px"&gt;0.55&lt;BR /&gt;0.11&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Mon, 09 Dec 2024 11:59:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filter-data-from-MultiValue-field/m-p/706328#M239042</guid>
      <dc:creator>Thulasinathan_M</dc:creator>
      <dc:date>2024-12-09T11:59:19Z</dc:date>
    </item>
    <item>
      <title>Re: Filter data from MultiValue field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filter-data-from-MultiValue-field/m-p/706350#M239048</link>
      <description>&lt;P&gt;Ok that's way too much logic for me to follow on a Monday morning before I have even had coffee.&amp;nbsp; I would split the fields into mv unique options.&amp;nbsp; Then start evaluating a new field based upon your logic flow.&amp;nbsp; Anything with a TRUE outcome can be your final results.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2024 14:58:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filter-data-from-MultiValue-field/m-p/706350#M239048</guid>
      <dc:creator>dural_yyz</dc:creator>
      <dc:date>2024-12-09T14:58:58Z</dc:date>
    </item>
    <item>
      <title>Re: Filter data from MultiValue field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filter-data-from-MultiValue-field/m-p/706433#M239057</link>
      <description>&lt;P&gt;I don't quite follow your logic, but your solution will probably require mv eval functions and/or foreach.&lt;/P&gt;&lt;P&gt;e.g. you can find the Category index into your LookupCategory something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval c=0
| foreach mode=multivalue LookupCategory [ eval mv_match=case(Category=&amp;lt;&amp;lt;ITEM&amp;gt;&amp;gt;, c, Category&amp;gt;&amp;lt;&amp;lt;ITEM&amp;gt;&amp;gt;, -c, true(), mv_match), c=c+1 ]&lt;/LI-CODE&gt;&lt;P&gt;i.e a positive result of mv_match means the MV index of an exact match (offsets from 0). A negative mv_match result indicates the last LookupCategory that Category was &amp;gt; than and an empty result means Category was never greater than any LookupCategory.&lt;/P&gt;&lt;P&gt;Then with that knowledge you can mvindex() the other MV values based on your needs, e.g. abs(mv_match)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Dec 2024 00:06:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filter-data-from-MultiValue-field/m-p/706433#M239057</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2024-12-10T00:06:14Z</dc:date>
    </item>
    <item>
      <title>Re: Filter data from MultiValue field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filter-data-from-MultiValue-field/m-p/706452#M239061</link>
      <description>&lt;P&gt;OK. Back up a little.&lt;/P&gt;&lt;P&gt;Where does this data come from? You seem to have multiple multivalued fields. That might be a problem because with Splunk there is no implied relationship between those fields whatsoever so values in one multivalued field do not have to be connected with values in another multivalued field. And their order doesn't need to match the order in another multivalued field.&lt;/P&gt;&lt;P&gt;Take this for example:&lt;/P&gt;&lt;PRE&gt;| makeresults format=csv data="a,b,c&lt;BR /&gt;a,,c&lt;BR /&gt;,b,c&lt;BR /&gt;a,b"&lt;/PRE&gt;&lt;P&gt;It will give you this:&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;&lt;STRONG&gt;a&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;&lt;STRONG&gt;b&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;&lt;STRONG&gt;c&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;a&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;c&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;b&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;c&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;a&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;b&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;But if you try to "squeeze" it into multivalued fields by doing&lt;/P&gt;&lt;PRE&gt;| stats list(*) as *&lt;/PRE&gt;&lt;P&gt;You'll get&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="24px"&gt;&lt;STRONG&gt;a&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="24px"&gt;&lt;STRONG&gt;b&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="24px"&gt;&lt;STRONG&gt;c&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="61px"&gt;a&lt;BR /&gt;a&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="61px"&gt;b&lt;BR /&gt;b&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="61px"&gt;c&lt;BR /&gt;c&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;These don't match the "layout" of the input data for the stats command.&lt;/P&gt;&lt;P&gt;So be extremely cautious when handling multivalued fields because you might get completely different values from what you expect.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Dec 2024 08:47:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filter-data-from-MultiValue-field/m-p/706452#M239061</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2024-12-10T08:47:56Z</dc:date>
    </item>
    <item>
      <title>Re: Filter data from MultiValue field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filter-data-from-MultiValue-field/m-p/706479#M239069</link>
      <description>&lt;P&gt;I hope I can find this trick in the future if I ever need this.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Dec 2024 14:22:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filter-data-from-MultiValue-field/m-p/706479#M239069</guid>
      <dc:creator>dural_yyz</dc:creator>
      <dc:date>2024-12-10T14:22:49Z</dc:date>
    </item>
    <item>
      <title>Re: Filter data from MultiValue field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filter-data-from-MultiValue-field/m-p/706511#M239078</link>
      <description>&lt;P&gt;Note&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp;response though about relationship between MV values in different fields. You can easily find yourself in a world of MV pain if you're not careful. You need to KNOW your data well to start correlating MV fields using an index/offset.&lt;/P&gt;&lt;P&gt;If there is a null() or empty value in any of the MV fields then the index offset will be out of alignment.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2024 02:35:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filter-data-from-MultiValue-field/m-p/706511#M239078</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2024-12-11T02:35:51Z</dc:date>
    </item>
  </channel>
</rss>

