<?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: Today date and previous day data in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Today-date-and-previous-day-data/m-p/525401#M148263</link>
    <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/70277"&gt;@uagraw01&lt;/a&gt;&amp;nbsp;just curious - earliest and latest variables are ok or not ok?&lt;/P&gt;</description>
    <pubDate>Mon, 19 Oct 2020 15:41:27 GMT</pubDate>
    <dc:creator>inventsekar</dc:creator>
    <dc:date>2020-10-19T15:41:27Z</dc:date>
    <item>
      <title>Today date and previous day data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Today-date-and-previous-day-data/m-p/525386#M148252</link>
      <description>&lt;P&gt;I want to calculate todays date data and previous day data from the host. Please suggest SPL for this.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Oct 2020 14:46:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Today-date-and-previous-day-data/m-p/525386#M148252</guid>
      <dc:creator>uagraw01</dc:creator>
      <dc:date>2020-10-19T14:46:23Z</dc:date>
    </item>
    <item>
      <title>Re: Today date and previous day data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Today-date-and-previous-day-data/m-p/525390#M148255</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/70277"&gt;@uagraw01&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;see if this example solves your need:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=_internal
| eval day=if(date_year=strftime(now(),"%Y") AND date_month=lower(strftime(now(),"%B")) AND date_mday=strftime(now(),"%d"),"Today","Previous")
| stats count BY day&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 19 Oct 2020 15:09:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Today-date-and-previous-day-data/m-p/525390#M148255</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-10-19T15:09:36Z</dc:date>
    </item>
    <item>
      <title>Re: Today date and previous day data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Today-date-and-previous-day-data/m-p/525401#M148263</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/70277"&gt;@uagraw01&lt;/a&gt;&amp;nbsp;just curious - earliest and latest variables are ok or not ok?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Oct 2020 15:41:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Today-date-and-previous-day-data/m-p/525401#M148263</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2020-10-19T15:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: Today date and previous day data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Today-date-and-previous-day-data/m-p/525577#M148331</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp; I want the difference between pervious day count of the host and current day count of the host. I want comparison panel in my dashboard&lt;/P&gt;</description>
      <pubDate>Tue, 20 Oct 2020 14:27:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Today-date-and-previous-day-data/m-p/525577#M148331</guid>
      <dc:creator>uagraw01</dc:creator>
      <dc:date>2020-10-20T14:27:19Z</dc:date>
    </item>
    <item>
      <title>Re: Today date and previous day data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Today-date-and-previous-day-data/m-p/525579#M148332</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/70277"&gt;@uagraw01&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;as I said, I don't know in deep your need, but you can use my approach.&lt;/P&gt;&lt;P&gt;so using a search like mine you can display the count of events of today and previous day so you can compare the two numbers.&lt;/P&gt;&lt;P&gt;If you want more help, you should share more infos, e.g.:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;what's you main search&lt;/LI&gt;&lt;LI&gt;which count you want to compare (e.g. numer of hosts).&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;so if you want to display the diference in numer of logging hosts between today and yesterday, you could run something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=_internal earliest=-d@d latest=now
| eval day=if(date_year=strftime(now(),"%Y") AND date_month=lower(strftime(now(),"%B")) AND date_mday=strftime(now(),"%d"),"Today","Previous")
| stats dc(host) AS hosts BY day
| delta hosts AS diff
| table diff&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 20 Oct 2020 14:38:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Today-date-and-previous-day-data/m-p/525579#M148332</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-10-20T14:38:20Z</dc:date>
    </item>
    <item>
      <title>Re: Today date and previous day data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Today-date-and-previous-day-data/m-p/525585#M148334</link>
      <description>&lt;P&gt; Below is "no result" i am getting. I need todays day count, previous day count and the difference between todays count and previous day count. From the above query as you suggested not getting any results.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="IMG_20201020_202435.jpg" style="width: 4000px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/11380i32A2DFC6132B94FF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="IMG_20201020_202435.jpg" alt="IMG_20201020_202435.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Oct 2020 14:56:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Today-date-and-previous-day-data/m-p/525585#M148334</guid>
      <dc:creator>uagraw01</dc:creator>
      <dc:date>2020-10-20T14:56:54Z</dc:date>
    </item>
    <item>
      <title>Re: Today date and previous day data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Today-date-and-previous-day-data/m-p/525586#M148335</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/70277"&gt;@uagraw01&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;this is because you have only today's events!&lt;/P&gt;&lt;P&gt;enlarge your data frame and you'll have results.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 20 Oct 2020 14:59:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Today-date-and-previous-day-data/m-p/525586#M148335</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-10-20T14:59:55Z</dc:date>
    </item>
    <item>
      <title>Re: Today date and previous day data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Today-date-and-previous-day-data/m-p/525598#M148340</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp; Can you suggest me another method. I mean another SPL. Because this search is very slow while executing.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Oct 2020 16:02:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Today-date-and-previous-day-data/m-p/525598#M148340</guid>
      <dc:creator>uagraw01</dc:creator>
      <dc:date>2020-10-20T16:02:39Z</dc:date>
    </item>
    <item>
      <title>Re: Today date and previous day data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Today-date-and-previous-day-data/m-p/525615#M148348</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/70277"&gt;@uagraw01&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;if in yyour search you can use only the index time fields (index, sourcetyoe, source and host) you can use "|metasearch", having someting like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| metasearch index=_internal earliest=-d@d latest=now
| eval date_year=strftime(_time,"%Y"), date_month=strftime(_time,"%B"),date_mday=strftime(_time,"%d")
| eval now_date_year=strftime(now(),"%Y"), now_date_month=strftime(now(),"%B"),now_date_mday=strftime(now(),"%d")
| eval day=if(date_year=now_date_year AND date_month=now_date_month AND date_mday=now_date_mday,"Today","Previous")
| stats count BY day
| delta count AS diff
| reverse
| table diff
| head 1&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;&amp;nbsp;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 20 Oct 2020 17:55:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Today-date-and-previous-day-data/m-p/525615#M148348</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-10-20T17:55:36Z</dc:date>
    </item>
    <item>
      <title>Re: Today date and previous day data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Today-date-and-previous-day-data/m-p/525632#M148351</link>
      <description>At least in some older versions of splunk only official way was use all time as search period with metasearch. With other periods result was or wasn’t exactly correct. I’m not sure if this UFs still valid or not. Unfortunately I couldn’t find where I have gotten this information and could evaluate it now.</description>
      <pubDate>Tue, 20 Oct 2020 20:15:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Today-date-and-previous-day-data/m-p/525632#M148351</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2020-10-20T20:15:31Z</dc:date>
    </item>
    <item>
      <title>Re: Today date and previous day data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Today-date-and-previous-day-data/m-p/525687#M148368</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/80737"&gt;@inventsekar&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I tried on my Splunk and correctly worked.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 21 Oct 2020 06:28:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Today-date-and-previous-day-data/m-p/525687#M148368</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-10-21T06:28:08Z</dc:date>
    </item>
    <item>
      <title>Re: Today date and previous day data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Today-date-and-previous-day-data/m-p/525688#M148369</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp; It is working fine now . Thanks for yours extended help.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Oct 2020 06:39:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Today-date-and-previous-day-data/m-p/525688#M148369</guid>
      <dc:creator>uagraw01</dc:creator>
      <dc:date>2020-10-21T06:39:09Z</dc:date>
    </item>
    <item>
      <title>Re: Today date and previous day data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Today-date-and-previous-day-data/m-p/525697#M148373</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/70277"&gt;@uagraw01&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;good for you, please accept the answer for the other people of Community.&lt;/P&gt;&lt;P&gt;Ciao and happy splunking.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 21 Oct 2020 07:37:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Today-date-and-previous-day-data/m-p/525697#M148373</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-10-21T07:37:37Z</dc:date>
    </item>
  </channel>
</rss>

