<?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: Query giving multiple results in the same field, how to parse? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Query-giving-multiple-results-in-the-same-field-how-to-parse/m-p/751665#M242540</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/312381"&gt;@MacAllen&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How about this?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=_raw max_match=10 "Account Name: (?&amp;lt;account_name&amp;gt;[^\n]+)"
| eval subject_name = mvindex(account_name,0)
| eval member_name   = mvindex(account_name,1)
| eval group_name    = mvindex(account_name,2)
| table subject_name member_name group_name&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="livehybrid_0-1755208760825.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/39967i504A2122693E2355/image-size/medium?v=v2&amp;amp;px=400" role="button" title="livehybrid_0-1755208760825.png" alt="livehybrid_0-1755208760825.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;livehybrid_0-1755208760825.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If your&amp;nbsp;&lt;SPAN&gt;Account_names is already a multivalue field then you wont need to do the rex command, just pluck the relevant items from the mv field using mvindex. Full example below:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| windbag | head 1 | eval _raw="08/14/2025 01:21:15 PM
LogName=Security
SourceName=Microsoft Windows security auditing.
EventCode=4756
EventType=0
Type=Information
ComputerName=DC.ACME.COM
TaskCategory=Security Group Management
OpCode=Info
RecordNumber=1098888999
Keywords=Audit Success
Message=A member was added to a security-enabled universal group.
Subject:
Security ID: mysid
Account Name: my_username
Account Domain: my domain
Logon ID: 0xmyid
 
Member:
Security ID: hersid
Account Name: CN=her_username
 
Group:
Security ID: groupside
Account Name: Enterprise Admins
Account Domain: my_domain
Additional Information:
Privileges: -"
| rex field=_raw max_match=10 "Account Name: (?&amp;lt;account_name&amp;gt;[^\n]+)"
| eval subject_name = mvindex(account_name,0)
| eval member_name   = mvindex(account_name,1)
| eval group_name    = mvindex(account_name,2)
| table subject_name member_name group_name&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":glowing_star:"&gt;🌟&lt;/span&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Did this answer help you?&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;If so, please consider:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Adding karma to show it was useful&lt;/LI&gt;&lt;LI&gt;Marking it as the solution if it resolved your issue&lt;/LI&gt;&lt;LI&gt;Commenting if you need any clarification&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Your feedback encourages the volunteers in this community to continue contributing&lt;/P&gt;</description>
    <pubDate>Thu, 14 Aug 2025 22:00:16 GMT</pubDate>
    <dc:creator>livehybrid</dc:creator>
    <dc:date>2025-08-14T22:00:16Z</dc:date>
    <item>
      <title>Query giving multiple results in the same field, how to parse?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Query-giving-multiple-results-in-the-same-field-how-to-parse/m-p/751660#M242539</link>
      <description>&lt;P&gt;Doing a query on AD events for adding users to groups.&amp;nbsp; There are 3 events, one for each type of group.&amp;nbsp; 2 of them are very straight forward, account_name is the account, group_name is the group, easy peasy.&amp;nbsp; However, event 4756 shoves everything into the account_name field, so I get something like this:&lt;/P&gt;&lt;P&gt;Account_Name&lt;/P&gt;&lt;DIV class=""&gt;my_username&lt;/DIV&gt;&lt;DIV class=""&gt;CN=user_I_Added&lt;/DIV&gt;&lt;DIV class=""&gt;Enterprise Admins&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;All of this is in 1 line.&amp;nbsp; Looking inside the event, I get this:&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV&gt;Subject:&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Security ID: mysid&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Account Name: my_username&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Account Domain: my domain&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Logon ID: 0xmyid&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Member:&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Security ID: hersid&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Account Name: CN=her_username&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Group:&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Security ID: groupside&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Account Name: Enterprise Admins&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Account Domain: my_domain&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;I'd like to select on group_name, but for some reason Enterprise Admins is shoved into one of 3 Account_names in the same event.&amp;nbsp; Suggestions on parsing this?&amp;nbsp; "Moving" the name to group_name?&lt;/DIV&gt;</description>
      <pubDate>Thu, 14 Aug 2025 20:04:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Query-giving-multiple-results-in-the-same-field-how-to-parse/m-p/751660#M242539</guid>
      <dc:creator>MacAllen</dc:creator>
      <dc:date>2025-08-14T20:04:09Z</dc:date>
    </item>
    <item>
      <title>Re: Query giving multiple results in the same field, how to parse?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Query-giving-multiple-results-in-the-same-field-how-to-parse/m-p/751665#M242540</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/312381"&gt;@MacAllen&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How about this?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=_raw max_match=10 "Account Name: (?&amp;lt;account_name&amp;gt;[^\n]+)"
| eval subject_name = mvindex(account_name,0)
| eval member_name   = mvindex(account_name,1)
| eval group_name    = mvindex(account_name,2)
| table subject_name member_name group_name&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="livehybrid_0-1755208760825.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/39967i504A2122693E2355/image-size/medium?v=v2&amp;amp;px=400" role="button" title="livehybrid_0-1755208760825.png" alt="livehybrid_0-1755208760825.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;livehybrid_0-1755208760825.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If your&amp;nbsp;&lt;SPAN&gt;Account_names is already a multivalue field then you wont need to do the rex command, just pluck the relevant items from the mv field using mvindex. Full example below:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| windbag | head 1 | eval _raw="08/14/2025 01:21:15 PM
LogName=Security
SourceName=Microsoft Windows security auditing.
EventCode=4756
EventType=0
Type=Information
ComputerName=DC.ACME.COM
TaskCategory=Security Group Management
OpCode=Info
RecordNumber=1098888999
Keywords=Audit Success
Message=A member was added to a security-enabled universal group.
Subject:
Security ID: mysid
Account Name: my_username
Account Domain: my domain
Logon ID: 0xmyid
 
Member:
Security ID: hersid
Account Name: CN=her_username
 
Group:
Security ID: groupside
Account Name: Enterprise Admins
Account Domain: my_domain
Additional Information:
Privileges: -"
| rex field=_raw max_match=10 "Account Name: (?&amp;lt;account_name&amp;gt;[^\n]+)"
| eval subject_name = mvindex(account_name,0)
| eval member_name   = mvindex(account_name,1)
| eval group_name    = mvindex(account_name,2)
| table subject_name member_name group_name&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":glowing_star:"&gt;🌟&lt;/span&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Did this answer help you?&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;If so, please consider:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Adding karma to show it was useful&lt;/LI&gt;&lt;LI&gt;Marking it as the solution if it resolved your issue&lt;/LI&gt;&lt;LI&gt;Commenting if you need any clarification&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Your feedback encourages the volunteers in this community to continue contributing&lt;/P&gt;</description>
      <pubDate>Thu, 14 Aug 2025 22:00:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Query-giving-multiple-results-in-the-same-field-how-to-parse/m-p/751665#M242540</guid>
      <dc:creator>livehybrid</dc:creator>
      <dc:date>2025-08-14T22:00:16Z</dc:date>
    </item>
    <item>
      <title>Re: Query giving multiple results in the same field, how to parse?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Query-giving-multiple-results-in-the-same-field-how-to-parse/m-p/751696#M242543</link>
      <description>&lt;P&gt;Given the fixed data syntax and segment order,&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/170906"&gt;@livehybrid&lt;/a&gt;'s approach should work. &amp;nbsp;I'd like to offer a different, more semantic approach that depend less than exact order and string.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex mode=sed "s/(.*\n)*Message=.*\n//"
| eval data = split(_raw, "

")
| mvexpand data
| rex field=data max_match=0 mode=sed "s/(.+): *(.+)\n/\"\1\":\"\2\",\n/g
  s/,\n([^\"]+): *(.+)/,\"\1\":\"\2\"}\n}/g
  s/(.+): */{\n\"\1\":{/"
| spath input=data
| stats values(*) as * by RecordNumber
| fields - data&lt;/LI-CODE&gt;&lt;P&gt;The idea is to convert structured Message into JSON so it handles all embedded data. (The above is one of several possible ways of doing this.)&lt;/P&gt;&lt;P&gt;Using the same emulation&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/170906"&gt;@livehybrid&lt;/a&gt;&amp;nbsp;provides, this is the output:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;RecordNumber&lt;/TD&gt;&lt;TD&gt;ComputerName&lt;/TD&gt;&lt;TD&gt;EventCode&lt;/TD&gt;&lt;TD&gt;Group.Account Domain&lt;/TD&gt;&lt;TD&gt;Group.Account Name&lt;/TD&gt;&lt;TD&gt;Group.Security ID&lt;/TD&gt;&lt;TD&gt;Member.Account Name&lt;/TD&gt;&lt;TD&gt;Member.Security ID&lt;/TD&gt;&lt;TD&gt;Subject.Account Domain&lt;/TD&gt;&lt;TD&gt;Subject.Account Name&lt;/TD&gt;&lt;TD&gt;Subject.Logon ID&lt;/TD&gt;&lt;TD&gt;Subject.Security ID&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1098888999&lt;/TD&gt;&lt;TD&gt;DC.ACME.COM&lt;/TD&gt;&lt;TD&gt;4756&lt;/TD&gt;&lt;TD&gt;my_domain&lt;/TD&gt;&lt;TD&gt;Enterprise Admins&lt;/TD&gt;&lt;TD&gt;groupside&lt;/TD&gt;&lt;TD&gt;CN=her_username&lt;/TD&gt;&lt;TD&gt;hersid&lt;/TD&gt;&lt;TD&gt;my domain&lt;/TD&gt;&lt;TD&gt;my_username&lt;/TD&gt;&lt;TD&gt;0xmyid&lt;/TD&gt;&lt;TD&gt;mysid&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;If space in field names such as "Group.Account Name" is a hindrance, they can be replaced with a printable character before or after.&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Aug 2025 07:00:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Query-giving-multiple-results-in-the-same-field-how-to-parse/m-p/751696#M242543</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2025-08-15T07:00:14Z</dc:date>
    </item>
  </channel>
</rss>

