<?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: Consolidate events in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Consolidate-events/m-p/674104#M112838</link>
    <description>&lt;P&gt;It seems you're trying to do xyseries - transform a series of values into a x-y chart.&lt;/P&gt;&lt;P&gt;The problem with this is that you can only have one field on each axis and you want two fields on one of them.&lt;/P&gt;&lt;P&gt;But fear not, you can always do a trick of "combine and then split".&lt;/P&gt;&lt;PRE&gt;&amp;lt;your_search&amp;gt;&lt;BR /&gt;| eval orgbranch=Org.":".Branch&lt;BR /&gt;| xyseries orgbranch Role Name&lt;BR /&gt;| eval Org=mvindex(split(orgbranch,":"),0)&lt;BR /&gt;| eval Branch=mvindex(split(orgbranch,":"),1)&lt;BR /&gt;| fields - orgbranch&lt;/PRE&gt;</description>
    <pubDate>Fri, 12 Jan 2024 18:20:26 GMT</pubDate>
    <dc:creator>PickleRick</dc:creator>
    <dc:date>2024-01-12T18:20:26Z</dc:date>
    <item>
      <title>Consolidate events</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Consolidate-events/m-p/674082#M112832</link>
      <description>&lt;P&gt;I have a lookup table I am using to pull in contact information based on correlation of a couple of fields. The way the lookup table is formatted, it makes my results look different than what I want to see. If I can consolidate the lookup table, it will fix my issue, but I can't figure out how to do it. The table currently looks like this:&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="12.74131274131274%" height="25px"&gt;Org&lt;/TD&gt;
&lt;TD width="27.027027027027035%" height="25px"&gt;Branch&lt;/TD&gt;
&lt;TD width="43.564993564993564%" height="25px"&gt;Role&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="25px"&gt;Name&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="12.74131274131274%" height="25px"&gt;Org A&lt;/TD&gt;
&lt;TD width="27.027027027027035%" height="25px"&gt;Branch 1&lt;/TD&gt;
&lt;TD width="43.564993564993564%" height="25px"&gt;President&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="25px"&gt;Jack&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="12.74131274131274%" height="25px"&gt;Org A&lt;/TD&gt;
&lt;TD width="27.027027027027035%" height="25px"&gt;Branch 1&lt;/TD&gt;
&lt;TD width="43.564993564993564%" height="25px"&gt;VP&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="25px"&gt;Jill&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="12.74131274131274%" height="25px"&gt;Org A&lt;/TD&gt;
&lt;TD width="27.027027027027035%" height="25px"&gt;Branch 1&lt;/TD&gt;
&lt;TD width="43.564993564993564%" height="25px"&gt;Manager&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="25px"&gt;Mary&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="12.74131274131274%" height="25px"&gt;Org A&lt;/TD&gt;
&lt;TD width="27.027027027027035%" height="25px"&gt;Branch 2&lt;/TD&gt;
&lt;TD width="43.564993564993564%" height="25px"&gt;President&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="25px"&gt;Hansel&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="12.74131274131274%" height="25px"&gt;Org A&lt;/TD&gt;
&lt;TD width="27.027027027027035%" height="25px"&gt;Branch 2&lt;/TD&gt;
&lt;TD width="43.564993564993564%" height="25px"&gt;VP&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="25px"&gt;Gretel&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="12.74131274131274%" height="25px"&gt;Org A&lt;/TD&gt;
&lt;TD width="27.027027027027035%" height="25px"&gt;Branch 3&lt;/TD&gt;
&lt;TD width="43.564993564993564%" height="25px"&gt;VP&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="25px"&gt;Mickey&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="12.74131274131274%" height="25px"&gt;Org A&lt;/TD&gt;
&lt;TD width="27.027027027027035%" height="25px"&gt;Branch 3&lt;/TD&gt;
&lt;TD width="43.564993564993564%" height="25px"&gt;Manager&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="25px"&gt;
&lt;P&gt;Minnie&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I use the Org and Branch as matching criteria and want to pull out the names for each role.&amp;nbsp; I do not want to see multivalue fields when I am done, the current search looks like:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;[base search]
| lookup orgchart Org Branch OUTPUTNEW Role
| mvexpand Role
| lookup orgchart Org Branch Role OUTPUTNEW Name&lt;/LI-CODE&gt;
&lt;P&gt;This works, but the mvexpand (obviously) creates a new line for each role and I do not want multiple lines for each in my final results.&amp;nbsp; I want a single line for every Org/Branch pair showing all the Roles and names.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I am thinking the way of solving this is reformatting the lookup table to look like the table below, then modifying my lookup.&amp;nbsp; Is there a way to "transpose" just the 2 fields?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;[base search]
| lookup orgchart Org Branch OUTPUTNEW President, VP, Manager&lt;/LI-CODE&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="20%"&gt;Org&lt;/TD&gt;
&lt;TD width="20%"&gt;Branch&lt;/TD&gt;
&lt;TD width="20%"&gt;President&lt;/TD&gt;
&lt;TD width="20%"&gt;VP&lt;/TD&gt;
&lt;TD width="20%"&gt;Manager&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="20%"&gt;Org A&lt;/TD&gt;
&lt;TD width="20%"&gt;Branch 1&lt;/TD&gt;
&lt;TD width="20%"&gt;Jack&lt;/TD&gt;
&lt;TD width="20%"&gt;Jill&lt;/TD&gt;
&lt;TD width="20%"&gt;Mary&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="20%"&gt;Org A&lt;/TD&gt;
&lt;TD width="20%"&gt;Branch 2&lt;/TD&gt;
&lt;TD width="20%"&gt;Hansel&lt;/TD&gt;
&lt;TD width="20%"&gt;Gretel&lt;/TD&gt;
&lt;TD width="20%"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="20%"&gt;Org A&lt;/TD&gt;
&lt;TD width="20%"&gt;Branch 3&lt;/TD&gt;
&lt;TD width="20%"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="20%"&gt;MIckey&lt;/TD&gt;
&lt;TD width="20%"&gt;Minnie&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Sat, 13 Jan 2024 09:10:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Consolidate-events/m-p/674082#M112832</guid>
      <dc:creator>raysonjoberts</dc:creator>
      <dc:date>2024-01-13T09:10:10Z</dc:date>
    </item>
    <item>
      <title>Re: Consolidate events</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Consolidate-events/m-p/674084#M112833</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/236374"&gt;@raysonjoberts&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;using a lookup as the one you described, please try something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| inputlookup &amp;lt;your_lookup&amp;gt;
| stats 
   values(eval(if(Role="President",Name,""))) AS President 
   values(eval(if(Role="VP",Name,""))) AS VP 
   values(eval(if(Role="Manager",Name,""))) AS Manager 
   BY Org Branch&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2024 17:13:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Consolidate-events/m-p/674084#M112833</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-01-12T17:13:57Z</dc:date>
    </item>
    <item>
      <title>Re: Consolidate events</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Consolidate-events/m-p/674090#M112834</link>
      <description>&lt;P&gt;Splitting your lookup to include new fields "President", "VP", "Manager" would work but doesn't really scale if the role field has high cardinality.&lt;BR /&gt;&lt;BR /&gt;Here is another approach that is more scalable and can be generalized.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;You could make a net-new field in your lookup named role_json that would contain the mapping info of role&amp;lt;--&amp;gt;name.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit: Just realized your request was to not have results in the mvexpanded format I first showed. So here is an updated method.&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;LI-CODE lang="markup"&gt;&amp;lt;base_search&amp;gt;
    | lookup orgchart Org, Branch OUTPUT role_json
    | foreach mode=multivalue role_json
        [
            | eval
                tmp_json=if(
                    isnull(tmp_json),
                        json_object(spath('&amp;lt;&amp;lt;ITEM&amp;gt;&amp;gt;', "Role"), spath('&amp;lt;&amp;lt;ITEM&amp;gt;&amp;gt;', "Name")),
                        json_set(tmp_json, spath('&amp;lt;&amp;lt;ITEM&amp;gt;&amp;gt;', "Role"), spath('&amp;lt;&amp;lt;ITEM&amp;gt;&amp;gt;', "Name"))
                    )
            ]
    ``` capture any role_json values that are single values ```
    | eval
        tmp_json=if(
            mvcount(role_json)==1,
                json_object(spath(role_json, "Role"), spath(role_json, "Name")),
                'tmp_json'
            )
    ``` remove role_json (no longer needed) ```
    | fields - role_json
    ``` parse out tmp_json to table all the proper mappings ```
    | spath input=tmp_json
    ``` remove tmp_json (no longer needed) ```
    | fields - tmp_json&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;Directly after the lookup results would look something like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dtburrows3_1-1705096287240.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/28898i281310FD00724AFA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dtburrows3_1-1705096287240.png" alt="dtburrows3_1-1705096287240.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then after the foreach loops.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dtburrows3_0-1705095763952.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/28897iC80C7E8E49A64A16/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dtburrows3_0-1705095763952.png" alt="dtburrows3_0-1705095763952.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;I added a few extra entries to lookup to demonstrate that this method is dynamic and doesn't need any hardcoded fieldnames to account for potential new values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To get a new json object field into your existing lookup would look something like this (Provided its a CSV, if it is a kvstore then you would probably need to update the definition to include the new field)&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;&lt;LI-CODE lang="markup"&gt;| inputlookup orgchart
    | tojson str(Role) str(Name) output_field=role_json
    | outputlookup orgchart&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;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2024 21:51:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Consolidate-events/m-p/674090#M112834</guid>
      <dc:creator>dtburrows3</dc:creator>
      <dc:date>2024-01-12T21:51:36Z</dc:date>
    </item>
    <item>
      <title>Re: Consolidate events</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Consolidate-events/m-p/674104#M112838</link>
      <description>&lt;P&gt;It seems you're trying to do xyseries - transform a series of values into a x-y chart.&lt;/P&gt;&lt;P&gt;The problem with this is that you can only have one field on each axis and you want two fields on one of them.&lt;/P&gt;&lt;P&gt;But fear not, you can always do a trick of "combine and then split".&lt;/P&gt;&lt;PRE&gt;&amp;lt;your_search&amp;gt;&lt;BR /&gt;| eval orgbranch=Org.":".Branch&lt;BR /&gt;| xyseries orgbranch Role Name&lt;BR /&gt;| eval Org=mvindex(split(orgbranch,":"),0)&lt;BR /&gt;| eval Branch=mvindex(split(orgbranch,":"),1)&lt;BR /&gt;| fields - orgbranch&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 Jan 2024 18:20:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Consolidate-events/m-p/674104#M112838</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2024-01-12T18:20:26Z</dc:date>
    </item>
  </channel>
</rss>

