<?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: How to de-aggregate the STATS result ? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-de-aggregate-the-STATS-result/m-p/577752#M201342</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;You are looking this&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.2.3/SearchReference/Mvexpand" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/8.2.3/SearchReference/Mvexpand&lt;/A&gt;&lt;/P&gt;&lt;P&gt;r. Ismo&lt;/P&gt;</description>
    <pubDate>Wed, 08 Dec 2021 09:13:24 GMT</pubDate>
    <dc:creator>isoutamo</dc:creator>
    <dc:date>2021-12-08T09:13:24Z</dc:date>
    <item>
      <title>How to de-aggregate the STATS result ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-de-aggregate-the-STATS-result/m-p/577738#M201336</link>
      <description>&lt;P&gt;I have this query where I need to use stats to aggregate the results based on account_number.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;Now, some of the results are multivalued. I need the output to be like a table, one values for each row.&amp;nbsp; like somehow expand the aggregated results into a tabular&amp;nbsp; format.&lt;BR /&gt;&lt;BR /&gt;=========================================&lt;BR /&gt;`index_list` account_type="Service Account"&lt;BR /&gt;| addinfo&lt;BR /&gt;| eventstats dc(sourcetype) as dc_sourcetype by service_number&lt;BR /&gt;| where dc_sourcetype&amp;gt;1&lt;BR /&gt;| stats values(is_interactive) as is_interactive,&lt;BR /&gt;values(account_name) as account_name,&lt;BR /&gt;values(full_name) as full_name,&lt;BR /&gt;values(email_address) as email_address,&lt;BR /&gt;values(manager_name) as manager_name,&lt;BR /&gt;values(service_account_name) as service_account_name,&lt;BR /&gt;values(account_type) as account_type,&lt;BR /&gt;values(service_account_id) as service_account_id,&lt;BR /&gt;values(au_owner_name) as au_owner_name,&lt;BR /&gt;values(au_owner_email) as au_owner_email&lt;BR /&gt;BY account_number&lt;BR /&gt;&lt;BR /&gt;=======================================&lt;BR /&gt;&lt;BR /&gt;account_type,&amp;nbsp;service_account_id, account_number are multivalue fields.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Dec 2021 07:29:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-de-aggregate-the-STATS-result/m-p/577738#M201336</guid>
      <dc:creator>zacksoft_wf</dc:creator>
      <dc:date>2021-12-08T07:29:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to de-aggregate the STATS result ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-de-aggregate-the-STATS-result/m-p/577752#M201342</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;You are looking this&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.2.3/SearchReference/Mvexpand" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/8.2.3/SearchReference/Mvexpand&lt;/A&gt;&lt;/P&gt;&lt;P&gt;r. Ismo&lt;/P&gt;</description>
      <pubDate>Wed, 08 Dec 2021 09:13:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-de-aggregate-the-STATS-result/m-p/577752#M201342</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2021-12-08T09:13:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to de-aggregate the STATS result ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-de-aggregate-the-STATS-result/m-p/577772#M201348</link>
      <description>&lt;P&gt;mvexpand will only do one field at a time, if you want to expand multiple multivalue field, I wrote a post about how this might be done back in April&amp;nbsp;&lt;A href="https://community.splunk.com/t5/Splunk-Search/mvexpand-limits/m-p/549178" target="_self"&gt;https://community.splunk.com/t5/Splunk-Search/mvexpand-limits/m-p/549178&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To be honest, you might be better off modifying the stats command to get what you want in the first place. For example, if&amp;nbsp;&lt;SPAN&gt;account_type,&amp;nbsp;service_account_id, account_number all have values you could do something like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;`index_list` account_type="Service Account"
| addinfo
| eventstats dc(sourcetype) as dc_sourcetype by service_number
| where dc_sourcetype&amp;gt;1
| stats values(is_interactive) as is_interactive,
values(account_name) as account_name,
values(full_name) as full_name,
values(email_address) as email_address,
values(manager_name) as manager_name,
values(service_account_name) as service_account_name,
values(au_owner_name) as au_owner_name,
values(au_owner_email) as au_owner_email
BY account_type, service_account_id, account_number&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Dec 2021 12:03:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-de-aggregate-the-STATS-result/m-p/577772#M201348</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-12-08T12:03:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to de-aggregate the STATS result ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-de-aggregate-the-STATS-result/m-p/577852#M201365</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;. This greatly helps.&amp;nbsp; There is just one little issue.&lt;BR /&gt;Field like "service_account_id"&amp;nbsp; also present in events as "src_account_id". They are essentially the same field with different name. And I am thinking&amp;nbsp; to use coalesce function like,&lt;BR /&gt;eval service_account_id = coalesce(service_account_id,src_account_id)&lt;BR /&gt;&lt;BR /&gt;The question that comes to my mind is , this field is also used in stats " BY" clause, now should the coalesce function be used before or after | stats ..BY ...&amp;nbsp; ?&lt;BR /&gt;Not just 'service_Account_id' , the other fields like account_type also has to be used in conjuntion with coalesce as, it has another field with slightly different name and i have to fetch the one that has value and is used in BY clause.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Dec 2021 06:14:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-de-aggregate-the-STATS-result/m-p/577852#M201365</guid>
      <dc:creator>zacksoft_wf</dc:creator>
      <dc:date>2021-12-09T06:14:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to de-aggregate the STATS result ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-de-aggregate-the-STATS-result/m-p/577868#M201370</link>
      <description>&lt;P&gt;I would do the coalescing before the stats command - if a field from the by clause is null, the event doesn't get included in the stats&lt;/P&gt;</description>
      <pubDate>Thu, 09 Dec 2021 09:34:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-de-aggregate-the-STATS-result/m-p/577868#M201370</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-12-09T09:34:41Z</dc:date>
    </item>
  </channel>
</rss>

