<?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 generate a timechart for servers showing the uptime and downtime within a span of 5 minutes? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-timechart-for-servers-showing-the-uptime-and/m-p/217921#M64029</link>
    <description>&lt;P&gt;I got the &lt;CODE&gt;state_to=*&lt;/CODE&gt; part from &lt;EM&gt;you&lt;/EM&gt; in your question!  My solution does not have &lt;CODE&gt;timechart&lt;/CODE&gt; so you are not making sense.  Does the first half generate events where each has a field called &lt;CODE&gt;secondsInThisState&lt;/CODE&gt; whose values are sensible?&lt;/P&gt;</description>
    <pubDate>Thu, 10 Sep 2015 17:07:17 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2015-09-10T17:07:17Z</dc:date>
    <item>
      <title>How to generate a timechart for servers showing the uptime and downtime within a span of 5 minutes?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-timechart-for-servers-showing-the-uptime-and/m-p/217916#M64024</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;

&lt;P&gt;My goal is to create a  drop-down that shows the uptime and downtime of a server.&lt;BR /&gt;
The SPL I have isn't coming out well as planned. I want it to be possible to show the time the server went down and the time it came back up on the chart. Can someone help me?&lt;BR /&gt;
This is all I have so far.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=perfmon collection=System counter="System up Time"  sourcetype="Perfmon:System"   state_to=* | transaction Uptime startswith=(state_to=Up) endswith=(state_to=Down)  
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Sep 2015 19:32:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-timechart-for-servers-showing-the-uptime-and/m-p/217916#M64024</guid>
      <dc:creator>idab</dc:creator>
      <dc:date>2015-09-09T19:32:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate a timechart for servers showing the uptime and downtime within a span of 5 minutes?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-timechart-for-servers-showing-the-uptime-and/m-p/217917#M64025</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=perfmon collection=System counter="System up Time" sourcetype="Perfmon:System" state_to=* | streamstats current=f last(_time) AS nextTime by host | eval nextTime=coalesce(nextTime, now()) | eval secondsInThisState = nextTime - _time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is your base search and I believe that you are looking to do something further like appending this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval upSeconds=if(like(_raw, "%state_to=Up%"), secondsInThisState, null()) | eval downSeconds=if(isnull(upSeconds), secondsInThisState, null()) | stats list(upSeconds) list(downSeconds) by host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Sep 2015 00:03:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-timechart-for-servers-showing-the-uptime-and/m-p/217917#M64025</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-09-10T00:03:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate a timechart for servers showing the uptime and downtime within a span of 5 minutes?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-timechart-for-servers-showing-the-uptime-and/m-p/217918#M64026</link>
      <description>&lt;P&gt;So, I used the SPL this way appending the second row - using a server host that we just restarted as a test.But, there were no values displayed for the list(upseconds) .Couldn't see any chart either.I was thinking the search would display the uptime and downtime period for a host machine.&lt;BR /&gt;
Need help!&lt;/P&gt;

&lt;P&gt;index=perfmon  host="hostName" collection=System counter="System up Time" sourcetype="Perfmon:System"   | streamstats current=f last(_time) AS nextTime by host | eval nextTime=coalesce(nextTime, now()) | eval secondsInThisState = nextTime - _time | eval upSeconds=if(like(_raw, "%state_to=Up%"), secondsInThisState, null()) | eval downSeconds=if(isnull(upSeconds), secondsInThisState, null()) | stats list(upSeconds) list(downSeconds) by host&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:14:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-timechart-for-servers-showing-the-uptime-and/m-p/217918#M64026</guid>
      <dc:creator>idab</dc:creator>
      <dc:date>2020-09-29T07:14:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate a timechart for servers showing the uptime and downtime within a span of 5 minutes?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-timechart-for-servers-showing-the-uptime-and/m-p/217919#M64027</link>
      <description>&lt;P&gt;Does the first half look correct when run by itself?&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2015 03:06:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-timechart-for-servers-showing-the-uptime-and/m-p/217919#M64027</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-09-10T03:06:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate a timechart for servers showing the uptime and downtime within a span of 5 minutes?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-timechart-for-servers-showing-the-uptime-and/m-p/217920#M64028</link>
      <description>&lt;P&gt;So, the first half gave no result found. But, when I took out the   state_to=* it gave some event data., with no timechart .&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2015 16:32:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-timechart-for-servers-showing-the-uptime-and/m-p/217920#M64028</guid>
      <dc:creator>idab</dc:creator>
      <dc:date>2015-09-10T16:32:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate a timechart for servers showing the uptime and downtime within a span of 5 minutes?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-timechart-for-servers-showing-the-uptime-and/m-p/217921#M64029</link>
      <description>&lt;P&gt;I got the &lt;CODE&gt;state_to=*&lt;/CODE&gt; part from &lt;EM&gt;you&lt;/EM&gt; in your question!  My solution does not have &lt;CODE&gt;timechart&lt;/CODE&gt; so you are not making sense.  Does the first half generate events where each has a field called &lt;CODE&gt;secondsInThisState&lt;/CODE&gt; whose values are sensible?&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2015 17:07:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-timechart-for-servers-showing-the-uptime-and/m-p/217921#M64029</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-09-10T17:07:17Z</dc:date>
    </item>
  </channel>
</rss>

