<?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 timewrap using the last 1 hour and check the same hour for previous 7 days in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-timewrap-using-the-last-1-hour-and-check-the-same-hour/m-p/506635#M141737</link>
    <description>&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;I'm now trying to work out how to do this with&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| timechart span=1m count by $field$&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas?&amp;nbsp; Do i need to have an addtotals for each field value?&amp;nbsp; And once i get to tail -1, can the values be grouped in rows by the field value?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 30 Jun 2020 07:39:15 GMT</pubDate>
    <dc:creator>Sam1</dc:creator>
    <dc:date>2020-06-30T07:39:15Z</dc:date>
    <item>
      <title>How to timewrap using the last 1 hour and check the same hour for previous 7 days</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-timewrap-using-the-last-1-hour-and-check-the-same-hour/m-p/505623#M141353</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;I want to create an alert which runs every hour, checks the last 60 minutes of events to get the count number, then compares this with the average of the past 7 days.&lt;/P&gt;&lt;P&gt;index=data&lt;BR /&gt;| timechart span=1h count&lt;BR /&gt;| timewrap d series=short&lt;BR /&gt;| addtotals s*&lt;BR /&gt;| eval 7dayavg=Total/7.0&lt;BR /&gt;| table _time, _span, s0, 7dayavg&lt;BR /&gt;| rename s0 as now&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This displays every hour for today and 7dayavg but how do i just show for the past 60 minutes, then compare that with the 7dayavg of the same 60 minute time block?&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jun 2020 23:19:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-timewrap-using-the-last-1-hour-and-check-the-same-hour/m-p/505623#M141353</guid>
      <dc:creator>Sam1</dc:creator>
      <dc:date>2020-06-22T23:19:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to timewrap using the last 1 hour and check the same hour for previous 7 days</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-timewrap-using-the-last-1-hour-and-check-the-same-hour/m-p/505635#M141358</link>
      <description>&lt;P&gt;If I follow you correctly, you want to only show the most recent hour (or is it really 60 minutes?) and the 7 day average.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If so, they just adding&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| tail 1&lt;/LI-CODE&gt;&lt;P&gt;to the end of the query will give you the last row, which is most recent time.&lt;/P&gt;&lt;P&gt;Note that because you're doing a timechart span=1h your most recent 'hour' may not be representative of the hour, as it will only include minutes from :00&lt;/P&gt;&lt;P&gt;So, you could do a&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| tail 2
| tail 1&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;which is somewhat counterintuitive, as I would have expected to be able to do head 1, but it seems to reverse the results with the tail 2.&lt;/P&gt;&lt;P&gt;Anyway, does that give you what you're after?&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jun 2020 01:28:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-timewrap-using-the-last-1-hour-and-check-the-same-hour/m-p/505635#M141358</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2020-06-23T01:28:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to timewrap using the last 1 hour and check the same hour for previous 7 days</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-timewrap-using-the-last-1-hour-and-check-the-same-hour/m-p/505638#M141360</link>
      <description>&lt;P&gt;Thank you.&amp;nbsp; How about to get a true 60 minutes?&amp;nbsp; So if i was to run my search at 3:11 it would capture from 2:11 - 3:11?&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jun 2020 02:57:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-timewrap-using-the-last-1-hour-and-check-the-same-hour/m-p/505638#M141360</guid>
      <dc:creator>Sam1</dc:creator>
      <dc:date>2020-06-23T02:57:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to timewrap using the last 1 hour and check the same hour for previous 7 days</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-timewrap-using-the-last-1-hour-and-check-the-same-hour/m-p/505839#M141462</link>
      <description>&lt;P&gt;As span=1d will round the time window down to the hour you can't run span=1h, so this may work for you&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=_internal
| timechart span=1m count
| timewrap d series=short
| addtotals s*
| table _time, s0, Total
| streamstats window=60 sum(*) as *
| eval 7dayavg=Total/7.0
| rename s0 as now
| tail 1
| fields _time now 7dayavg&lt;/LI-CODE&gt;&lt;P&gt;It's using a 1m span and then later using streamstats to create the totals from the 60 row groups, so the last row will contain what you want.&lt;/P&gt;&lt;P&gt;Not sure if there's a more efficient way to do this, but this works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jun 2020 22:13:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-timewrap-using-the-last-1-hour-and-check-the-same-hour/m-p/505839#M141462</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2020-06-23T22:13:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to timewrap using the last 1 hour and check the same hour for previous 7 days</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-timewrap-using-the-last-1-hour-and-check-the-same-hour/m-p/506635#M141737</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;I'm now trying to work out how to do this with&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| timechart span=1m count by $field$&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas?&amp;nbsp; Do i need to have an addtotals for each field value?&amp;nbsp; And once i get to tail -1, can the values be grouped in rows by the field value?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jun 2020 07:39:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-timewrap-using-the-last-1-hour-and-check-the-same-hour/m-p/506635#M141737</guid>
      <dc:creator>Sam1</dc:creator>
      <dc:date>2020-06-30T07:39:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to timewrap using the last 1 hour and check the same hour for previous 7 days</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-timewrap-using-the-last-1-hour-and-check-the-same-hour/m-p/506638#M141738</link>
      <description>&lt;P&gt;Or can i create another search which calls the search you provided&lt;/P&gt;&lt;P&gt;Something like savedsearch but i want to iterate through multiple values of my field.&lt;/P&gt;&lt;P&gt;I'd need to add the field to the search you provided i guess as well:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=_internal field=$value$&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jun 2020 07:47:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-timewrap-using-the-last-1-hour-and-check-the-same-hour/m-p/506638#M141738</guid>
      <dc:creator>Sam1</dc:creator>
      <dc:date>2020-06-30T07:47:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to timewrap using the last 1 hour and check the same hour for previous 7 days</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-timewrap-using-the-last-1-hour-and-check-the-same-hour/m-p/506794#M141765</link>
      <description>&lt;P&gt;Take a look at the solution I proposed here&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.splunk.com/t5/Splunk-Search/Using-timechart-command-isn-t-working-for-renaming/m-p/469691#M132171" target="_blank"&gt;https://community.splunk.com/t5/Splunk-Search/Using-timechart-command-isn-t-working-for-renaming/m-p/469691#M132171&lt;/A&gt;&lt;/P&gt;&lt;P&gt;which describes how to handle the naming issue around columns when using the split by clause. You should be able to combine the solution below with that to achieve what you are trying to do.&lt;/P&gt;&lt;P&gt;When using the split by in the timechart, the columns become named based on the split by field, so the key feature in that post is to add a common prefix to the field value, so when it becomes a field name in the timechart, it will allow you to 'discover' the field names using the foreach command.&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jun 2020 22:02:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-timewrap-using-the-last-1-hour-and-check-the-same-hour/m-p/506794#M141765</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2020-06-30T22:02:49Z</dc:date>
    </item>
  </channel>
</rss>

