<?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: Compare the time for the execution in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Compare-the-time-for-the-execution/m-p/226050#M44192</link>
    <description>&lt;P&gt;@samesoni2&lt;/P&gt;

&lt;P&gt;%d/%m/%y %H:%M:%s &lt;/P&gt;</description>
    <pubDate>Wed, 10 Aug 2016 23:28:51 GMT</pubDate>
    <dc:creator>praveenkpatidar</dc:creator>
    <dc:date>2016-08-10T23:28:51Z</dc:date>
    <item>
      <title>Compare the time for the execution</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Compare-the-time-for-the-execution/m-p/226048#M44190</link>
      <description>&lt;P&gt;Hello Champions,&lt;/P&gt;

&lt;P&gt;I come across a very complex logic to tag jobs on its start time. &lt;/P&gt;

&lt;P&gt;We have one calculated value, it can be Weekly or Daily based on Job Run start time. &lt;/P&gt;

&lt;P&gt;Weekly= If the Job Start time is Saturday 4AM to Monday 6:PM&lt;BR /&gt;
Daily = for remaining days in week. &lt;/P&gt;

&lt;P&gt;If its date comparison we can easily do that. we can have cascaded  if then else to check days and then time. Is there any smart way to do that ? &lt;/P&gt;

&lt;P&gt;Thanks &lt;BR /&gt;
Praveen&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2016 23:16:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Compare-the-time-for-the-execution/m-p/226048#M44190</guid>
      <dc:creator>praveenkpatidar</dc:creator>
      <dc:date>2016-08-10T23:16:19Z</dc:date>
    </item>
    <item>
      <title>Re: Compare the time for the execution</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Compare-the-time-for-the-execution/m-p/226049#M44191</link>
      <description>&lt;P&gt;What is the format of field job start time?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2016 23:22:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Compare-the-time-for-the-execution/m-p/226049#M44191</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-08-10T23:22:55Z</dc:date>
    </item>
    <item>
      <title>Re: Compare the time for the execution</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Compare-the-time-for-the-execution/m-p/226050#M44192</link>
      <description>&lt;P&gt;@samesoni2&lt;/P&gt;

&lt;P&gt;%d/%m/%y %H:%M:%s &lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2016 23:28:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Compare-the-time-for-the-execution/m-p/226050#M44192</guid>
      <dc:creator>praveenkpatidar</dc:creator>
      <dc:date>2016-08-10T23:28:51Z</dc:date>
    </item>
    <item>
      <title>Re: Compare the time for the execution</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Compare-the-time-for-the-execution/m-p/226051#M44193</link>
      <description>&lt;P&gt;I think the answer should be &lt;/P&gt;

&lt;P&gt;Convert the number of week and time in 24 hour. Combine them %w%H&lt;/P&gt;

&lt;P&gt;if its more then 604(Saturday04AM) and less then 218(Monday6PM) then its weekly. &lt;BR /&gt;
Else its daily&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2016 23:32:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Compare-the-time-for-the-execution/m-p/226051#M44193</guid>
      <dc:creator>praveenkpatidar</dc:creator>
      <dc:date>2016-08-10T23:32:14Z</dc:date>
    </item>
    <item>
      <title>Re: Compare the time for the execution</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Compare-the-time-for-the-execution/m-p/226052#M44194</link>
      <description>&lt;P&gt;Assuming this is a scheduled job that runs at different time, try add this to your search. If job start time is a field in you data, you can replace the &lt;CODE&gt;now()&lt;/CODE&gt; with &lt;CODE&gt;strptime&lt;/CODE&gt; of field&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search |  eval tag=if(now()&amp;gt;relative_time(now(), "@w6+4h") AND now()&amp;lt;relative_time(now(), "@w1+6h"), "Weekly", "Daily")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Aug 2016 23:34:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Compare-the-time-for-the-execution/m-p/226052#M44194</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-08-10T23:34:16Z</dc:date>
    </item>
    <item>
      <title>Re: Compare the time for the execution</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Compare-the-time-for-the-execution/m-p/226053#M44195</link>
      <description>&lt;P&gt;Assuming the field name is job_start_date and it's value is string. try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | eval job_start_epoch=strptime(job_start_date,"%d/%m/%y %H:%M:%S") | eval dayOfWeek=lower(strftime(job_start_epoch,"%a")) | eval hour=tonumber(strftime(job_start_epoch,"%H") ) 
eval Type=if(dayOfWeek="sun" OR (dayOfWeek="sat" AND hour&amp;gt;=4) OR (dayOfWeek="mon" AND hour&amp;lt;=16 ),"Weekly","Daily"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 10:35:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Compare-the-time-for-the-execution/m-p/226053#M44195</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-09-29T10:35:04Z</dc:date>
    </item>
  </channel>
</rss>

