<?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 How to correlate to multi-value fields from one event? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-to-multi-value-fields-from-one-event/m-p/591824#M205996</link>
    <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have logs where there are multiple values for two fields. This data looks like this example below for each event.&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;dest&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;user&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;builtinadmin&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="77px"&gt;computer1&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="77px"&gt;user1&lt;BR /&gt;user2&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="77px"&gt;
&lt;P&gt;true&lt;/P&gt;
&lt;P&gt;false&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It comes from this raw data:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;&amp;lt;computer N=computer1 D=corp OS=Windows DC=false&amp;gt;
&amp;lt;users&amp;gt;
&amp;lt;user N='user1" builtinadmin="false" /&amp;gt;
&amp;lt;user N="user2" builtinadmin="true" /&amp;gt;
&amp;lt;/users&amp;gt;
&amp;lt;/computer&amp;gt;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a way to show the data like this instead where each user correctly correlates to the builinadmin value?&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;dest&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;user&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;builtinadmin&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;computer1&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;user1&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;true&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;computer1&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;user2&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;false&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
    <pubDate>Fri, 01 Apr 2022 15:38:36 GMT</pubDate>
    <dc:creator>gnostic_device</dc:creator>
    <dc:date>2022-04-01T15:38:36Z</dc:date>
    <item>
      <title>How to correlate to multi-value fields from one event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-to-multi-value-fields-from-one-event/m-p/591824#M205996</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have logs where there are multiple values for two fields. This data looks like this example below for each event.&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;dest&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;user&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;builtinadmin&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="77px"&gt;computer1&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="77px"&gt;user1&lt;BR /&gt;user2&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="77px"&gt;
&lt;P&gt;true&lt;/P&gt;
&lt;P&gt;false&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It comes from this raw data:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;&amp;lt;computer N=computer1 D=corp OS=Windows DC=false&amp;gt;
&amp;lt;users&amp;gt;
&amp;lt;user N='user1" builtinadmin="false" /&amp;gt;
&amp;lt;user N="user2" builtinadmin="true" /&amp;gt;
&amp;lt;/users&amp;gt;
&amp;lt;/computer&amp;gt;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a way to show the data like this instead where each user correctly correlates to the builinadmin value?&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;dest&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;user&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;builtinadmin&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;computer1&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;user1&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;true&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;computer1&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;user2&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;false&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Fri, 01 Apr 2022 15:38:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-to-multi-value-fields-from-one-event/m-p/591824#M205996</guid>
      <dc:creator>gnostic_device</dc:creator>
      <dc:date>2022-04-01T15:38:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to correlate to multi-value fields from one event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-to-multi-value-fields-from-one-event/m-p/591828#M205997</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/244478"&gt;@gnostic_device&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please try this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;YOUR_SEARCH
| eval t=mvzip(user,builtinadmin,"|")
| mvexpand t
| eval user=mvindex(split(t,"|"),0),builtinadmin=mvindex(split(t,"|"),1)  | table dest	user	builtinadmin&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;My Sample Search :&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults | eval _raw="&amp;lt;computer N=computer1 D=corp OS=Windows DC=false&amp;gt;&amp;lt;users&amp;gt;&amp;lt;user N=\"user1\" builtinadmin=\"false\" /&amp;gt;&amp;lt;user N=\"user2\" builtinadmin=\"true\" /&amp;gt;&amp;lt;/users&amp;gt;&amp;lt;/computer&amp;gt;" | spath | rename "computer{@N}" as dest, "computer.users.user{@N}" as user, "computer.users.user{@builtinadmin}" as builtinadmin | table dest	user	builtinadmin | rename comment as "Upto now is for sample data only"
| eval t=mvzip(user,builtinadmin,"|")
| mvexpand t
| eval user=mvindex(split(t,"|"),0),builtinadmin=mvindex(split(t,"|"),1)  | table dest	user	builtinadmin&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;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2022-03-31 at 11.19.09 PM.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/18881i88794C3070919564/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2022-03-31 at 11.19.09 PM.png" alt="Screenshot 2022-03-31 at 11.19.09 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;BR /&gt;KV&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;If any of my reply helps you to solve the problem Or gain knowledge, an upvote would be appreciated.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2022 17:49:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-to-multi-value-fields-from-one-event/m-p/591828#M205997</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2022-03-31T17:49:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to correlate to multi-value fields from one event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-to-multi-value-fields-from-one-event/m-p/591829#M205998</link>
      <description>&lt;P&gt;Hey&lt;/P&gt;&lt;P&gt;Not sure if there is any other easy way to do this but you can give this a try:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;user search&amp;gt;
|eval tagged=mvzip(user,builtinadmin) 
| mvexpand tagged 
| makemv tagged delim="," 
| eval user=mvindex(tagged,0) 
| eval builtinadmin=mvindex(tagged,1) 
| table dest user builtinadmin&lt;/LI-CODE&gt;&lt;P&gt;let me know if this helps!&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2022 17:49:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-to-multi-value-fields-from-one-event/m-p/591829#M205998</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2022-03-31T17:49:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to correlate to multi-value fields from one event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-to-multi-value-fields-from-one-event/m-p/591921#M206047</link>
      <description>&lt;P&gt;Since your data is in XML, here is an alternative to mvzip-split combination, using path option in builtin function&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Spath" target="_blank" rel="noopener"&gt;spath&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rename computer{@N} AS dest ``` you already did this in your original search ```
| spath path=computer.users output=users ``` retain complete path as a single XML field ```
| eval users = split(users, "
") ``` for some reason users is single string; turn into multivalue ```
| mvexpand users
| spath input=users ``` extract user attrib from XML after mvexpand ```
| rename user{@N} as user, user{@builtinadmin} as builtinadmin ``` do this AFTER mvexpand, not before ```
| table dest user builtinadmin&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample data gives&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;dest&lt;/TD&gt;&lt;TD&gt;user&lt;/TD&gt;&lt;TD&gt;builtinadmin&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;computer1&lt;/TD&gt;&lt;TD&gt;user1&lt;/TD&gt;&lt;TD&gt;false&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;computer1&lt;/TD&gt;&lt;TD&gt;user2&lt;/TD&gt;&lt;TD&gt;true&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Fri, 01 Apr 2022 09:49:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-correlate-to-multi-value-fields-from-one-event/m-p/591921#M206047</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-04-01T09:49:24Z</dc:date>
    </item>
  </channel>
</rss>

