<?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 to create timechart to show server log ingestion stats including servers with 0 ingestion? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-timechart-to-show-server-log-ingestion-stats/m-p/453848#M41136</link>
    <description>&lt;P&gt;@YoungDaniel, your solution isn't working, but thank you for your help in suggesting a solution. Appreciate that. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 27 Jul 2018 06:58:26 GMT</pubDate>
    <dc:creator>kelvinchan</dc:creator>
    <dc:date>2018-07-27T06:58:26Z</dc:date>
    <item>
      <title>How to create timechart to show server log ingestion stats including servers with 0 ingestion?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-timechart-to-show-server-log-ingestion-stats/m-p/453844#M41132</link>
      <description>&lt;P&gt;I'm trying to create a timechart statistics to show server log ingestion status by days:&lt;/P&gt;

&lt;P&gt;index=zzz (host=Server1 OR host=Server2 OR host=Server3) | timechart span=1d count by host&lt;/P&gt;

&lt;P&gt;All 3 servers are shown in the Statistics/Line Chart if they have ingested data into Splunk before, but if for example 'Server3' has not been setup to ingest data into Splunk before, and I would like this server to be appearing in the statistics/line chart as well (shown as 0 on all the _time field), how can I do that? Can anyone advise me on this? Thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jul 2018 03:48:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-timechart-to-show-server-log-ingestion-stats/m-p/453844#M41132</guid>
      <dc:creator>kelvinchan</dc:creator>
      <dc:date>2018-07-23T03:48:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to create timechart to show server log ingestion stats including servers with 0 ingestion?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-timechart-to-show-server-log-ingestion-stats/m-p/453845#M41133</link>
      <description>&lt;P&gt;Try to add this to your search . &lt;BR /&gt;
    index=zzz (host=Server1 OR host=Server2 OR host=Server3)&lt;BR /&gt;
    |&amp;nbsp;eval server3 = "server3"&lt;BR /&gt;
    | rename server3 as host&lt;BR /&gt;
    | timechart span=1d count by host&lt;BR /&gt;
    | fillnull value="0" &lt;BR /&gt;
This should work. &lt;/P&gt;</description>
      <pubDate>Wed, 25 Jul 2018 12:40:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-timechart-to-show-server-log-ingestion-stats/m-p/453845#M41133</guid>
      <dc:creator>YoungDaniel</dc:creator>
      <dc:date>2018-07-25T12:40:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to create timechart to show server log ingestion stats including servers with 0 ingestion?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-timechart-to-show-server-log-ingestion-stats/m-p/453846#M41134</link>
      <description>&lt;P&gt;@YoungDaniel -&lt;/P&gt;

&lt;P&gt;That will add "server3" as host on every record, resulting in doubling the response for server3 and adding the other two servers to server3 as well.  &lt;/P&gt;

&lt;P&gt;If you do your add work in an &lt;CODE&gt;append&lt;/CODE&gt; or &lt;CODE&gt;appendpipe&lt;/CODE&gt;, then it would only create new records.&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;I was wrong... it actually overwrote the other host values, so it rolled everything together into Server3.  Here's a run-anywhere code sample to show how that came out.. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=100 
| eval host=mvappend("Server1","Server2")
| mvexpand host  
| eval _time = _time -500000 + (random() %500000)  
| sort _time

| eval server3 = "server3"
| rename server3 as host
| timechart span=1d count by host
| fillnull value="0" 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Jul 2018 13:18:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-timechart-to-show-server-log-ingestion-stats/m-p/453846#M41134</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2018-07-25T13:18:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to create timechart to show server log ingestion stats including servers with 0 ingestion?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-timechart-to-show-server-log-ingestion-stats/m-p/453847#M41135</link>
      <description>&lt;P&gt;Here's a couple of methods that would work...&lt;/P&gt;

&lt;P&gt;For a small number of servers, you could do it this way... using a loop to manually add the field to each record if it is missing from all of them.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=zzz (host="Server1" OR host="Server2" OR host="Server3")
| timechart span=1d count by host
| foreach Server1 Server2 Server3 [eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;=coalesce(&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;,0)]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or, you could do it this way...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=zzz (host="Server1" OR host="Server2" OR host="Server3")
| bin _time span=1d
| stats count as daycount by host _time

| rename COMMENT as "Create a single zero record for each server with the lowest _time"
| appendpipe [
    | stats min(_time) as _time 
    | eval host=mvappend("Server1", "Server2", "Server3") 
    | eval daycount=0
    | mvexpand  host
    ] 

| rename COMMENT as "Now timechart, rolling in the zero records.  Fillnull will zero-fill any missing days"
| timechart span=1d sum(daycount) by host
| fillnull
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;P&gt;For a larger number of records, you are going to want to put the host names into a lookup table or csv.  For this example I used a lookup, and assumed the name of the table was &lt;CODE&gt;myHosts.csv&lt;/CODE&gt; and the server field in the lookup was &lt;CODE&gt;Host&lt;/CODE&gt;.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=zzz  ( [|inputlookup myHosts.csv | table Host | rename Host as host ] )
| bin _time span=1d
| stats count as daycount by host _time

| rename COMMENT as "Create a single zero record for each server with the lowest _time"
| appendpipe [
    | rename COMMENT as "find the lowest _time"
    | stats min(_time) as _time 

    | rename COMMENT as "add in all the host values from the lookup"
    | inputlookup append=t myHosts.csv

    | rename COMMENT as "Roll them all together in one record."
    | rename COMMENT as "We  use 'list' instead of 'values' in case there are more than 100 records in the lookup"
    | rename COMMENT as "We won't bother to `dedup` them because they are about to be timecharted back together anyway." 
    | stats values(_time) as _time list(Host) as host

    | rename COMMENT as "add the zero and expand them to one record per host " 
    | eval daycount=0
    | mvexpand  host
    ] 

| rename COMMENT as "Now timechart, rolling in the zero records.  fillnull will fill the zeroes."
| timechart span=1d sum(daycount) by host useother=f
| fillnull
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;P&gt;For an absolutely MASSIVE number of servers - more than 1000 - you are going to want to use the lookup table as a lookup, so change the first line to be like this...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=zzz 
| fields host
| lookup Host as host myHosts.csv OUTPUT Host as foundme
| where isnotnull(foundme)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In this case, the &lt;CODE&gt;appendpipe&lt;/CODE&gt; section might also need to change for efficiency's sake to an &lt;CODE&gt;append&lt;/CODE&gt;...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rename COMMENT as "Create a single zero record for each server using _time as earliest from the search"
| append  [

    | rename COMMENT as "add in all the host values from the lookup"
    | inputlookup append=t myHosts.csv
    | fields Host
    | rename Host as host

    | rename COMMENT as "add in the `earliest` from the search as _time, then table out the records"
    | addinfo
    | eval _time = info_min_time
    | eval daycount=0
    | table _time host daycount
    ] 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;P&gt;All of the above methods are mix-and-match to your needs.  Once you understand why each one works, feel free to move them around and test them against each other to see which ones are most efficient to your use case and your data.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jul 2018 13:31:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-timechart-to-show-server-log-ingestion-stats/m-p/453847#M41135</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2018-07-25T13:31:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to create timechart to show server log ingestion stats including servers with 0 ingestion?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-timechart-to-show-server-log-ingestion-stats/m-p/453848#M41136</link>
      <description>&lt;P&gt;@YoungDaniel, your solution isn't working, but thank you for your help in suggesting a solution. Appreciate that. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jul 2018 06:58:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-timechart-to-show-server-log-ingestion-stats/m-p/453848#M41136</guid>
      <dc:creator>kelvinchan</dc:creator>
      <dc:date>2018-07-27T06:58:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to create timechart to show server log ingestion stats including servers with 0 ingestion?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-timechart-to-show-server-log-ingestion-stats/m-p/453849#M41137</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/203121"&gt;@DalJeanis&lt;/a&gt;,&lt;/P&gt;

&lt;P&gt;Thank you very much. Your solutions worked for my ad-hoc report and long term report (both small number of servers and large number of servers)!! However, I do noted that the timechart has a limit of 10 servers only in the line chart, I used this to show all servers in the line chart:&lt;/P&gt;

&lt;P&gt;| timechart span=1d sum(daycount) by host useother=f limit=0&lt;/P&gt;

&lt;P&gt;Anyway, it looks very messy in the line chart as I have 3000+ servers to display, so I decided to filter according to server role in my inventory list and export it to Excel spreadsheet and do a pivot to show my manager server count based on the last ingested time grouped into day (for specific server roles only, which I can change it according to which server role he wants to look at). My final solution is as below.&lt;/P&gt;

&lt;P&gt;index=zzz [ &lt;BR /&gt;
  | inputlookup ServerInventory.csv &lt;BR /&gt;
  | search Status="Active" Server_Role="Web" &lt;BR /&gt;
  | fields ServerName &lt;BR /&gt;
  | rename ServerName as host &lt;BR /&gt;
  ] &lt;BR /&gt;
| append [ &lt;BR /&gt;
  inputlookup append=t ServerInventory.csv &lt;BR /&gt;
  | search Status="Active" Server_Role="Web" &lt;BR /&gt;
  | fields ServerName &lt;BR /&gt;
  | rename ServerName as host &lt;BR /&gt;
  | addinfo &lt;BR /&gt;
  | eval _time = min_time_info &lt;BR /&gt;
  | table _time host &lt;BR /&gt;
  ] &lt;BR /&gt;
| stats max(_time) as _time by host&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:37:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-timechart-to-show-server-log-ingestion-stats/m-p/453849#M41137</guid>
      <dc:creator>kelvinchan</dc:creator>
      <dc:date>2020-09-29T20:37:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to create timechart to show server log ingestion stats including servers with 0 ingestion?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-timechart-to-show-server-log-ingestion-stats/m-p/453850#M41138</link>
      <description>&lt;P&gt;Upvote for your polite expression of appreciation.  &lt;/P&gt;</description>
      <pubDate>Sun, 29 Jul 2018 03:34:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-timechart-to-show-server-log-ingestion-stats/m-p/453850#M41138</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2018-07-29T03:34:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to create timechart to show server log ingestion stats including servers with 0 ingestion?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-timechart-to-show-server-log-ingestion-stats/m-p/453851#M41139</link>
      <description>&lt;P&gt;@kelvinchan - Yes, for that many hosts, I would not use &lt;CODE&gt;timechart&lt;/CODE&gt; at all.  Timechart is a presentation tool, no more, no less.&lt;/P&gt;

&lt;P&gt;I"d have to say, for that final use case, you'd want to look at &lt;CODE&gt;tstats&lt;/CODE&gt; instead.  All you are doing is finding the highest _time value in a given index for each host.  Try the code in the accepted answer by @somesoni2 on this one:&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/497834/how-to-use-tstats-to-show-the-last-event-and-event.html"&gt;https://answers.splunk.com/answers/497834/how-to-use-tstats-to-show-the-last-event-and-event.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;If that answer helps you, please give Somesh's answer an upvote over there. &lt;/P&gt;</description>
      <pubDate>Sun, 29 Jul 2018 03:42:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-timechart-to-show-server-log-ingestion-stats/m-p/453851#M41139</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2018-07-29T03:42:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to create timechart to show server log ingestion stats including servers with 0 ingestion?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-timechart-to-show-server-log-ingestion-stats/m-p/453852#M41140</link>
      <description>&lt;P&gt;@DalJeanis, thanks!! Should have figured that out to speed up the search and performance. Somesh's answer works great, I've upvoted his answer. Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jul 2018 02:02:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-timechart-to-show-server-log-ingestion-stats/m-p/453852#M41140</guid>
      <dc:creator>kelvinchan</dc:creator>
      <dc:date>2018-07-31T02:02:34Z</dc:date>
    </item>
  </channel>
</rss>

