<?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 determine how long splunk has been up? in Monitoring Splunk</title>
    <link>https://community.splunk.com/t5/Monitoring-Splunk/How-to-determine-how-long-splunk-has-been-up/m-p/87767#M7393</link>
    <description>&lt;PRE&gt;&lt;CODE&gt;| rest / services/server/info 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This only shows indexers.  What's the REST endpoint for startup time of all &lt;EM&gt;Universal Forwarders&lt;/EM&gt;?&lt;/P&gt;</description>
    <pubDate>Mon, 10 Sep 2018 18:32:40 GMT</pubDate>
    <dc:creator>dijikul</dc:creator>
    <dc:date>2018-09-10T18:32:40Z</dc:date>
    <item>
      <title>How to determine how long splunk has been up?</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/How-to-determine-how-long-splunk-has-been-up/m-p/87759#M7385</link>
      <description>&lt;P&gt;Is there a command in splunk or some way to find out how long it has been up since the last restart?&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2013 15:52:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/How-to-determine-how-long-splunk-has-been-up/m-p/87759#M7385</guid>
      <dc:creator>wrangler2x</dc:creator>
      <dc:date>2013-10-08T15:52:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine how long splunk has been up?</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/How-to-determine-how-long-splunk-has-been-up/m-p/87760#M7386</link>
      <description>&lt;P&gt;Try this search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal "splunkd started"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;to find out when was the last time that splunkd was started. Note that you &lt;EM&gt;may&lt;/EM&gt; have to also add &lt;CODE&gt;host=zzzz&lt;/CODE&gt; if you want to restrict to a particular host.&lt;/P&gt;

&lt;P&gt;If you really want only the uptime, try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal "splunkd started"
| head 1
| eval uptime = tostring(now() - _time,"duration")
| fields uptime
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 08 Oct 2013 16:00:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/How-to-determine-how-long-splunk-has-been-up/m-p/87760#M7386</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2013-10-08T16:00:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine how long splunk has been up?</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/How-to-determine-how-long-splunk-has-been-up/m-p/87761#M7387</link>
      <description>&lt;P&gt;Searching in &lt;CODE&gt;sourcetype=splunkd index=_internal&lt;/CODE&gt; you will find a message like this;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;10-08-2013 08:55:27.844 +0200 INFO  loader - Splunkd starting (build 143156).
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;NB, this is for version 5.x, don't know if it differs in 6.x&lt;/P&gt;

&lt;P&gt;/K&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2013 16:08:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/How-to-determine-how-long-splunk-has-been-up/m-p/87761#M7387</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-10-08T16:08:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine how long splunk has been up?</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/How-to-determine-how-long-splunk-has-been-up/m-p/87762#M7388</link>
      <description>&lt;P&gt;6.0: &lt;CODE&gt;10-07-2013 08:33:05.380 -0700 INFO loader - Splunkd starting (build 182037).&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2013 16:16:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/How-to-determine-how-long-splunk-has-been-up/m-p/87762#M7388</guid>
      <dc:creator>sowings</dc:creator>
      <dc:date>2013-10-08T16:16:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine how long splunk has been up?</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/How-to-determine-how-long-splunk-has-been-up/m-p/87763#M7389</link>
      <description>&lt;P&gt;I know I'm ressurecting an old question, but the search is useful.&lt;/P&gt;

&lt;P&gt;Except for one thing...&lt;/P&gt;

&lt;P&gt;If you don't exclude a specific sourcetype, you get results for your searches looking for "splunkd started". Which might confuse things.&lt;BR /&gt;
So&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal "splunkd started" NOT sourcetype=splunkd_remote_searches
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope that helps someone.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2016 11:42:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/How-to-determine-how-long-splunk-has-been-up/m-p/87763#M7389</guid>
      <dc:creator>tiny3001</dc:creator>
      <dc:date>2016-10-26T11:42:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine how long splunk has been up?</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/How-to-determine-how-long-splunk-has-been-up/m-p/87764#M7390</link>
      <description>&lt;P&gt;You can use the rest API to get this information. Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rest /services/server/info | eval LastStartupTime=strftime(startup_time, "%Y/%m/%d  %H:%M:%S")
| eval timenow=now()
| eval daysup = round((timenow - startup_time) / 86400,0)
| eval Uptime = tostring(daysup) + " Days"
| table splunk_server LastStartupTime Uptime
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Nov 2016 00:41:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/How-to-determine-how-long-splunk-has-been-up/m-p/87764#M7390</guid>
      <dc:creator>wrangler2x</dc:creator>
      <dc:date>2016-11-29T00:41:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine how long splunk has been up?</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/How-to-determine-how-long-splunk-has-been-up/m-p/87765#M7391</link>
      <description>&lt;P&gt;I downvoted this post because did not work&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2017 19:41:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/How-to-determine-how-long-splunk-has-been-up/m-p/87765#M7391</guid>
      <dc:creator>Sayanta_Basak_I</dc:creator>
      <dc:date>2017-06-14T19:41:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine how long splunk has been up?</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/How-to-determine-how-long-splunk-has-been-up/m-p/87766#M7392</link>
      <description>&lt;P&gt;This is the answer that should be accepted, IMO, @wrangler2x.  The others, especially the one from @tiny3301, work, but only if Splunk was restarted recently.  Once the logs have rolled enough times, the "splunkd started" message won't be found.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Nov 2017 17:08:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/How-to-determine-how-long-splunk-has-been-up/m-p/87766#M7392</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2017-11-27T17:08:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine how long splunk has been up?</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/How-to-determine-how-long-splunk-has-been-up/m-p/87767#M7393</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| rest / services/server/info 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This only shows indexers.  What's the REST endpoint for startup time of all &lt;EM&gt;Universal Forwarders&lt;/EM&gt;?&lt;/P&gt;</description>
      <pubDate>Mon, 10 Sep 2018 18:32:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/How-to-determine-how-long-splunk-has-been-up/m-p/87767#M7393</guid>
      <dc:creator>dijikul</dc:creator>
      <dc:date>2018-09-10T18:32:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine how long splunk has been up?</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/How-to-determine-how-long-splunk-has-been-up/m-p/87768#M7394</link>
      <description>&lt;P&gt;This only works when your logs stretch far enough back to catch the startup.&lt;/P&gt;

&lt;P&gt;If your forwarders stay online long enough, the logs roll and you lose the data, which is why the REST approach is supposedly better, however I'm having trouble making that work in our Hybrid environment, personally.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Sep 2018 18:48:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/How-to-determine-how-long-splunk-has-been-up/m-p/87768#M7394</guid>
      <dc:creator>dijikul</dc:creator>
      <dc:date>2018-09-10T18:48:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine how long splunk has been up?</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/How-to-determine-how-long-splunk-has-been-up/m-p/87769#M7395</link>
      <description>&lt;P&gt;It also did not work because it had &lt;CODE&gt;| field&lt;/CODE&gt; instead of &lt;CODE&gt;| fields&lt;/CODE&gt; but I just fixed that.&lt;/P&gt;</description>
      <pubDate>Sun, 02 Jun 2019 23:36:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/How-to-determine-how-long-splunk-has-been-up/m-p/87769#M7395</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-06-02T23:36:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine how long splunk has been up?</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/How-to-determine-how-long-splunk-has-been-up/m-p/87770#M7396</link>
      <description>&lt;P&gt;This is a refinement of the answers by @lguinn2 and @tiny3001 (&lt;STRONG&gt;NOTE&lt;/STRONG&gt;: you will have to edit the &lt;CODE&gt;host=&lt;/CODE&gt; part):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal "splunkd started" AND NOT sourcetype=splunkd_remote_searches AND host=*-spl-*
| dedup host
| eval uptime = tostring(now() - _time,"duration")
| table host uptime
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 02 Jun 2019 23:38:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/How-to-determine-how-long-splunk-has-been-up/m-p/87770#M7396</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-06-02T23:38:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine how long splunk has been up?</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/How-to-determine-how-long-splunk-has-been-up/m-p/526375#M7397</link>
      <description>&lt;P&gt;For this to work, you need to set time long enough to catch the restart.&amp;nbsp; With a big solution with many server and lots of logs, this will be slow to find.&lt;/P&gt;</description>
      <pubDate>Sun, 25 Oct 2020 18:34:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/How-to-determine-how-long-splunk-has-been-up/m-p/526375#M7397</guid>
      <dc:creator>lakromani</dc:creator>
      <dc:date>2020-10-25T18:34:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine how long splunk has been up?</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/How-to-determine-how-long-splunk-has-been-up/m-p/526381#M7398</link>
      <description>You probably need to extend the retention time for _internal to get those events stored enough long to find them. In general case the rest is better for full splunk enterprise instances. Of course this requires that you haven’t disable rest on HF layer. For UF the only solution is store those events to internal for enough long time.</description>
      <pubDate>Sun, 25 Oct 2020 20:30:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/How-to-determine-how-long-splunk-has-been-up/m-p/526381#M7398</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2020-10-25T20:30:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine how long splunk has been up?</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/How-to-determine-how-long-splunk-has-been-up/m-p/593374#M8893</link>
      <description>&lt;P&gt;Just happened to be looking for this very thing today and stumbled across submission. I wouldn't have thought to query the REST API for this without checking here first, but it seemed a little obvious after reading the accepted solution -- that's what I love about strong user communities.&lt;/P&gt;&lt;P&gt;For what it's worth, here's my own slightly more direct SPL that produces roughly the same results as the accepted answer in case it helps anyone else.&lt;/P&gt;&lt;PRE&gt;| rest splunk_server=local /services/server/info &lt;BR /&gt;| eval uptime=tostring(now() - startup_time, "duration") &lt;BR /&gt;| convert ctime(startup_time) &lt;BR /&gt;| table splunk_server, startup_time, uptime&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Apr 2022 01:25:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/How-to-determine-how-long-splunk-has-been-up/m-p/593374#M8893</guid>
      <dc:creator>robfrey</dc:creator>
      <dc:date>2022-04-12T01:25:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine how long splunk has been up?</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/How-to-determine-how-long-splunk-has-been-up/m-p/593375#M8894</link>
      <description>&lt;P&gt;I should have included that the SPL I provided is only searching the REST API of the search head executing the search (splunk_server=localhost) which can easily be removed if desired&lt;/P&gt;</description>
      <pubDate>Tue, 12 Apr 2022 01:30:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/How-to-determine-how-long-splunk-has-been-up/m-p/593375#M8894</guid>
      <dc:creator>robfrey</dc:creator>
      <dc:date>2022-04-12T01:30:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine how long splunk has been up?</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/How-to-determine-how-long-splunk-has-been-up/m-p/660379#M9842</link>
      <description>&lt;P&gt;Try this one:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;index=_internal "Splunkd starting" sourcetype=splunkd component=loader AND host=* 
| append 
    [| search index=_internal "splunkd started" sourcetype=splunkd_stderr AND host=* 
        ] 
| eval st_{sourcetype}=1 
| stats count sum(st_*) AS * earliest(_time) AS firstTime latest(_time) AS lastTime BY host 
| eval uptime = tostring(now() - lastTime,"duration") 
| foreach *Time 
    [| eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;=strftime(&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;,"%Y-%m-%d %H:%M:%S")
        ] 
| table host count firstTime lastTime uptime *&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 11 Oct 2023 10:54:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/How-to-determine-how-long-splunk-has-been-up/m-p/660379#M9842</guid>
      <dc:creator>BDein</dc:creator>
      <dc:date>2023-10-11T10:54:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine how long splunk has been up?</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/How-to-determine-how-long-splunk-has-been-up/m-p/660642#M9844</link>
      <description>As it has said earlier all queries from _internal logs works only if you have those still on indexers. Quite often retention time for those is so short that you haven't those on any larger environment!</description>
      <pubDate>Fri, 13 Oct 2023 10:28:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/How-to-determine-how-long-splunk-has-been-up/m-p/660642#M9844</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2023-10-13T10:28:34Z</dc:date>
    </item>
  </channel>
</rss>

