<?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 do i create new field with last day of reporting period to my search? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-i-create-new-field-with-last-day-of-reporting-period-to/m-p/510894#M143079</link>
    <description>&lt;P&gt;I have a report which runs every week on Monday , I'm using earliest and latest time in my search .&amp;nbsp; Now I wanted to add a new field to my search called lastdate say if a report period is between 07/01 to 07/07 the lastdate field should display 07/07 and For my monthly report how do I create new field called MonthEnd and this&amp;nbsp; should displays the values as June 30 for month ending date, Please help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 24 Jul 2020 20:03:42 GMT</pubDate>
    <dc:creator>iamsplunker</dc:creator>
    <dc:date>2020-07-24T20:03:42Z</dc:date>
    <item>
      <title>How do i create new field with last day of reporting period to my search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-i-create-new-field-with-last-day-of-reporting-period-to/m-p/510894#M143079</link>
      <description>&lt;P&gt;I have a report which runs every week on Monday , I'm using earliest and latest time in my search .&amp;nbsp; Now I wanted to add a new field to my search called lastdate say if a report period is between 07/01 to 07/07 the lastdate field should display 07/07 and For my monthly report how do I create new field called MonthEnd and this&amp;nbsp; should displays the values as June 30 for month ending date, Please help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jul 2020 20:03:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-i-create-new-field-with-last-day-of-reporting-period-to/m-p/510894#M143079</guid>
      <dc:creator>iamsplunker</dc:creator>
      <dc:date>2020-07-24T20:03:42Z</dc:date>
    </item>
    <item>
      <title>Re: How do i create new field with last day of reporting period to my search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-i-create-new-field-with-last-day-of-reporting-period-to/m-p/510897#M143080</link>
      <description>&lt;LI-CODE lang="markup"&gt;earliest="07/01/2020:00:00:00" latest="07/07/2020:23:59:59" index=_internal | head 1
| addinfo
| eval lastdate=strftime(info_max_time,"%F")
| eval MonthEnd=strftime(relative_time(info_min_time,"@month-1d"),"%F")
| table lastdate MonthEnd&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 24 Jul 2020 20:24:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-i-create-new-field-with-last-day-of-reporting-period-to/m-p/510897#M143080</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-07-24T20:24:49Z</dc:date>
    </item>
    <item>
      <title>Re: How do i create new field with last day of reporting period to my search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-i-create-new-field-with-last-day-of-reporting-period-to/m-p/510898#M143081</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;add to your stats&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;| stats .... latest(_time) as lastDay range(_time) AS dateRange ....
| eval lastDayOfMonth = strftime (lastDay, "%B %d"),
       lastDay = strftime (lastDay, "%d/%m"),
       reportPeriod = if (dateRange &amp;gt; 604800, "Monthly", "Weekly") ....&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and then use those fields lastDay and lastDayOfMonth.&lt;/P&gt;&lt;P&gt;r. Ismo&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jul 2020 15:25:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-i-create-new-field-with-last-day-of-reporting-period-to/m-p/510898#M143081</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2020-07-27T15:25:11Z</dc:date>
    </item>
    <item>
      <title>Re: How do i create new field with last day of reporting period to my search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-i-create-new-field-with-last-day-of-reporting-period-to/m-p/511140#M143164</link>
      <description>&lt;P&gt;Thanks Sautamo the lastday field works just fine. But I also want to add a field called Report Period the value should represent the Week/Month depending on the granularity of the report.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jul 2020 14:58:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-i-create-new-field-with-last-day-of-reporting-period-to/m-p/511140#M143164</guid>
      <dc:creator>iamsplunker</dc:creator>
      <dc:date>2020-07-27T14:58:37Z</dc:date>
    </item>
    <item>
      <title>Re: How do i create new field with last day of reporting period to my search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-i-create-new-field-with-last-day-of-reporting-period-to/m-p/511152#M143169</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I updated my previous answer by adding reportPeriod.&lt;/P&gt;&lt;P&gt;r. Ismo&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jul 2020 15:26:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-i-create-new-field-with-last-day-of-reporting-period-to/m-p/511152#M143169</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2020-07-27T15:26:02Z</dc:date>
    </item>
    <item>
      <title>Re: How do i create new field with last day of reporting period to my search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-i-create-new-field-with-last-day-of-reporting-period-to/m-p/511196#M143186</link>
      <description>&lt;P&gt;Thanks soutamo. I accepted your answer. I hope this is the last comment in this thread. Can you please explain about&amp;nbsp; the value you've mentioned&amp;nbsp; 604800 . For both date ranges 6/1 -6/7 and 6/1-6/30 it is showing the Granularity as Weekly. for 6/1-6/30 it should show as Monthly. Thanks for all your help&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jul 2020 18:04:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-i-create-new-field-with-last-day-of-reporting-period-to/m-p/511196#M143186</guid>
      <dc:creator>iamsplunker</dc:creator>
      <dc:date>2020-07-27T18:04:14Z</dc:date>
    </item>
    <item>
      <title>Re: How do i create new field with last day of reporting period to my search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-i-create-new-field-with-last-day-of-reporting-period-to/m-p/511203#M143189</link>
      <description>&lt;P&gt;It is seven days in seconds. Current stats needs that there are events (_time) for start and end date/time. Of course you could use those from your given start and end dates where this would works even there haven’t been any events.&amp;nbsp;&lt;BR /&gt;r. Ismo&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jul 2020 18:47:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-i-create-new-field-with-last-day-of-reporting-period-to/m-p/511203#M143189</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2020-07-27T18:47:19Z</dc:date>
    </item>
  </channel>
</rss>

