<?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 How do I write a search to display a table with the count of each value for a field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-a-search-to-display-a-table-with-the-count-of/m-p/159361#M44958</link>
    <description>&lt;P&gt;Hello, &lt;/P&gt;

&lt;P&gt;My data looks like: &lt;/P&gt;

&lt;P&gt;I currently have this search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=myapp test123 | stats count by type 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The results are: &lt;/P&gt;

&lt;P&gt;type      ........      count&lt;BR /&gt;
1234     ...........          2&lt;BR /&gt;
123        ........ ..         1&lt;BR /&gt;
456         ..........         6&lt;/P&gt;

&lt;P&gt;I just want to show the count result and another criteria from the logs in a table. Is it possible?&lt;/P&gt;

&lt;P&gt;thanks &lt;/P&gt;</description>
    <pubDate>Tue, 11 Aug 2015 11:05:04 GMT</pubDate>
    <dc:creator>abovebeyond</dc:creator>
    <dc:date>2015-08-11T11:05:04Z</dc:date>
    <item>
      <title>How do I write a search to display a table with the count of each value for a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-a-search-to-display-a-table-with-the-count-of/m-p/159361#M44958</link>
      <description>&lt;P&gt;Hello, &lt;/P&gt;

&lt;P&gt;My data looks like: &lt;/P&gt;

&lt;P&gt;I currently have this search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=myapp test123 | stats count by type 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The results are: &lt;/P&gt;

&lt;P&gt;type      ........      count&lt;BR /&gt;
1234     ...........          2&lt;BR /&gt;
123        ........ ..         1&lt;BR /&gt;
456         ..........         6&lt;/P&gt;

&lt;P&gt;I just want to show the count result and another criteria from the logs in a table. Is it possible?&lt;/P&gt;

&lt;P&gt;thanks &lt;/P&gt;</description>
      <pubDate>Tue, 11 Aug 2015 11:05:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-a-search-to-display-a-table-with-the-count-of/m-p/159361#M44958</guid>
      <dc:creator>abovebeyond</dc:creator>
      <dc:date>2015-08-11T11:05:04Z</dc:date>
    </item>
    <item>
      <title>Re: How do I write a search to display a table with the count of each value for a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-a-search-to-display-a-table-with-the-count-of/m-p/159362#M44959</link>
      <description>&lt;P&gt;What does your data look like?  What is the "other criteria"?&lt;/P&gt;</description>
      <pubDate>Tue, 11 Aug 2015 12:05:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-a-search-to-display-a-table-with-the-count-of/m-p/159362#M44959</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-08-11T12:05:51Z</dc:date>
    </item>
    <item>
      <title>Re: How do I write a search to display a table with the count of each value for a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-a-search-to-display-a-table-with-the-count-of/m-p/159363#M44960</link>
      <description>&lt;P&gt;my data looks like :&lt;/P&gt;

&lt;P&gt;015-08-11 10:28:57.4149|process-name|ERROR|BusinessService.myapp.Create.LoggHandleError|Created myapp Failed &lt;STRONG&gt;Mname: myprime&lt;/STRONG&gt;  |ConsumerName: unknown | &lt;STRONG&gt;type : 4444&lt;/STRONG&gt;|ERROR: ErrorCode: Invalidtype &lt;BR /&gt;
Failed &lt;STRONG&gt;Mname: myprime&lt;/STRONG&gt;  |ConsumerName: unknown | &lt;STRONG&gt;type : 4444&lt;/STRONG&gt;|ERROR: ErrorCode: Invalidtype &lt;BR /&gt;
015-08-11 10:28:58.4259|process-name|ERROR|BusinessService.myapp.Create.LoggHandleError|Created myapp Failed &lt;STRONG&gt;Mname: myprime&lt;/STRONG&gt;|ConsumerName: unknown | &lt;STRONG&gt;type : 5555&lt;/STRONG&gt;|ERROR: ErrorCode: Invalidtype &lt;BR /&gt;
015-08-11 10:28:58.4259|process-name|ERROR|BusinessService.myapp.Create.LoggHandleError|Created myapp Failed &lt;STRONG&gt;Mname: myprime2&lt;/STRONG&gt;|ConsumerName: unknown | &lt;STRONG&gt;type : 6666&lt;/STRONG&gt;|ERROR: ErrorCode: Invalidtype&lt;/P&gt;

&lt;P&gt;i want to show in table :&lt;/P&gt;

&lt;P&gt;Mname         ..............       count (of type)&lt;/P&gt;

&lt;P&gt;myprime         ..............        3&lt;BR /&gt;
myprime 2          ............       1&lt;/P&gt;

&lt;P&gt;hope you understand&lt;/P&gt;</description>
      <pubDate>Tue, 11 Aug 2015 12:23:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-a-search-to-display-a-table-with-the-count-of/m-p/159363#M44960</guid>
      <dc:creator>abovebeyond</dc:creator>
      <dc:date>2015-08-11T12:23:15Z</dc:date>
    </item>
    <item>
      <title>Re: How do I write a search to display a table with the count of each value for a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-a-search-to-display-a-table-with-the-count-of/m-p/159364#M44961</link>
      <description>&lt;P&gt;Yes, it's defiantly possible.. Instead of doing a stats, you can just do a table command if you want to add more columns &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=myapp test123 | table type brand color
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or if you wanted it to calculate the type and add a table, you could do.. The eval command will create a new field and do the math (size/occurance). The result of the division will be the new field "type"&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=myapp test123 | eval type=(size/occurance) | table type brand color
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Aug 2015 12:40:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-a-search-to-display-a-table-with-the-count-of/m-p/159364#M44961</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2015-08-11T12:40:57Z</dc:date>
    </item>
    <item>
      <title>Re: How do I write a search to display a table with the count of each value for a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-a-search-to-display-a-table-with-the-count-of/m-p/159365#M44962</link>
      <description>&lt;P&gt;You should look at all the &lt;CODE&gt;functions&lt;/CODE&gt; that are available for the &lt;CODE&gt;stats&lt;/CODE&gt; command and use what you need,  You will probably need &lt;CODE&gt;values&lt;/CODE&gt;, &lt;CODE&gt;avg&lt;/CODE&gt;, &lt;CODE&gt;last&lt;/CODE&gt;, &lt;CODE&gt;min&lt;/CODE&gt;, and &lt;CODE&gt;max&lt;/CODE&gt;.  You just string them along like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=myapp test123 | stats count avg(delay) last(status) values(color) by type
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you are gong to graph them, you should switch from &lt;CODE&gt;stats&lt;/CODE&gt; to &lt;CODE&gt;chart&lt;/CODE&gt;, which is a very similar command and it automatically advances populates the &lt;CODE&gt;Visualization&lt;/CODE&gt; tab.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.4/SearchReference/CommonStatsFunctions"&gt;http://docs.splunk.com/Documentation/Splunk/6.2.4/SearchReference/CommonStatsFunctions&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Aug 2015 13:27:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-a-search-to-display-a-table-with-the-count-of/m-p/159365#M44962</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-08-11T13:27:41Z</dc:date>
    </item>
  </channel>
</rss>

