<?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: Dynamic eval mvindex. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Dynamic-eval-mvindex/m-p/700327#M237664</link>
    <description>&lt;P&gt;I recognize PPS logs &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;But seriously - mvindex does not assign anything within a multivalued field. It picks one (or more) of the values from an mvfield.&lt;/P&gt;&lt;P&gt;As a general remark - multivalued fields are really tricky to work with and if you need to correlate between separate multivalued fields (and I suspect you're aiming at something like that)... this is not going to end well.&lt;/P&gt;&lt;P&gt;What is the busines&amp;nbsp; case and the actual data? Maybe it can be dealt with differently?&lt;/P&gt;&lt;P&gt;EDIT: But yes, mvindex can be indexed with dynamically asigned values. A run-anywhere example:&lt;/P&gt;&lt;PRE&gt;| makeresults &lt;BR /&gt;| eval mv=mvappend("a1","a2","a3")&lt;BR /&gt;| eval index=mvfind(mv,"a2")&lt;BR /&gt;| eval value=mvindex(mv,index)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 27 Sep 2024 10:25:49 GMT</pubDate>
    <dc:creator>PickleRick</dc:creator>
    <dc:date>2024-09-27T10:25:49Z</dc:date>
    <item>
      <title>Dynamic eval mvindex.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dynamic-eval-mvindex/m-p/700306#M237659</link>
      <description>&lt;P&gt;Good morning fellow splunkers.&lt;/P&gt;&lt;P&gt;I have a challenge and was wondering if anyone could help me. In some logs with multiple fields with the same label, we use eval mvindex to assign different label for those fields. For example, In a log, we have two fields labelled "Account Name", first one corresponding to computer account and second to user account. We use mvindex to assign labels appropriately. This works well for a known number of fields.&lt;/P&gt;&lt;P&gt;Now, we also have logs, with groups of fields: action, module and rule:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;action&lt;/SPAN&gt;:&amp;nbsp;&lt;SPAN class=""&gt;quarantine&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;module&lt;/SPAN&gt;:&amp;nbsp;&lt;SPAN class=""&gt;access&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;rule&lt;/SPAN&gt;:&amp;nbsp;&lt;SPAN class=""&gt;verified&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;action&lt;/SPAN&gt;:&amp;nbsp;&lt;SPAN class=""&gt;execute&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;module&lt;/SPAN&gt;:&amp;nbsp;&lt;SPAN class=""&gt;access&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;rule&lt;/SPAN&gt;:&amp;nbsp;&lt;SPAN class=""&gt;verified&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;action&lt;/SPAN&gt;:&amp;nbsp;&lt;SPAN class=""&gt;continue&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;module&lt;/SPAN&gt;:&amp;nbsp;&lt;SPAN class=""&gt;access&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;rule&lt;/SPAN&gt;:&amp;nbsp;&lt;SPAN class=""&gt;verified&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;action&lt;/SPAN&gt;:&amp;nbsp;&lt;SPAN class=""&gt;reject&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;isFinal&lt;/SPAN&gt;:&amp;nbsp;&lt;SPAN class=""&gt;true&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;module&lt;/SPAN&gt;:&amp;nbsp;&lt;SPAN class=""&gt;pdr&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;rule&lt;/SPAN&gt;:&amp;nbsp;&lt;SPAN class=""&gt;reject&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I would like to use mvindex to label those so I can use those fileds more easily. In the example above, we have four groups of those fileds, thefore I wold have: action1, action2 etc (same for module and rule).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;However, the number of groups changes. It could be one, two, three or more.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Is there any way to use mvindex dynamically somehow?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I imagine, we would have to first evaluate number of those fields (or group of fields) and then use mvindex to assign different labels?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Unless there is a different way to achieve our goal.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Many thnaks in advance for any advise.&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;/P&gt;&lt;P&gt;Mike.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Sep 2024 06:25:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dynamic-eval-mvindex/m-p/700306#M237659</guid>
      <dc:creator>BoscoBaracus</dc:creator>
      <dc:date>2024-09-27T06:25:26Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic eval mvindex.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dynamic-eval-mvindex/m-p/700308#M237660</link>
      <description>&lt;P&gt;It is not clear what your events look like although you have done a good job at describing the information in them. Please share some (anonymised) raw events (in a code block) so we can see what you are dealing with. Also, a representation of your desired output would be informative.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Sep 2024 07:31:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dynamic-eval-mvindex/m-p/700308#M237660</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-09-27T07:31:39Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic eval mvindex.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dynamic-eval-mvindex/m-p/700321#M237662</link>
      <description>&lt;P&gt;Good morning ITWhisperer,&lt;/P&gt;&lt;P&gt;Thank you very much for the prompt response.&lt;/P&gt;&lt;P&gt;The example I provided was for description purposes. The question is generally about using eval mvindex where number of fields (with the same name) changes depending on some circumstances.&lt;/P&gt;&lt;P&gt;For simplicity, lets presume we have some logs with "Action" field. The Action field may appear several times in a log, having different values. We do not know exactly how many Action fields we have in a particular event. As I said, it could be one, two three or even 10. That's the challenge. I need to be able to operate on those fileds, but each of them will represent differnt step:&lt;/P&gt;&lt;P&gt;Event 1:&lt;/P&gt;&lt;P&gt;Action: scan&lt;/P&gt;&lt;P&gt;Action: forward-sandbox&lt;/P&gt;&lt;P&gt;Action: Release&lt;/P&gt;&lt;P&gt;Action: Relay&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Event2:&lt;/P&gt;&lt;P&gt;Action: scan&lt;/P&gt;&lt;P&gt;Action: Release&lt;/P&gt;&lt;P&gt;Action: Relay&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Event3:&lt;/P&gt;&lt;P&gt;Action: scan&lt;/P&gt;&lt;P&gt;Action: Reject&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the example above, we have events containing Action fields. However, depending on the actions taken, number of those fields will vary. Therefore, it is difficult for me to use mvindex. I know how to use mvindex where number of fields with the same name or multivalued fields is known.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In our case, we do not know how many occurences of Action we have in a given event.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this makes sense?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Mike.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Sep 2024 08:51:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dynamic-eval-mvindex/m-p/700321#M237662</guid>
      <dc:creator>BoscoBaracus</dc:creator>
      <dc:date>2024-09-27T08:51:44Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic eval mvindex.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dynamic-eval-mvindex/m-p/700327#M237664</link>
      <description>&lt;P&gt;I recognize PPS logs &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;But seriously - mvindex does not assign anything within a multivalued field. It picks one (or more) of the values from an mvfield.&lt;/P&gt;&lt;P&gt;As a general remark - multivalued fields are really tricky to work with and if you need to correlate between separate multivalued fields (and I suspect you're aiming at something like that)... this is not going to end well.&lt;/P&gt;&lt;P&gt;What is the busines&amp;nbsp; case and the actual data? Maybe it can be dealt with differently?&lt;/P&gt;&lt;P&gt;EDIT: But yes, mvindex can be indexed with dynamically asigned values. A run-anywhere example:&lt;/P&gt;&lt;PRE&gt;| makeresults &lt;BR /&gt;| eval mv=mvappend("a1","a2","a3")&lt;BR /&gt;| eval index=mvfind(mv,"a2")&lt;BR /&gt;| eval value=mvindex(mv,index)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Sep 2024 10:25:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dynamic-eval-mvindex/m-p/700327#M237664</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2024-09-27T10:25:49Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic eval mvindex.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dynamic-eval-mvindex/m-p/700495#M237692</link>
      <description>&lt;P&gt;mvcount will give you the number of values in a multivalue field - does that help?&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2024 08:44:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dynamic-eval-mvindex/m-p/700495#M237692</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-09-30T08:44:15Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic eval mvindex.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dynamic-eval-mvindex/m-p/700498#M237693</link>
      <description>&lt;P&gt;Good morning ITWhisperer,&lt;/P&gt;&lt;P&gt;Many thanks for the suggestion. This might actually work. I could first evaluate number of fields and then use mvindex.&lt;/P&gt;&lt;P&gt;Will try that.&lt;/P&gt;&lt;P&gt;Again, many thank.&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;/P&gt;&lt;P&gt;Mike.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2024 08:52:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dynamic-eval-mvindex/m-p/700498#M237693</guid>
      <dc:creator>BoscoBaracus</dc:creator>
      <dc:date>2024-09-30T08:52:30Z</dc:date>
    </item>
  </channel>
</rss>

