<?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: What will this query do? (This is a saved search running on cron *****) in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/What-will-this-query-do-This-is-a-saved-search-running-on-cron/m-p/470474#M132364</link>
    <description>&lt;P&gt;it will&lt;/P&gt;

&lt;P&gt;find events&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=os sourcetype=splunk_health_check 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;calculate some additional fields, value, message, status and score, drop other fields, and add the search-head name&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|eval value=delay_status |eval message=if(status=="OK","",status) |eval status=if(status=="OK",status,"NG") |eval score=if(value==99,-1,value) |table _time sh status score message |rename sh to searchhead
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and add a condition to drop all the events that do not meet the condition on score ,status and message&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; |search score&amp;lt;5 AND status!="OK" message!="*No error" AND message!="Proxy Error"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 13 Nov 2019 22:05:52 GMT</pubDate>
    <dc:creator>yannK</dc:creator>
    <dc:date>2019-11-13T22:05:52Z</dc:date>
    <item>
      <title>What will this query do? (This is a saved search running on cron *****)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-will-this-query-do-This-is-a-saved-search-running-on-cron/m-p/470472#M132362</link>
      <description>&lt;P&gt;Hi&lt;BR /&gt;
Please help me understand what will this saved search do?&lt;/P&gt;

&lt;P&gt;index=os sourcetype=splunk_health_check |eval value=delay_status |eval message=if(status=="OK","",status) |eval status=if(status=="OK",status,"NG") |eval score=if(value==99,-1,value) |table _time sh status score message |rename sh to searchhead |search score&amp;lt;5 AND status!="OK" message!="*No error" AND message!="Proxy Error"&lt;/P&gt;

&lt;P&gt;source is a script.&lt;/P&gt;

&lt;P&gt;for HOST in ${HOSTS}&lt;BR /&gt;
do&lt;BR /&gt;
  URI=http://${HOST}:80&lt;BR /&gt;
  count=99&lt;BR /&gt;
  result=&lt;CODE&gt;/opt/splunk/bin/splunk search "index=${INDEX} sourcetype=${SOURCETYPE} SPLUNK_HEALTH_CHECK |stats count" -earliest_time ${EARLIEST} -latest_time ${LATEST} -uri ${URI} -auth ${USER}:${PASS} -preview F -output csv -timeout ${TIMEOUT} 2&amp;gt;&amp;amp;1 |grep -v count |tr -d '\n' |sed 's/"//g'&lt;/CODE&gt;&lt;BR /&gt;
  if expr $result : '[0-9]*' &amp;gt; /dev/null 2&amp;gt;&amp;amp;1; then&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;count=$result
result="OK"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;fi&lt;BR /&gt;
  date +"%Y-%m-%d %T sh=${HOST} status=\"${result}\" delay_status=$count"&lt;BR /&gt;
done&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 02:45:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-will-this-query-do-This-is-a-saved-search-running-on-cron/m-p/470472#M132362</guid>
      <dc:creator>muizash</dc:creator>
      <dc:date>2020-09-30T02:45:23Z</dc:date>
    </item>
    <item>
      <title>Re: What will this query do? (This is a saved search running on cron *****)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-will-this-query-do-This-is-a-saved-search-running-on-cron/m-p/470473#M132363</link>
      <description>&lt;P&gt;for HOST in ${HOSTS}&lt;BR /&gt;
do&lt;BR /&gt;
  URI=http://${HOST}:80&lt;BR /&gt;
  count=99&lt;BR /&gt;
  result=&lt;CODE&gt;/opt/splunk/bin/splunk search "index=${INDEX} sourcetype=${SOURCETYPE} SPLUNK_HEALTH_CHECK |stats count" -earliest_time ${EARLIEST} -latest_time ${LATEST} -uri ${URI} -auth ${USER}:${PASS} -preview F -output csv -timeout ${TIMEOUT} 2&amp;gt;&amp;amp;1 |grep -v count |tr -d '\n' |sed 's/"//g'&lt;/CODE&gt;&lt;BR /&gt;
  if expr $result : '[0-9]*' &amp;gt; /dev/null 2&amp;gt;&amp;amp;1; then&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;count=$result
result="OK"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;fi&lt;BR /&gt;
  date +"%Y-%m-%d %T sh=${HOST} status=\"${result}\" delay_status=$count"&lt;BR /&gt;
done&lt;/P&gt;</description>
      <pubDate>Mon, 28 Oct 2019 03:41:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-will-this-query-do-This-is-a-saved-search-running-on-cron/m-p/470473#M132363</guid>
      <dc:creator>muizash</dc:creator>
      <dc:date>2019-10-28T03:41:03Z</dc:date>
    </item>
    <item>
      <title>Re: What will this query do? (This is a saved search running on cron *****)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-will-this-query-do-This-is-a-saved-search-running-on-cron/m-p/470474#M132364</link>
      <description>&lt;P&gt;it will&lt;/P&gt;

&lt;P&gt;find events&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=os sourcetype=splunk_health_check 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;calculate some additional fields, value, message, status and score, drop other fields, and add the search-head name&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|eval value=delay_status |eval message=if(status=="OK","",status) |eval status=if(status=="OK",status,"NG") |eval score=if(value==99,-1,value) |table _time sh status score message |rename sh to searchhead
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and add a condition to drop all the events that do not meet the condition on score ,status and message&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; |search score&amp;lt;5 AND status!="OK" message!="*No error" AND message!="Proxy Error"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Nov 2019 22:05:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-will-this-query-do-This-is-a-saved-search-running-on-cron/m-p/470474#M132364</guid>
      <dc:creator>yannK</dc:creator>
      <dc:date>2019-11-13T22:05:52Z</dc:date>
    </item>
  </channel>
</rss>

