<?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: Table with host, sourcetype, sample event or log in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-with-search-that-creates-Table-with-host-sourcetype-sample/m-p/600057#M208884</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/229227"&gt;@muradgh&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;please try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=*
| stats count first(_row) AS sample_event BY host sourcetype
| appendpipe [ | stats sum(count) AS total BY host | eval sourcetype="ZZTotal" ]
| sort host sourcetype
| eval sourcetype=if(sourcetype="ZZTotal","Total",sourcetype)
| table host sourcetype count total sample_event&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
    <pubDate>Wed, 01 Jun 2022 10:56:52 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2022-06-01T10:56:52Z</dc:date>
    <item>
      <title>Help with search that creates Table with host, sourcetype, sample event or log</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-search-that-creates-Table-with-host-sourcetype-sample/m-p/600045#M208876</link>
      <description>&lt;P&gt;Hi Splunkers,&lt;/P&gt;
&lt;P&gt;I need to make a statistical table to show me the hosts and each sourcetype that it generates and the count for each&amp;nbsp;sourcetype with a column that calculates the total count and most importantly a column with a sample event from each sourcetype.&lt;/P&gt;
&lt;P&gt;I want it to be something like the attached table:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="muradgh_0-1654077564480.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/19883iA65552E37A207F75/image-size/medium?v=v2&amp;amp;px=400" role="button" title="muradgh_0-1654077564480.png" alt="muradgh_0-1654077564480.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Can someone please help me with the search that provides me with such a table?&lt;/P&gt;
&lt;P&gt;I have tried to make such a table using the following command (without the raw log):&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| tstats values(sourcetype) count where index=* by host
| sort - count&lt;/LI-CODE&gt;
&lt;P&gt;but the above search counts only the total of all the sourcetypes&lt;/P&gt;
&lt;P&gt;Then I have tried a different search:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=* | chart count OVER host BY sourcetype useother=false limit=0&lt;/LI-CODE&gt;
&lt;P&gt;but again this is not an accurate search for what I want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Much Thanks&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Murad Ghazzawi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jun 2022 15:29:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-search-that-creates-Table-with-host-sourcetype-sample/m-p/600045#M208876</guid>
      <dc:creator>muradgh</dc:creator>
      <dc:date>2022-06-01T15:29:46Z</dc:date>
    </item>
    <item>
      <title>Re: Table with host, sourcetype, sample event or log</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-search-that-creates-Table-with-host-sourcetype-sample/m-p/600046#M208877</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/229227"&gt;@muradgh&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;you could try something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=*
| stats count values(total) AS total last(_row) AS sample_event BY host sourcetype
| appendpipe [ | stats sum(count) AS total BY host | eval sourcetype="Total" ]
| table host sourcetype count total sample_event&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jun 2022 10:35:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-search-that-creates-Table-with-host-sourcetype-sample/m-p/600046#M208877</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-06-01T10:35:04Z</dc:date>
    </item>
    <item>
      <title>Re: Table with host, sourcetype, sample event or log</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-search-that-creates-Table-with-host-sourcetype-sample/m-p/600053#M208881</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;Unfortunately, this search did not provide me with what I wanted, check the below screenshot for the result of your search:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="muradgh_0-1654080337051.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/19884i42AB6B171F83C5F0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="muradgh_0-1654080337051.png" alt="muradgh_0-1654080337051.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jun 2022 10:46:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-search-that-creates-Table-with-host-sourcetype-sample/m-p/600053#M208881</guid>
      <dc:creator>muradgh</dc:creator>
      <dc:date>2022-06-01T10:46:15Z</dc:date>
    </item>
    <item>
      <title>Re: Table with host, sourcetype, sample event or log</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-search-that-creates-Table-with-host-sourcetype-sample/m-p/600057#M208884</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/229227"&gt;@muradgh&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;please try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=*
| stats count first(_row) AS sample_event BY host sourcetype
| appendpipe [ | stats sum(count) AS total BY host | eval sourcetype="ZZTotal" ]
| sort host sourcetype
| eval sourcetype=if(sourcetype="ZZTotal","Total",sourcetype)
| table host sourcetype count total sample_event&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jun 2022 10:56:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-search-that-creates-Table-with-host-sourcetype-sample/m-p/600057#M208884</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-06-01T10:56:52Z</dc:date>
    </item>
    <item>
      <title>Re: Table with host, sourcetype, sample event or log</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-search-that-creates-Table-with-host-sourcetype-sample/m-p/600058#M208885</link>
      <description>&lt;P&gt;Just with a small correction&amp;nbsp;&lt;/P&gt;&lt;P&gt;index=* |stats count first(_raw) ….. rest is same. I think autocorrect messed it up.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jun 2022 11:15:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-search-that-creates-Table-with-host-sourcetype-sample/m-p/600058#M208885</guid>
      <dc:creator>SinghK</dc:creator>
      <dc:date>2022-06-01T11:15:30Z</dc:date>
    </item>
    <item>
      <title>Re: Table with host, sourcetype, sample event or log</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-search-that-creates-Table-with-host-sourcetype-sample/m-p/600063#M208887</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;/P&gt;&lt;P&gt;Thank you for your help. &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jun 2022 11:25:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-search-that-creates-Table-with-host-sourcetype-sample/m-p/600063#M208887</guid>
      <dc:creator>muradgh</dc:creator>
      <dc:date>2022-06-01T11:25:26Z</dc:date>
    </item>
    <item>
      <title>Re: Table with host, sourcetype, sample event or log</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-search-that-creates-Table-with-host-sourcetype-sample/m-p/600064#M208888</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/228600"&gt;@SinghK&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the note.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jun 2022 11:25:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-search-that-creates-Table-with-host-sourcetype-sample/m-p/600064#M208888</guid>
      <dc:creator>muradgh</dc:creator>
      <dc:date>2022-06-01T11:25:59Z</dc:date>
    </item>
  </channel>
</rss>

