<?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: To check logs and the status in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/To-check-logs-and-the-status/m-p/470104#M192105</link>
    <description>&lt;P&gt;Thanks @anthonymelita &lt;/P&gt;

&lt;P&gt;I will try this.&lt;BR /&gt;
But could yu pls explain how is relative time helping here.&lt;BR /&gt;
Relative time is basically dependant on the time the search is run..&lt;BR /&gt;
But in the above query,now() always takes the value of the current time the search is run and not on the time for which the search is run.&lt;/P&gt;</description>
    <pubDate>Wed, 03 Jun 2020 08:12:53 GMT</pubDate>
    <dc:creator>prettysunshinez</dc:creator>
    <dc:date>2020-06-03T08:12:53Z</dc:date>
    <item>
      <title>To check logs and the status</title>
      <link>https://community.splunk.com/t5/Splunk-Search/To-check-logs-and-the-status/m-p/470102#M192103</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
I would like to run a search,which gives me the list of host with status' - normal,warning and critical&lt;BR /&gt;
Where Critical being logs not present in a host for 30 mins,warning - not present in 15 mins and but lesser than 30 mins and otherwise its normal.&lt;BR /&gt;
Am facing 2 problems here,if a server has no logs for 2 days,and when i run a search today,my search is not showing up that host itself.&lt;BR /&gt;
Another problem is that when change my time modifier to issue time,it is not showing the exact result.&lt;/P&gt;

&lt;P&gt;Below is the query used.&lt;/P&gt;

&lt;P&gt;index = abc* host=efg* &lt;BR /&gt;
|stats latest(_time) as latest by host &lt;BR /&gt;
|eval Status = case (latest &amp;lt;= relative_time(now(),"-15m") AND latest &amp;gt; relative_time(now(),"-30m"),"Warning", &lt;BR /&gt;
latest &amp;lt;= relative_time(now(),"-30m"),"Critical",&lt;BR /&gt;
true(),"Normal")&lt;BR /&gt;
|eval Recent_Updated_Time = strftime(latest,"%c") &lt;/P&gt;

&lt;P&gt;Kindly suggest&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 05:36:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/To-check-logs-and-the-status/m-p/470102#M192103</guid>
      <dc:creator>prettysunshinez</dc:creator>
      <dc:date>2020-09-30T05:36:31Z</dc:date>
    </item>
    <item>
      <title>Re: To check logs and the status</title>
      <link>https://community.splunk.com/t5/Splunk-Search/To-check-logs-and-the-status/m-p/470103#M192104</link>
      <description>&lt;P&gt;Metadata search should be faster, and capture hosts without recent events. Otherwise you may need to use a lookup to define your list of hosts.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| metadata type=hosts index=abc*
| search host=efg*
| eval warn=relative_time(now(), "-15m")
| eval crit=relative_time(now(), "-30m")
| eval status=case(recentTime &amp;gt;= warn, "Normal", recentTime &amp;lt; warn AND recentTime &amp;gt;= crit, "Warning", recentTime &amp;lt; crit, "Critical", 1==1, "Undefined")
| table host recentTime status totalCount
| eval recentTime=strftime(recentTime, "%c") ]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Jun 2020 23:48:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/To-check-logs-and-the-status/m-p/470103#M192104</guid>
      <dc:creator>anthonymelita</dc:creator>
      <dc:date>2020-06-02T23:48:44Z</dc:date>
    </item>
    <item>
      <title>Re: To check logs and the status</title>
      <link>https://community.splunk.com/t5/Splunk-Search/To-check-logs-and-the-status/m-p/470104#M192105</link>
      <description>&lt;P&gt;Thanks @anthonymelita &lt;/P&gt;

&lt;P&gt;I will try this.&lt;BR /&gt;
But could yu pls explain how is relative time helping here.&lt;BR /&gt;
Relative time is basically dependant on the time the search is run..&lt;BR /&gt;
But in the above query,now() always takes the value of the current time the search is run and not on the time for which the search is run.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2020 08:12:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/To-check-logs-and-the-status/m-p/470104#M192105</guid>
      <dc:creator>prettysunshinez</dc:creator>
      <dc:date>2020-06-03T08:12:53Z</dc:date>
    </item>
  </channel>
</rss>

