<?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 do I show more fields after the stats count by command? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-show-more-fields-after-the-stats-count-by-command/m-p/386040#M112687</link>
    <description>&lt;PRE&gt;&lt;CODE&gt;index=wineventlog EventCode=4740 host=* | stats count by Account_Name Field1 Field2 | sort - count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That should add Field1 and Field2 to your results&lt;/P&gt;</description>
    <pubDate>Thu, 23 May 2019 20:49:10 GMT</pubDate>
    <dc:creator>aguthrie1190</dc:creator>
    <dc:date>2019-05-23T20:49:10Z</dc:date>
    <item>
      <title>How do I show more fields after the stats count by command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-show-more-fields-after-the-stats-count-by-command/m-p/386039#M112686</link>
      <description>&lt;P&gt;I need to add more columns to a search after results are counted. Here's my query&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=wineventlog EventCode=4740 host=* | stats count by Account_Name | sort - count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Results give me Account_Name and Count ...I want to add more fields to results.I tried table but this doesn't work.&lt;/P&gt;</description>
      <pubDate>Thu, 23 May 2019 20:42:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-show-more-fields-after-the-stats-count-by-command/m-p/386039#M112686</guid>
      <dc:creator>jcolon68</dc:creator>
      <dc:date>2019-05-23T20:42:42Z</dc:date>
    </item>
    <item>
      <title>Re: How do I show more fields after the stats count by command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-show-more-fields-after-the-stats-count-by-command/m-p/386040#M112687</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;index=wineventlog EventCode=4740 host=* | stats count by Account_Name Field1 Field2 | sort - count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That should add Field1 and Field2 to your results&lt;/P&gt;</description>
      <pubDate>Thu, 23 May 2019 20:49:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-show-more-fields-after-the-stats-count-by-command/m-p/386040#M112687</guid>
      <dc:creator>aguthrie1190</dc:creator>
      <dc:date>2019-05-23T20:49:10Z</dc:date>
    </item>
    <item>
      <title>Re: How do I show more fields after the stats count by command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-show-more-fields-after-the-stats-count-by-command/m-p/386041#M112688</link>
      <description>&lt;P&gt;Thanks!  I tried that , but the count is not correct. It's only showing count as 1 for most of the results when there's multiple. &lt;/P&gt;</description>
      <pubDate>Thu, 23 May 2019 20:56:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-show-more-fields-after-the-stats-count-by-command/m-p/386041#M112688</guid>
      <dc:creator>jcolon68</dc:creator>
      <dc:date>2019-05-23T20:56:01Z</dc:date>
    </item>
    <item>
      <title>Re: How do I show more fields after the stats count by command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-show-more-fields-after-the-stats-count-by-command/m-p/386042#M112689</link>
      <description>&lt;P&gt;When you do &lt;CODE&gt;count by&lt;/CODE&gt;, stats will count the times when the combination of fields appears together, otherwise it will throw away the field if it is not specified in your &lt;CODE&gt;by&lt;/CODE&gt; argument. &lt;/P&gt;

&lt;P&gt;Say you have this data&lt;/P&gt;

&lt;P&gt;1 host=host1 field="test"&lt;BR /&gt;
2 host=host1 field="test2"&lt;/P&gt;

&lt;P&gt;And my search is: &lt;BR /&gt;
* | stats count by host field&lt;/P&gt;

&lt;P&gt;I'll have 2 results, each with the count of 1. One result for host1, test and one result for host1, test2. &lt;/P&gt;

&lt;P&gt;What does your data look like, if you have a lot of unique events, stats may not be the best way to characterize your data. &lt;/P&gt;</description>
      <pubDate>Thu, 23 May 2019 21:03:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-show-more-fields-after-the-stats-count-by-command/m-p/386042#M112689</guid>
      <dc:creator>aguthrie1190</dc:creator>
      <dc:date>2019-05-23T21:03:27Z</dc:date>
    </item>
    <item>
      <title>Re: How do I show more fields after the stats count by command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-show-more-fields-after-the-stats-count-by-command/m-p/386043#M112690</link>
      <description>&lt;P&gt;@jcolon68  try below &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=wineventlog EventCode=4740 host=* | stats values(*) as * , count by Account _Name|sort 0 count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 May 2019 21:24:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-show-more-fields-after-the-stats-count-by-command/m-p/386043#M112690</guid>
      <dc:creator>Vijeta</dc:creator>
      <dc:date>2019-05-23T21:24:39Z</dc:date>
    </item>
    <item>
      <title>Re: How do I show more fields after the stats count by command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-show-more-fields-after-the-stats-count-by-command/m-p/386044#M112691</link>
      <description>&lt;P&gt;When you pipe to stats you are doing a transforming search and in effect dropping the data that isn't part of the statistical results.&lt;BR /&gt;
In order to include additional fields you need to include them as part of the results. You could also try something like appendpipe to add more output to your base search.&lt;/P&gt;

&lt;P&gt;References: &lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Search/Aboutreportingcommands"&gt;https://docs.splunk.com/Documentation/Splunk/latest/Search/Aboutreportingcommands&lt;/A&gt;&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Append"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Append&lt;/A&gt;&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Appendpipe"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Appendpipe&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 May 2019 00:28:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-show-more-fields-after-the-stats-count-by-command/m-p/386044#M112691</guid>
      <dc:creator>mtranchita</dc:creator>
      <dc:date>2019-05-24T00:28:25Z</dc:date>
    </item>
    <item>
      <title>Re: How do I show more fields after the stats count by command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-show-more-fields-after-the-stats-count-by-command/m-p/386045#M112692</link>
      <description>&lt;P&gt;I just really want to group the Account_Name field into individual lines with a count.  But I want to see multiple fields, like Computer Name , which may be different for example:&lt;/P&gt;

&lt;P&gt;Account_Name   Computer name             IP&lt;BR /&gt;
account                   Computer 1           10.10.0.1&lt;BR /&gt;
account                   Computer 2           10.10.0.2&lt;BR /&gt;
account                   Computer 3           10.10.0.3&lt;/P&gt;

&lt;P&gt;what I'd like to see is just a grouping and count of "Account_Name" and show other fields as well:&lt;/P&gt;

&lt;P&gt;Account_Name   Computer name            IP          Count&lt;BR /&gt;
account                   Computer 1           10.10.0.1       3&lt;BR /&gt;
account                   Computer 2           10.10.0.2       3&lt;BR /&gt;
account                   Computer 3           10.10.0.3       3 &lt;/P&gt;</description>
      <pubDate>Fri, 24 May 2019 13:18:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-show-more-fields-after-the-stats-count-by-command/m-p/386045#M112692</guid>
      <dc:creator>jcolon68</dc:creator>
      <dc:date>2019-05-24T13:18:50Z</dc:date>
    </item>
    <item>
      <title>Re: How do I show more fields after the stats count by command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-show-more-fields-after-the-stats-count-by-command/m-p/386046#M112693</link>
      <description>&lt;P&gt;You could try using the &lt;STRONG&gt;eventstats&lt;/STRONG&gt; command instead of stats.&lt;/P&gt;

&lt;P&gt;Per Splunk Docs,&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;The eventstats command is similar to the stats command. The difference is that with the eventstats command aggregation results are added inline to each event and added only if the aggregation is pertinent to that event.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Eventstats"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Eventstats&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 May 2019 13:50:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-show-more-fields-after-the-stats-count-by-command/m-p/386046#M112693</guid>
      <dc:creator>mkolkebeck</dc:creator>
      <dc:date>2019-05-24T13:50:12Z</dc:date>
    </item>
    <item>
      <title>Re: How do I show more fields after the stats count by command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-show-more-fields-after-the-stats-count-by-command/m-p/386047#M112694</link>
      <description>&lt;P&gt;What's your requirement here? Could you please provide available fields and sample expected &lt;BR /&gt;
output?&lt;/P&gt;</description>
      <pubDate>Fri, 24 May 2019 14:37:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-show-more-fields-after-the-stats-count-by-command/m-p/386047#M112694</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2019-05-24T14:37:40Z</dc:date>
    </item>
    <item>
      <title>Re: How do I show more fields after the stats count by command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-show-more-fields-after-the-stats-count-by-command/m-p/386048#M112695</link>
      <description>&lt;P&gt;So you want to count the account names by multiple fields while still showing the account name?&lt;BR /&gt;
Have you tried something like:&lt;BR /&gt;
index=wineventlog EventCode=4740 host=* | stats c(Account_Name) as COUNT by Account_Name, ComputerName, IP&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:40:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-show-more-fields-after-the-stats-count-by-command/m-p/386048#M112695</guid>
      <dc:creator>mtranchita</dc:creator>
      <dc:date>2020-09-30T00:40:09Z</dc:date>
    </item>
    <item>
      <title>Re: How do I show more fields after the stats count by command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-show-more-fields-after-the-stats-count-by-command/m-p/526736#M148677</link>
      <description>&lt;PRE&gt;index=wineventlog EventCode=4740 host=* | stats count by Account_Name,&amp;nbsp;Computer_Name,&amp;nbsp;IP&amp;nbsp;| stats&amp;nbsp;list(Computer_Name)&amp;nbsp;as&amp;nbsp;Computer_Name,&amp;nbsp;list(IP)&amp;nbsp;as&amp;nbsp;IP, count(Account_Name) as Count&amp;nbsp;by&amp;nbsp;Account_Name&amp;nbsp;|&amp;nbsp;sort&amp;nbsp;-&amp;nbsp;Count&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/179651"&gt;@jcolon68&lt;/a&gt;, t&lt;/SPAN&gt;his groups Account_Names together and still counts them.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2020 01:10:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-show-more-fields-after-the-stats-count-by-command/m-p/526736#M148677</guid>
      <dc:creator>khiott</dc:creator>
      <dc:date>2020-10-28T01:10:51Z</dc:date>
    </item>
  </channel>
</rss>

