<?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 to get events count by day with relative difference in time in Deployment Architecture</title>
    <link>https://community.splunk.com/t5/Deployment-Architecture/How-to-get-events-count-by-day-with-relative-difference-in-time/m-p/411779#M14755</link>
    <description>&lt;P&gt;Hello,&lt;BR /&gt;
I need to get the daily Events count per week. till this I did using Query&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index = *  myBaseQuery |bucket _time span=day |stats count by _time | sort -count 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But, there is some relative time which is happening, as per functionality and that relative time is stored in the variable finalRelDate&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval relDate=relative_time(initialDate, "-1d@d")
| eval finalRelDate =strftime(relDate, "%F")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My query is, &lt;STRONG&gt;I have to bucket the results(event count) based on finalRelDate&lt;/STRONG&gt;, which I am not getting.&lt;/P&gt;

&lt;P&gt;Can anybody help on this!!&lt;BR /&gt;
Thank you.&lt;/P&gt;</description>
    <pubDate>Mon, 10 Jun 2019 14:18:01 GMT</pubDate>
    <dc:creator>saitejagayala</dc:creator>
    <dc:date>2019-06-10T14:18:01Z</dc:date>
    <item>
      <title>How to get events count by day with relative difference in time</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/How-to-get-events-count-by-day-with-relative-difference-in-time/m-p/411779#M14755</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;
I need to get the daily Events count per week. till this I did using Query&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index = *  myBaseQuery |bucket _time span=day |stats count by _time | sort -count 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But, there is some relative time which is happening, as per functionality and that relative time is stored in the variable finalRelDate&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval relDate=relative_time(initialDate, "-1d@d")
| eval finalRelDate =strftime(relDate, "%F")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My query is, &lt;STRONG&gt;I have to bucket the results(event count) based on finalRelDate&lt;/STRONG&gt;, which I am not getting.&lt;/P&gt;

&lt;P&gt;Can anybody help on this!!&lt;BR /&gt;
Thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 14:18:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/How-to-get-events-count-by-day-with-relative-difference-in-time/m-p/411779#M14755</guid>
      <dc:creator>saitejagayala</dc:creator>
      <dc:date>2019-06-10T14:18:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to get events count by day with relative difference in time</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/How-to-get-events-count-by-day-with-relative-difference-in-time/m-p/411780#M14756</link>
      <description>&lt;P&gt;You can run your bucket and stats on relDate (while it's in epoch format).&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index = *  myBaseQuery | eval relDate=relative_time(initialDate, "-1d@d")|bucket relDate span=day |stats count by relDate | sort -count 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Jun 2019 14:50:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/How-to-get-events-count-by-day-with-relative-difference-in-time/m-p/411780#M14756</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2019-06-10T14:50:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to get events count by day with relative difference in time</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/How-to-get-events-count-by-day-with-relative-difference-in-time/m-p/411781#M14757</link>
      <description>&lt;P&gt;@saitejagayala Did you try assigning finalRelDate to _time?&lt;BR /&gt;
before bucket command try adding eval _time=finalRelDate&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 14:51:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/How-to-get-events-count-by-day-with-relative-difference-in-time/m-p/411781#M14757</guid>
      <dc:creator>Vijeta</dc:creator>
      <dc:date>2019-06-10T14:51:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to get events count by day with relative difference in time</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/How-to-get-events-count-by-day-with-relative-difference-in-time/m-p/411782#M14758</link>
      <description>&lt;P&gt;Aren't you looking for using the time modifiers something like - &lt;BR /&gt;
earliest=-1w@w latest=@d index=_internal sourcetype=splunkd*  |bucket _time span=day |stats count by _time | sort -count&lt;/P&gt;

&lt;P&gt;Let me know if there is more to you ques and I havent got it . &lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 14:54:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/How-to-get-events-count-by-day-with-relative-difference-in-time/m-p/411782#M14758</guid>
      <dc:creator>amitm05</dc:creator>
      <dc:date>2019-06-10T14:54:13Z</dc:date>
    </item>
  </channel>
</rss>

