<?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 makemv and mvindex not working as expected in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/makemv-and-mvindex-not-working-as-expected/m-p/549703#M155998</link>
    <description>&lt;P&gt;I am working with JSON data type events and am trying to extract the username (user1, user2) from the pathspec data structure in my events (sample below) :&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="t"&gt;pathspec&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="t"&gt;:&lt;/SPAN&gt;&lt;SPAN&gt; {"&lt;/SPAN&gt;&lt;SPAN class="t"&gt;__type__&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="t"&gt;:&lt;/SPAN&gt;&lt;SPAN&gt; "&lt;/SPAN&gt;&lt;SPAN class="t"&gt;PathSpec&lt;/SPAN&gt;&lt;SPAN&gt;", "&lt;/SPAN&gt;&lt;SPAN class="t h"&gt;location&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="t"&gt;:&lt;/SPAN&gt;&lt;SPAN&gt; "&lt;/SPAN&gt;&lt;SPAN class="t"&gt;/media/APA_windows/Users/user1/AppData/Local/Microsoft/Windows/UsrClass.dat&lt;/SPAN&gt;&lt;SPAN&gt;", "&lt;/SPAN&gt;&lt;SPAN class="t"&gt;type_indicator&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="t"&gt;:&lt;/SPAN&gt;&lt;SPAN&gt; "&lt;/SPAN&gt;&lt;SPAN class="t"&gt;OS&lt;/SPAN&gt;&lt;SPAN&gt;"}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="t"&gt;pathspec&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="t"&gt;:&lt;/SPAN&gt;&lt;SPAN&gt; {"&lt;/SPAN&gt;&lt;SPAN class="t"&gt;__type__&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="t"&gt;:&lt;/SPAN&gt;&lt;SPAN&gt; "&lt;/SPAN&gt;&lt;SPAN class="t"&gt;PathSpec&lt;/SPAN&gt;&lt;SPAN&gt;", "&lt;/SPAN&gt;&lt;SPAN class="t h"&gt;location&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="t"&gt;:&lt;/SPAN&gt;&lt;SPAN&gt; "&lt;/SPAN&gt;&lt;SPAN class="t"&gt;/media/APA_windows/Users/user2/AppData/Local/Microsoft/Windows/UsrClass.dat&lt;/SPAN&gt;&lt;SPAN&gt;", "&lt;/SPAN&gt;&lt;SPAN class="t"&gt;type_indicator&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="t"&gt;:&lt;/SPAN&gt;&lt;SPAN&gt; "&lt;/SPAN&gt;&lt;SPAN class="t"&gt;OS&lt;/SPAN&gt;&lt;SPAN&gt;"}&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG&gt;I am using the below SPL&lt;/STRONG&gt;&amp;nbsp;to split up pathspec.location into a multi value field and then use mvindex :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;.....  | makemv delim="/" pathspec.location
| eval user_name = mvindex(pathspec.location, 3) &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;However when I table out the user_name field it does not show any results. Not sure why this is not working. Any suggestions would be helpful&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Desired output from the user_name field would be&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;user1
user2
.
.
.
.
.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 28 Apr 2021 23:05:00 GMT</pubDate>
    <dc:creator>ankit</dc:creator>
    <dc:date>2021-04-28T23:05:00Z</dc:date>
    <item>
      <title>makemv and mvindex not working as expected</title>
      <link>https://community.splunk.com/t5/Splunk-Search/makemv-and-mvindex-not-working-as-expected/m-p/549703#M155998</link>
      <description>&lt;P&gt;I am working with JSON data type events and am trying to extract the username (user1, user2) from the pathspec data structure in my events (sample below) :&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="t"&gt;pathspec&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="t"&gt;:&lt;/SPAN&gt;&lt;SPAN&gt; {"&lt;/SPAN&gt;&lt;SPAN class="t"&gt;__type__&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="t"&gt;:&lt;/SPAN&gt;&lt;SPAN&gt; "&lt;/SPAN&gt;&lt;SPAN class="t"&gt;PathSpec&lt;/SPAN&gt;&lt;SPAN&gt;", "&lt;/SPAN&gt;&lt;SPAN class="t h"&gt;location&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="t"&gt;:&lt;/SPAN&gt;&lt;SPAN&gt; "&lt;/SPAN&gt;&lt;SPAN class="t"&gt;/media/APA_windows/Users/user1/AppData/Local/Microsoft/Windows/UsrClass.dat&lt;/SPAN&gt;&lt;SPAN&gt;", "&lt;/SPAN&gt;&lt;SPAN class="t"&gt;type_indicator&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="t"&gt;:&lt;/SPAN&gt;&lt;SPAN&gt; "&lt;/SPAN&gt;&lt;SPAN class="t"&gt;OS&lt;/SPAN&gt;&lt;SPAN&gt;"}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="t"&gt;pathspec&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="t"&gt;:&lt;/SPAN&gt;&lt;SPAN&gt; {"&lt;/SPAN&gt;&lt;SPAN class="t"&gt;__type__&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="t"&gt;:&lt;/SPAN&gt;&lt;SPAN&gt; "&lt;/SPAN&gt;&lt;SPAN class="t"&gt;PathSpec&lt;/SPAN&gt;&lt;SPAN&gt;", "&lt;/SPAN&gt;&lt;SPAN class="t h"&gt;location&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="t"&gt;:&lt;/SPAN&gt;&lt;SPAN&gt; "&lt;/SPAN&gt;&lt;SPAN class="t"&gt;/media/APA_windows/Users/user2/AppData/Local/Microsoft/Windows/UsrClass.dat&lt;/SPAN&gt;&lt;SPAN&gt;", "&lt;/SPAN&gt;&lt;SPAN class="t"&gt;type_indicator&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="t"&gt;:&lt;/SPAN&gt;&lt;SPAN&gt; "&lt;/SPAN&gt;&lt;SPAN class="t"&gt;OS&lt;/SPAN&gt;&lt;SPAN&gt;"}&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG&gt;I am using the below SPL&lt;/STRONG&gt;&amp;nbsp;to split up pathspec.location into a multi value field and then use mvindex :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;.....  | makemv delim="/" pathspec.location
| eval user_name = mvindex(pathspec.location, 3) &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;However when I table out the user_name field it does not show any results. Not sure why this is not working. Any suggestions would be helpful&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Desired output from the user_name field would be&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;user1
user2
.
.
.
.
.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Apr 2021 23:05:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/makemv-and-mvindex-not-working-as-expected/m-p/549703#M155998</guid>
      <dc:creator>ankit</dc:creator>
      <dc:date>2021-04-28T23:05:00Z</dc:date>
    </item>
    <item>
      <title>Re: makemv and mvindex not working as expected</title>
      <link>https://community.splunk.com/t5/Splunk-Search/makemv-and-mvindex-not-working-as-expected/m-p/549707#M155999</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/232611"&gt;@ankit&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Field names containing special characters should be surrounded with single quotes when used in eval expressions:&lt;/P&gt;&lt;P&gt;| eval user_name =&amp;nbsp;mvindex('pathspec.location', 3)&lt;/P&gt;</description>
      <pubDate>Wed, 28 Apr 2021 23:17:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/makemv-and-mvindex-not-working-as-expected/m-p/549707#M155999</guid>
      <dc:creator>tscroggins</dc:creator>
      <dc:date>2021-04-28T23:17:24Z</dc:date>
    </item>
    <item>
      <title>Re: makemv and mvindex not working as expected</title>
      <link>https://community.splunk.com/t5/Splunk-Search/makemv-and-mvindex-not-working-as-expected/m-p/549711#M156000</link>
      <description>&lt;P&gt;Awesome ! That worked&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/49493"&gt;@tscroggins&lt;/a&gt;&amp;nbsp;! Thanks a lot for helping out.&amp;nbsp;&lt;BR /&gt;Could you point me to a link, if possible, to what Splunk considers as special characters ?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Apr 2021 23:28:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/makemv-and-mvindex-not-working-as-expected/m-p/549711#M156000</guid>
      <dc:creator>ankit</dc:creator>
      <dc:date>2021-04-28T23:28:16Z</dc:date>
    </item>
    <item>
      <title>Re: makemv and mvindex not working as expected</title>
      <link>https://community.splunk.com/t5/Splunk-Search/makemv-and-mvindex-not-working-as-expected/m-p/549716#M156002</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/232611"&gt;@ankit&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The exact wording in documentation [1] (emphasis Splunk's):&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;If the expression references a &lt;STRONG&gt;field name&lt;/STRONG&gt; that contains non-alphanumeric characters, other than the underscore ( _ ) character, the field name needs to be surrounded by s&lt;STRONG&gt;ingle quotation marks&lt;/STRONG&gt;. For example, if the field name is &lt;STRONG&gt;server-1&lt;/STRONG&gt; you specify the field name like this &lt;STRONG&gt;new=count+'server-1'&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;I.e. Any character other then 0-9, A-Z, a-z, and _.&lt;/P&gt;&lt;P&gt;1.&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.1.3/SearchReference/Eval" target="_self"&gt;https://docs.splunk.com/Documentation/Splunk/8.1.3/SearchReference/Eval&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Apr 2021 23:41:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/makemv-and-mvindex-not-working-as-expected/m-p/549716#M156002</guid>
      <dc:creator>tscroggins</dc:creator>
      <dc:date>2021-04-28T23:41:50Z</dc:date>
    </item>
  </channel>
</rss>

