<?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 How can i remove weekends from Log Times in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/How-can-i-remove-weekends-from-Log-Times/m-p/349089#M5547</link>
    <description>&lt;P&gt;Hi Team,&lt;/P&gt;

&lt;P&gt;I have a scenario where the data is feeded into index on regular basis which consists of Date fields , i want to remove weekends from that date fields . How can i achieve this. for example i am having date field1 and date field2, i am subtracting field1 from field2 and getting the difference in number of days, from this result i need to exclude weekends [Saturday and Sundays]. Please help me how can i acheive this&lt;/P&gt;</description>
    <pubDate>Sat, 05 Aug 2017 14:24:33 GMT</pubDate>
    <dc:creator>c_krishna_gutur</dc:creator>
    <dc:date>2017-08-05T14:24:33Z</dc:date>
    <item>
      <title>How can i remove weekends from Log Times</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-can-i-remove-weekends-from-Log-Times/m-p/349089#M5547</link>
      <description>&lt;P&gt;Hi Team,&lt;/P&gt;

&lt;P&gt;I have a scenario where the data is feeded into index on regular basis which consists of Date fields , i want to remove weekends from that date fields . How can i achieve this. for example i am having date field1 and date field2, i am subtracting field1 from field2 and getting the difference in number of days, from this result i need to exclude weekends [Saturday and Sundays]. Please help me how can i acheive this&lt;/P&gt;</description>
      <pubDate>Sat, 05 Aug 2017 14:24:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-can-i-remove-weekends-from-Log-Times/m-p/349089#M5547</guid>
      <dc:creator>c_krishna_gutur</dc:creator>
      <dc:date>2017-08-05T14:24:33Z</dc:date>
    </item>
    <item>
      <title>Re: How can i remove weekends from Log Times</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-can-i-remove-weekends-from-Log-Times/m-p/349090#M5548</link>
      <description>&lt;P&gt;The solution you choose has a lot to do with how you have ingested your data and what fields are extracted. &lt;/P&gt;

&lt;P&gt;When the sourcetype is properly extracting a timestamp, Splunk can identify a day field called date_wday. &lt;/P&gt;

&lt;P&gt;If you have this field you can filter these days out in your search with something like &lt;CODE&gt;NOT (date_wday=Saturday OR date_wday=Sunday)&lt;/CODE&gt; &lt;/P&gt;

&lt;P&gt;A lot will depend on your sourcetype configuration in props.conf, so if you share a sample event we can assist further&lt;/P&gt;</description>
      <pubDate>Sat, 05 Aug 2017 16:41:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-can-i-remove-weekends-from-Log-Times/m-p/349090#M5548</guid>
      <dc:creator>mattymo</dc:creator>
      <dc:date>2017-08-05T16:41:36Z</dc:date>
    </item>
    <item>
      <title>Re: How can i remove weekends from Log Times</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-can-i-remove-weekends-from-Log-Times/m-p/349091#M5549</link>
      <description>&lt;P&gt;Sounds like the question you really want to ask is "how do I count the number of weekdays between Date1 and Date2?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval Day1=strftime(Date1,"%w")
| eval Day2=strftime(Date2,"%w")
| eval DaysBetween = (5*floor((Date2-Date1)/86400/7))+if(Day1&amp;lt;Day2,Day2-Day1,5+Day2-Day1)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This translates as 1-2) tell me what day of the week 0-7 each day is, &lt;BR /&gt;
3) Calculate 5 days for each full 7 days, plus the difference between the start and end days, adding 5 if the end day is earlier in the week than the start day.&lt;/P&gt;

&lt;P&gt;I'm assuming that you are NOT counting both days, so for example the number of days between Tuesday and Thursday is 2.  If you want that to be 3 instead, then add 1 more.&lt;/P&gt;

&lt;P&gt;I'm also assuming that the endpoints will never be on weekends, and you don't care about holidays.  If those aren't true, it will have to be a lot more complex.&lt;/P&gt;</description>
      <pubDate>Sat, 05 Aug 2017 19:57:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-can-i-remove-weekends-from-Log-Times/m-p/349091#M5549</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-08-05T19:57:10Z</dc:date>
    </item>
  </channel>
</rss>

