<?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: Does stats values command combine unique values? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Does-stats-values-command-combine-unique-values/m-p/666742#M228716</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/254242"&gt;@LearningGuy&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;to have all the values in the same row, you have to add the nomv command (&lt;A href="https://docs.splunk.com/Documentation/Splunk/9.1.1/SearchReference/Nomv" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/9.1.1/SearchReference/Nomv&lt;/A&gt;) after the stats command:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=regular_index 
| stats values(company) AS company BY ip
| nomv company
| table company ip&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
    <pubDate>Mon, 30 Oct 2023 13:40:40 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2023-10-30T13:40:40Z</dc:date>
    <item>
      <title>Does stats values command combine unique values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Does-stats-values-command-combine-unique-values/m-p/666638#M228679</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;STRONG&gt;Does stats values command combine unique values?&lt;/STRONG&gt;&lt;BR /&gt;For example:&lt;/P&gt;&lt;TABLE width="224"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="112"&gt;&lt;STRONG&gt;company&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="112"&gt;&lt;STRONG&gt;ip&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="112"&gt;companyA&lt;BR /&gt;companyA&lt;/TD&gt;&lt;TD&gt;1.1.1.1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="112"&gt;companyB&lt;BR /&gt;companyB&lt;BR /&gt;companyB&lt;/TD&gt;&lt;TD&gt;1.1.1.2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;index=regular_index 
| stats values(company) by ip
| table company, ip&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;Should the command above produce the following output?&lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="112"&gt;&lt;STRONG&gt;company&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="112"&gt;&lt;STRONG&gt;ip&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="112"&gt;companyA&lt;/TD&gt;&lt;TD&gt;1.1.1.1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="112"&gt;companyB&lt;/TD&gt;&lt;TD&gt;1.1.1.2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;Thank you so much&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Oct 2023 02:25:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Does-stats-values-command-combine-unique-values/m-p/666638#M228679</guid>
      <dc:creator>LearningGuy</dc:creator>
      <dc:date>2023-10-30T02:25:28Z</dc:date>
    </item>
    <item>
      <title>Re: Does stats values command combine unique values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Does-stats-values-command-combine-unique-values/m-p/666645#M228684</link>
      <description>&lt;P&gt;The answer is revealed in documentation of&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Multivaluefunctions#values.28.26lt.3Bvalues.26gt.3B.29" target="_blank" rel="noopener"&gt;values&lt;/A&gt;. &amp;nbsp;Use the "AS" modifier. &amp;nbsp;If you know that each IP only corresponds to one company, the following will do the trick:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=regular_index 
| stats values(company) as company by ip
| table company, ip&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 30 Oct 2023 03:34:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Does-stats-values-command-combine-unique-values/m-p/666645#M228684</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-10-30T03:34:23Z</dc:date>
    </item>
    <item>
      <title>Re: Does stats values command combine unique values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Does-stats-values-command-combine-unique-values/m-p/666664#M228692</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/254242"&gt;@LearningGuy&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;yes your search give you a list of distinct values by ip:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=regular_index 
| stats values(company) AS company BY ip
| table company ip&lt;/LI-CODE&gt;&lt;P&gt;but if you don't use "AS company" you don't have this field in the following table command.&lt;/P&gt;&lt;P&gt;Is this your question or do you have other doubt?&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 30 Oct 2023 07:11:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Does-stats-values-command-combine-unique-values/m-p/666664#M228692</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-10-30T07:11:43Z</dc:date>
    </item>
    <item>
      <title>Re: Does stats values command combine unique values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Does-stats-values-command-combine-unique-values/m-p/666741#M228715</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Yes, this answered my question, but I have other doubt.&lt;BR /&gt;Values command does not work if the data got merged into one row after "summary index".&amp;nbsp;&lt;BR /&gt;Please see below example and picture. Please suggest. Thanks&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;TABLE width="325"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="261"&gt;&lt;STRONG&gt;company&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="64"&gt;&lt;STRONG&gt;ip&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="261"&gt;companyA companyA&lt;/TD&gt;&lt;TD&gt;1.1.1.1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="261"&gt;companyB companyB companyB&lt;/TD&gt;&lt;TD&gt;1.1.1.2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="summary_index2.jpg" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/27884i5E7B75AB04A23E71/image-size/large?v=v2&amp;amp;px=999" role="button" title="summary_index2.jpg" alt="summary_index2.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Oct 2023 13:32:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Does-stats-values-command-combine-unique-values/m-p/666741#M228715</guid>
      <dc:creator>LearningGuy</dc:creator>
      <dc:date>2023-10-30T13:32:08Z</dc:date>
    </item>
    <item>
      <title>Re: Does stats values command combine unique values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Does-stats-values-command-combine-unique-values/m-p/666742#M228716</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/254242"&gt;@LearningGuy&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;to have all the values in the same row, you have to add the nomv command (&lt;A href="https://docs.splunk.com/Documentation/Splunk/9.1.1/SearchReference/Nomv" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/9.1.1/SearchReference/Nomv&lt;/A&gt;) after the stats command:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=regular_index 
| stats values(company) AS company BY ip
| nomv company
| table company ip&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 30 Oct 2023 13:40:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Does-stats-values-command-combine-unique-values/m-p/666742#M228716</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-10-30T13:40:40Z</dc:date>
    </item>
    <item>
      <title>Re: Does stats values command combine unique values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Does-stats-values-command-combine-unique-values/m-p/666746#M228719</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;Sorry if I wasn't clear.&amp;nbsp; &amp;nbsp;&lt;BR /&gt;If you refer to the drawing I posted previously.&lt;BR /&gt;The issue is actually the opposite.&amp;nbsp; &amp;nbsp;&lt;U&gt;&lt;STRONG&gt;After I moved the **commands/searches** into summary index&lt;/STRONG&gt;&lt;/U&gt;, the data was merged into one row, so the&lt;STRONG&gt; values command&lt;/STRONG&gt; did not give me unique values&amp;nbsp;&lt;BR /&gt;I expected to get "companyA", but it gave me "companyA companyA" because of the Carriage Return ("\n")&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Values command &lt;U&gt;did not&lt;/U&gt; work&lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE width="325"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="261"&gt;&lt;STRONG&gt;company&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="64"&gt;&lt;STRONG&gt;ip&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="261"&gt;companyA companyA&lt;/TD&gt;&lt;TD&gt;1.1.1.1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="261"&gt;companyB companyB companyB&lt;/TD&gt;&lt;TD&gt;1.1.1.2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;values command worked&lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE width="224"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="112"&gt;&lt;STRONG&gt;company&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="112"&gt;&lt;STRONG&gt;ip&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="112"&gt;companyA&lt;BR /&gt;companyA&lt;/TD&gt;&lt;TD&gt;1.1.1.1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="112"&gt;companyB&lt;BR /&gt;companyB&lt;BR /&gt;companyB&lt;/TD&gt;&lt;TD&gt;1.1.1.2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;I also have a different post specifically discussed about why summary index caused this merge behavious&lt;BR /&gt;&lt;A href="https://community.splunk.com/t5/Reporting/summary-index-merges-multiple-line-values-into-one-row/m-p/666673#M12266" target="_blank"&gt;https://community.splunk.com/t5/Reporting/summary-index-merges-multiple-line-values-into-one-row/m-p/666673#M12266&lt;/A&gt;&lt;BR /&gt;1) Why values command does not work if the data gets merged into one line?&lt;BR /&gt;2) Why does summary index cause merging into one row in the first place?&lt;BR /&gt;&lt;BR /&gt;Thank you so much for your help&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Oct 2023 13:58:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Does-stats-values-command-combine-unique-values/m-p/666746#M228719</guid>
      <dc:creator>LearningGuy</dc:creator>
      <dc:date>2023-10-30T13:58:59Z</dc:date>
    </item>
    <item>
      <title>Re: Does stats values command combine unique values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Does-stats-values-command-combine-unique-values/m-p/666750#M228721</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/254242"&gt;@LearningGuy&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;you should try to use mvexpand and nomv commands.&lt;BR /&gt;I cannot test because iy runs using values from a text page.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 30 Oct 2023 14:18:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Does-stats-values-command-combine-unique-values/m-p/666750#M228721</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-10-30T14:18:37Z</dc:date>
    </item>
    <item>
      <title>Re: Does stats values command combine unique values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Does-stats-values-command-combine-unique-values/m-p/666755#M228726</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;What do you mean by "&lt;SPAN&gt;iy runs using values from a text page"?&lt;BR /&gt;&lt;BR /&gt;So, values won't work if "\" gets merged into one line and I should use mvexpand to fix this?&lt;BR /&gt;&lt;BR /&gt;Any idea on the root cause why it happened after summary index?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Oct 2023 14:42:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Does-stats-values-command-combine-unique-values/m-p/666755#M228726</guid>
      <dc:creator>LearningGuy</dc:creator>
      <dc:date>2023-10-30T14:42:31Z</dc:date>
    </item>
    <item>
      <title>Re: Does stats values command combine unique values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Does-stats-values-command-combine-unique-values/m-p/666757#M228727</link>
      <description>&lt;P&gt;You're again digging into the issue we're tackling in this thread:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.splunk.com/t5/Reporting/summary-index-merges-multiple-line-values-into-one-row/m-p/666626#M12263" target="_blank"&gt;https://community.splunk.com/t5/Reporting/summary-index-merges-multiple-line-values-into-one-row/m-p/666626#M12263&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Due to how multivalued fields are "flattened" when collected to a stash sourcetype, your summarized events really do have the values of "companyA companyA" and "companyB companyB companyB".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Oct 2023 14:51:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Does-stats-values-command-combine-unique-values/m-p/666757#M228727</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-10-30T14:51:12Z</dc:date>
    </item>
    <item>
      <title>Re: Does stats values command combine unique values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Does-stats-values-command-combine-unique-values/m-p/666759#M228728</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/254242"&gt;@LearningGuy&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;sorry "it runs"&lt;/P&gt;&lt;P&gt;I meant that I cannot test your search because if I take the values from your page it runs&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="gcusello_0-1698677509778.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/27885i70DEBAF596CA5298/image-size/medium?v=v2&amp;amp;px=400" role="button" title="gcusello_0-1698677509778.png" alt="gcusello_0-1698677509778.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;You have to try to use nomv and mvexpand.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 30 Oct 2023 14:52:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Does-stats-values-command-combine-unique-values/m-p/666759#M228728</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-10-30T14:52:30Z</dc:date>
    </item>
  </channel>
</rss>

