<?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 subtract one week from the current week in a report name? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-one-week-from-the-current-week-in-a-report-name/m-p/584860#M203739</link>
    <description>&lt;P&gt;Something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;|makeresults
| eval report_day="2022/02/11"
| eval previous_report_day = strftime(relative_time(strptime(report_day, "%Y/%m/%d"), "-7days"), "%Y/%m/%d")
| eval report_week = strftime(strptime(report_day, "%Y/%m/%d"), "%u")
| eval previous_report_week = report_week - 1&lt;/LI-CODE&gt;</description>
    <pubDate>Sat, 12 Feb 2022 19:35:51 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2022-02-12T19:35:51Z</dc:date>
    <item>
      <title>How to subtract one week from the current week in a report name?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-one-week-from-the-current-week-in-a-report-name/m-p/584708#M203684</link>
      <description>&lt;P&gt;Hello everybody,&lt;/P&gt;
&lt;P&gt;I have a report that is generated every week.&lt;/P&gt;
&lt;P&gt;I want to name the title of the report with the previous week number.&lt;/P&gt;
&lt;P&gt;I use the&amp;nbsp;«&amp;nbsp;action.email.reportFileName&amp;nbsp;» field to choose the report generate name&lt;/P&gt;
&lt;P&gt;For example :.&lt;/P&gt;
&lt;P&gt;We are the 2022/02/11&amp;nbsp; which is 6th week of the year.&lt;/P&gt;
&lt;P&gt;The report is scheduled today but I want to mention the W-1 week -&amp;gt; so the number 5.&lt;/P&gt;
&lt;P&gt;I identified that with the variable %V I can dynamically generate the name of the report with the current week.&lt;/P&gt;
&lt;P&gt;I'm looking for a trick to put the number of the past week&lt;/P&gt;
&lt;P&gt;If someone has a solution please&lt;/P&gt;
&lt;P&gt;Kind regards !&lt;/P&gt;</description>
      <pubDate>Fri, 11 Feb 2022 17:43:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-one-week-from-the-current-week-in-a-report-name/m-p/584708#M203684</guid>
      <dc:creator>VeloCiraptor</dc:creator>
      <dc:date>2022-02-11T17:43:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to subtract one week from the current week in a report name?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-one-week-from-the-current-week-in-a-report-name/m-p/584820#M203719</link>
      <description>&lt;P&gt;Like this?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval lastweek = tonumber(strftime(_time, "%V")) - 1&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 12 Feb 2022 02:04:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-one-week-from-the-current-week-in-a-report-name/m-p/584820#M203719</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-02-12T02:04:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to subtract one week from the current week in a report name?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-one-week-from-the-current-week-in-a-report-name/m-p/584830#M203724</link>
      <description>&lt;P&gt;Might not work very well across the year's beginning.&lt;/P&gt;&lt;P&gt;Could use modulo 52 or offestting back one week before doing strftime.&lt;/P&gt;&lt;P&gt;Another possible issue - what about a week 53/0 (end of last year, beginning of current one) - how should it be counted?&lt;/P&gt;</description>
      <pubDate>Sat, 12 Feb 2022 06:15:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-one-week-from-the-current-week-in-a-report-name/m-p/584830#M203724</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-02-12T06:15:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to subtract one week from the current week in a report name?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-one-week-from-the-current-week-in-a-report-name/m-p/584860#M203739</link>
      <description>&lt;P&gt;Something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;|makeresults
| eval report_day="2022/02/11"
| eval previous_report_day = strftime(relative_time(strptime(report_day, "%Y/%m/%d"), "-7days"), "%Y/%m/%d")
| eval report_week = strftime(strptime(report_day, "%Y/%m/%d"), "%u")
| eval previous_report_week = report_week - 1&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 12 Feb 2022 19:35:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-one-week-from-the-current-week-in-a-report-name/m-p/584860#M203739</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2022-02-12T19:35:51Z</dc:date>
    </item>
  </channel>
</rss>

