<?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: Search optimization question in Knowledge Management</title>
    <link>https://community.splunk.com/t5/Knowledge-Management/Search-optimization-question/m-p/494782#M8392</link>
    <description>&lt;P&gt;Hi  jonydupre,&lt;BR /&gt;
your search isn't so clear, can you better describe what you want to have as result?&lt;BR /&gt;
The total count of different hosts for each day?&lt;BR /&gt;
eventually divided by HealthchecksError?&lt;/P&gt;

&lt;P&gt;Anyway, reading you search I see that you don't need the first stats count (&lt;CODE&gt;| stats count BY host&lt;/CODE&gt; ) because you have a dedup before and another stats count after.&lt;/P&gt;

&lt;P&gt;Then I see that you used appendcols with the same search in a different period, while you could use timechart command, something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=linux host="i*soe*" earliest=-2d@d latest=now "healthcheck: System not healthy" 
| timechart span=1d dc(host) AS n_hosts
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you want also differentiate the count of different hosts by HealthchecksError, you can add this clause to the timechart:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=linux host="i*soe*" earliest=-2d@d latest=now "healthcheck: System not healthy" 
| timechart span=1d dc(host) AS n_hosts BY HealthchecksError
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
    <pubDate>Thu, 10 Oct 2019 10:51:48 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2019-10-10T10:51:48Z</dc:date>
    <item>
      <title>Search optimization question</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/Search-optimization-question/m-p/494781#M8391</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;

&lt;P&gt;I had some trouble with a search but got it to work. But the search istelf isn't that "clean" I suppose.&lt;BR /&gt;
Someone mentioned &lt;CODE&gt;Timechart&lt;/CODE&gt; but I couldn't get it to work.&lt;/P&gt;

&lt;P&gt;This is the search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=linux host="i*soe*" earliest=-1d@d latest=@d "healthcheck: System not healthy" | dedup host | stats count by host
| stats count as TotalA
| appendcols 
[search index=linux host="i*soe*" earliest=@d latest=now "healthcheck: System not healthy" | dedup host | stats count by host 
| stats count as TotalB]
| appendcols 
[search index=linux earliest=-2d@d host="i*soe*" latest=-1d@d "healthcheck: System not healthy" | dedup host | stats count by host 
| stats count as TotalC]
| eval Gister=TotalA 
| eval Vandaag=TotalB
| eval Eergisteren=TotalC
| fields HealthchecksError, 2days ago, Yesterday, Today
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Would there be a way to improve the search syntax wise?&lt;BR /&gt;
Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 08:22:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/Search-optimization-question/m-p/494781#M8391</guid>
      <dc:creator>jonydupre</dc:creator>
      <dc:date>2019-10-10T08:22:59Z</dc:date>
    </item>
    <item>
      <title>Re: Search optimization question</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/Search-optimization-question/m-p/494782#M8392</link>
      <description>&lt;P&gt;Hi  jonydupre,&lt;BR /&gt;
your search isn't so clear, can you better describe what you want to have as result?&lt;BR /&gt;
The total count of different hosts for each day?&lt;BR /&gt;
eventually divided by HealthchecksError?&lt;/P&gt;

&lt;P&gt;Anyway, reading you search I see that you don't need the first stats count (&lt;CODE&gt;| stats count BY host&lt;/CODE&gt; ) because you have a dedup before and another stats count after.&lt;/P&gt;

&lt;P&gt;Then I see that you used appendcols with the same search in a different period, while you could use timechart command, something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=linux host="i*soe*" earliest=-2d@d latest=now "healthcheck: System not healthy" 
| timechart span=1d dc(host) AS n_hosts
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you want also differentiate the count of different hosts by HealthchecksError, you can add this clause to the timechart:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=linux host="i*soe*" earliest=-2d@d latest=now "healthcheck: System not healthy" 
| timechart span=1d dc(host) AS n_hosts BY HealthchecksError
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 10:51:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/Search-optimization-question/m-p/494782#M8392</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-10-10T10:51:48Z</dc:date>
    </item>
  </channel>
</rss>

