<?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 Avg for 7 days and 15 days ....etc :) in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Avg-for-7-days-and-15-days-etc/m-p/429497#M168428</link>
    <description>&lt;P&gt;Hi Splunkers ,&lt;/P&gt;

&lt;P&gt;&lt;IMG src="https://community.splunk.com/storage/temp/251154-ttttttttttttt.jpg" alt="my_data_image" /&gt;&lt;/P&gt;

&lt;P&gt;Here below is my data look like that .In that i want to get &lt;CODE&gt;avg(sum_PBD)&lt;/CODE&gt; based on &lt;CODE&gt;Date&lt;/CODE&gt; &lt;BR /&gt;
&lt;STRONG&gt;Conditions:-&lt;/STRONG&gt; &lt;BR /&gt;
1. If results are &amp;lt;= 7    avg(sum_PBD) by eachday -----------------here i got 7 results&lt;BR /&gt;
2.If results are  &amp;lt;= 1 month  avg(sum_PBD) by weekwise-----------------here i got 4 results&lt;BR /&gt;
3.If results are  &amp;lt;= 2 months  avg(sum_PBD) by 15days -----------------here i got 4 results&lt;BR /&gt;
4.If results are &amp;gt;= 6 months  avg(sum_PBD) by monthwise-----------------here i got monthwise results&lt;/P&gt;

&lt;P&gt;Thanks in Advance.&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 20:21:33 GMT</pubDate>
    <dc:creator>harishalipaka</dc:creator>
    <dc:date>2020-09-29T20:21:33Z</dc:date>
    <item>
      <title>Avg for 7 days and 15 days ....etc :)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Avg-for-7-days-and-15-days-etc/m-p/429497#M168428</link>
      <description>&lt;P&gt;Hi Splunkers ,&lt;/P&gt;

&lt;P&gt;&lt;IMG src="https://community.splunk.com/storage/temp/251154-ttttttttttttt.jpg" alt="my_data_image" /&gt;&lt;/P&gt;

&lt;P&gt;Here below is my data look like that .In that i want to get &lt;CODE&gt;avg(sum_PBD)&lt;/CODE&gt; based on &lt;CODE&gt;Date&lt;/CODE&gt; &lt;BR /&gt;
&lt;STRONG&gt;Conditions:-&lt;/STRONG&gt; &lt;BR /&gt;
1. If results are &amp;lt;= 7    avg(sum_PBD) by eachday -----------------here i got 7 results&lt;BR /&gt;
2.If results are  &amp;lt;= 1 month  avg(sum_PBD) by weekwise-----------------here i got 4 results&lt;BR /&gt;
3.If results are  &amp;lt;= 2 months  avg(sum_PBD) by 15days -----------------here i got 4 results&lt;BR /&gt;
4.If results are &amp;gt;= 6 months  avg(sum_PBD) by monthwise-----------------here i got monthwise results&lt;/P&gt;

&lt;P&gt;Thanks in Advance.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:21:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Avg-for-7-days-and-15-days-etc/m-p/429497#M168428</guid>
      <dc:creator>harishalipaka</dc:creator>
      <dc:date>2020-09-29T20:21:33Z</dc:date>
    </item>
    <item>
      <title>Re: Avg for 7 days and 15 days ....etc :)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Avg-for-7-days-and-15-days-etc/m-p/429498#M168429</link>
      <description>&lt;P&gt;Hello &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/214394"&gt;@harishalipaka&lt;/a&gt;,&lt;/P&gt;

&lt;P&gt;I think the following goes in your way. It takes advantage of the &lt;CODE&gt;earliest&lt;/CODE&gt;, &lt;CODE&gt;latest&lt;/CODE&gt; and &lt;CODE&gt;span&lt;/CODE&gt; arguments. In the following, I am just counting the *ERROR*s in the &lt;CODE&gt;_internal&lt;/CODE&gt; index.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal ERROR earliest=-7d@d latest=now()
| timechart count span=1d
| append 
    [search index=_internal ERROR earliest=-30d@d latest=-8d@d
| timechart count span=7d]
| append 
    [search index=_internal ERROR earliest=-60d@d latest=-31d@d
| timechart count span=15d]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:21:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Avg-for-7-days-and-15-days-etc/m-p/429498#M168429</guid>
      <dc:creator>poete</dc:creator>
      <dc:date>2020-09-29T20:21:42Z</dc:date>
    </item>
    <item>
      <title>Re: Avg for 7 days and 15 days ....etc :)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Avg-for-7-days-and-15-days-etc/m-p/429499#M168430</link>
      <description>&lt;P&gt;hi @poete&lt;BR /&gt;
Thanks for your reply .But i cann't get answer.&lt;BR /&gt;
my data is from inputlookup not from index.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jul 2018 12:51:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Avg-for-7-days-and-15-days-etc/m-p/429499#M168430</guid>
      <dc:creator>harishalipaka</dc:creator>
      <dc:date>2018-07-09T12:51:49Z</dc:date>
    </item>
    <item>
      <title>Re: Avg for 7 days and 15 days ....etc :)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Avg-for-7-days-and-15-days-etc/m-p/429500#M168431</link>
      <description>&lt;P&gt;Hi @harishalipaka,&lt;/P&gt;

&lt;P&gt;Sorry, I am not sure I understand. Why can't you replace index=_internal with |inputlookup?&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jul 2018 12:53:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Avg-for-7-days-and-15-days-etc/m-p/429500#M168431</guid>
      <dc:creator>poete</dc:creator>
      <dc:date>2018-07-09T12:53:49Z</dc:date>
    </item>
    <item>
      <title>Re: Avg for 7 days and 15 days ....etc :)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Avg-for-7-days-and-15-days-etc/m-p/429501#M168432</link>
      <description>&lt;P&gt;this is my output results ,not direct from lookup.&lt;BR /&gt;
I already filtered with date range .i had only Date column which one display in image.&lt;BR /&gt;
I want to filter with that Date column only&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jul 2018 13:25:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Avg-for-7-days-and-15-days-etc/m-p/429501#M168432</guid>
      <dc:creator>harishalipaka</dc:creator>
      <dc:date>2018-07-09T13:25:01Z</dc:date>
    </item>
    <item>
      <title>Re: Avg for 7 days and 15 days ....etc :)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Avg-for-7-days-and-15-days-etc/m-p/429502#M168433</link>
      <description>&lt;P&gt;OK @harishalipaka,, I think I got it.&lt;/P&gt;

&lt;P&gt;So, you could do the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your base search of lookup&amp;gt;| eval _time=strptime(Date,"%d/%m/%Y")|
search earliest=-7d@d latest=now()
 | timechart avg(sum_PBD) span=1d
 | append [&amp;lt;your base search of lookup&amp;gt;| eval _time=strptime(Date,"%d/%m/%Y")|
search earliest=-30d@d latest=-8d@d
 | timechart avg(sum_PBD) span=1w]
....
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Jul 2018 14:57:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Avg-for-7-days-and-15-days-etc/m-p/429502#M168433</guid>
      <dc:creator>poete</dc:creator>
      <dc:date>2018-07-09T14:57:01Z</dc:date>
    </item>
    <item>
      <title>Re: Avg for 7 days and 15 days ....etc :)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Avg-for-7-days-and-15-days-etc/m-p/429503#M168434</link>
      <description>&lt;P&gt;I think you need something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Your Base Search Here
| bucket _time [| noop | stats count AS span
                | addinfo | eval timepickerSpanSeconds=(info_max_time - info_min_time)
                | eval span=case(
                      timepickerSpanSeconds&amp;gt;=(6*30*24*60*60), "1m",
                      timepickerSpanSeconds&amp;gt;=(2*30*24*60*60), "15d",
                      timepickerSpanSeconds&amp;gt;=(1*30*24*60*60), "1w",
                      true(), "1d")
               | table span | format "" "" "" "" "" ""]
| stats avg(sum_PBD) BY _time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 13 Jul 2018 13:20:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Avg-for-7-days-and-15-days-etc/m-p/429503#M168434</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-07-13T13:20:51Z</dc:date>
    </item>
    <item>
      <title>Re: Avg for 7 days and 15 days ....etc :)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Avg-for-7-days-and-15-days-etc/m-p/429504#M168435</link>
      <description>&lt;P&gt;If your data is from a lookup, try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup LookupWith_Date_and_sumPDB
| eval _time = strptime(Date, "%m/%d/%Y")
| bucket _time [| inputlookup LookupWith_Date_and_sumPDB
                | eval _time = strptime(Date, "%m/%d/%Y")
                | stats range(_time) AS DateSpanSeconds
                | eval span=case(
                       DateSpanSeconds&amp;gt;=(6*30*24*60*60), "1m",
                       DateSpanSeconds&amp;gt;=(2*30*24*60*60), "15d",
                       DateSpanSeconds&amp;gt;=(1*30*24*60*60), "1w",
                       true(), "1d")
          | table span | format "" "" "" "" "" ""]
| stats avg(sum_PBD) BY _time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 13 Jul 2018 13:26:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Avg-for-7-days-and-15-days-etc/m-p/429504#M168435</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-07-13T13:26:50Z</dc:date>
    </item>
  </channel>
</rss>

