<?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: Timechart Volume per hour same day over several weeks...Seeking alternative way. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Timechart-Volume-per-hour-same-day-over-several-weeks-Seeking/m-p/362251#M107008</link>
    <description>&lt;P&gt;Updated. I should have thought to add that. &lt;/P&gt;</description>
    <pubDate>Wed, 25 Apr 2018 16:48:00 GMT</pubDate>
    <dc:creator>nqjpm</dc:creator>
    <dc:date>2018-04-25T16:48:00Z</dc:date>
    <item>
      <title>Timechart Volume per hour same day over several weeks...Seeking alternative way.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-Volume-per-hour-same-day-over-several-weeks-Seeking/m-p/362249#M107006</link>
      <description>&lt;P&gt;This is a working search that charts Volume &lt;STRONG&gt;per hour&lt;/STRONG&gt; for the same day (Current day) over multiple weeks. The search time from the Timepicker is set at Today. I was experimenting with timewrap to solve this issue but &lt;CODE&gt;|timewrap 1week&lt;/CODE&gt; wasn't doing what I needed. &lt;BR /&gt;
I am trying to avoid using more appends as the my search is becoming long and expensive since I am being asked for multiple panels showing more weeks,  month and YTD. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index= foo |fields incidentId _time  | dedup incidentId | eval ReportKey="1. Current day" 
    |append [search index=foo earliest=-7d@d latest=-6d@d |fields incidentId _time | eval
_time=_time+86400*7 | dedup incidentId | eval ReportKey="2. Last week"] 
    |append [search index=foo earliest=-14d@d latest=-13d@d |fields incidentId _time |eval
_time=_time+86400*7*2 | dedup incidentId | eval ReportKey="3. Two weeks ago"] 
    |append [search index=foo earliest=-21d@d latest=-20d@d |fields incidentId _time |eval
_time=_time+86400*7*3 | dedup incidentId | eval ReportKey="4. Three weeks ago"] 
    | timechart span=1h count(incidentId) by ReportKey
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks in advance&lt;/P&gt;

&lt;P&gt;Here is the failed attempt that removes the hourly component in the visualization in linechart&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=foo |fields incidentId _time
| timechart span=1h dc(incidentId)
| timewrap 1week
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I don't yet have enough karma to post an image unfortunately. It removes me from the Hourly view and put the time chart into a weekly view. changing timewrap to 1d shows everyday. Not sure what I am missing here. &lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 16:11:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-Volume-per-hour-same-day-over-several-weeks-Seeking/m-p/362249#M107006</guid>
      <dc:creator>nqjpm</dc:creator>
      <dc:date>2018-04-25T16:11:55Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart Volume per hour same day over several weeks...Seeking alternative way.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-Volume-per-hour-same-day-over-several-weeks-Seeking/m-p/362250#M107007</link>
      <description>&lt;P&gt;Can you perhaps share the search using timewrap that you tried but didn't give the desired results?&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 16:21:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-Volume-per-hour-same-day-over-several-weeks-Seeking/m-p/362250#M107007</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2018-04-25T16:21:03Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart Volume per hour same day over several weeks...Seeking alternative way.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-Volume-per-hour-same-day-over-several-weeks-Seeking/m-p/362251#M107008</link>
      <description>&lt;P&gt;Updated. I should have thought to add that. &lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 16:48:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-Volume-per-hour-same-day-over-several-weeks-Seeking/m-p/362251#M107008</guid>
      <dc:creator>nqjpm</dc:creator>
      <dc:date>2018-04-25T16:48:00Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart Volume per hour same day over several weeks...Seeking alternative way.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-Volume-per-hour-same-day-over-several-weeks-Seeking/m-p/362252#M107009</link>
      <description>&lt;P&gt;Let's say that you need 10 weeks' worth,  use &lt;CODE&gt;10w&lt;/CODE&gt; in the &lt;CODE&gt;relative_time&lt;/CODE&gt; line and set the &lt;CODE&gt;timepicker&lt;/CODE&gt; to &lt;CODE&gt;Last 10 weeks&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=foo
    [| gentimes 
        [| makeresults |  eval start=strftime(relative_time(now(), "-10w@d"), "%m/%d/%Y")] 
        increment=1d 
    | rename COMMENT1of2 AS "We use '1d' + 'dropme' instead of '1w' because we need the start/end to span 1 day, not 1 week."
    | rename COMMENT2of2 AS "Also, on some versions, the 'increment=1w' option does not work at all and does '1d' instead."
    | streamstats count AS _serial
    | eval dropme = (_serial + 6)%7
    | search dropme = 0
    | table starttime endtime
    | rename starttime AS time&amp;gt;, endtime AS time&amp;lt;
    | format
    | rex field=search mode=sed "s/time/_time/g s/\"//g"
    ]
| dedup incidentId
| fields _time
| eval ReportKey=strftime(_time, "%m/%d/%y)
| timechart span=1h count BY ReportKey
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am not sure what you were doing after that but you can take it from there.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 17:00:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-Volume-per-hour-same-day-over-several-weeks-Seeking/m-p/362252#M107009</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-04-25T17:00:40Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart Volume per hour same day over several weeks...Seeking alternative way.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-Volume-per-hour-same-day-over-several-weeks-Seeking/m-p/362253#M107010</link>
      <description>&lt;P&gt;You don't need all the appends. Compare the performance to this.  It might be better, or might not.  Use the entire time range that you want to compare, like &lt;CODE&gt;earliest=-22d@d&lt;/CODE&gt; for three weeks.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index= foo 
| fields incidentId _time 
| dedup incidentId 
| bin _time as day span=1d
| appendpipe [| stats max(day) as maxdate 
    | eval desiredDay=strftime(maxdate,"%w") 
    ]
| eventstats max(maxdate) as maxdate max(desiredDay) as desiredDay 
| eval dayofweek=strftime(_time,"%w") 
| where dayofweek = desiredDay
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This part sets up the report fields...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval ReportKey=round((maxdate-day)/604800,0)
| eval _time=_time + 604800*ReportKey
| eval ReportKey=if(ReportKey=0,"0.  Current day",ReportKey.". ".ReportKey." Weeks Ago")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This part shows the report...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | timechart span=1h count(incidentId) by ReportKey
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Apr 2018 17:13:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-Volume-per-hour-same-day-over-several-weeks-Seeking/m-p/362253#M107010</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2018-04-25T17:13:28Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart Volume per hour same day over several weeks...Seeking alternative way.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-Volume-per-hour-same-day-over-several-weeks-Seeking/m-p/362254#M107011</link>
      <description>&lt;P&gt;I took the extreme liberty of reformatting to indent the subsearches for the unwary.  At first read, it seemed like more @woodcock magic. &lt;/P&gt;

&lt;P&gt;The above code, inside the outer square brackets, creates a list of time ranges that ends up being formatted like &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;( ( ( _time&amp;gt;=epochtimedaystartweek1 ) AND (  _time&amp;lt;=epochtimedayendweek1 )  )  OR 
  ( ( _time&amp;gt;=epochtimedatstartweek2 ) AND (  _time&amp;lt;=epochtimedatendweek2 )  )  OR
    ... ) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;where those values are the start and end epoch times created by the inside search.  Those times are then used as parameters by the outside search to limit the date/times that are scanned by the search.&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;Add these lines to complete the report.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| bin _time as day span=1d
| eventstats max(day) as maxdate
| eval ReportKey=round((maxdate-day)/604800,0) 
| eval _time=_time + 604800*ReportKey
| eval ReportKey=if(ReportKey=0,"0.  Current day",ReportKey.". ".ReportKey." Weeks Ago")
| timechart span=1h count(incidentId) by ReportKey
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Apr 2018 17:23:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-Volume-per-hour-same-day-over-several-weeks-Seeking/m-p/362254#M107011</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2018-04-25T17:23:09Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart Volume per hour same day over several weeks...Seeking alternative way.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-Volume-per-hour-same-day-over-several-weeks-Seeking/m-p/362255#M107012</link>
      <description>&lt;P&gt;Follow @woodcock's search, which is more efficient, then add these lines to produce the report.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| bin _time as day span=1d
| eventstats max(day) as maxdate
| eval ReportKey=round((maxdate-day)/604800,0)
| eval _time=_time + 604800*ReportKey
| eval ReportKey=if(ReportKey=0,"0.  Current day",ReportKey.". ".ReportKey." Weeks Ago")
| timechart span=1h count(incidentId) by ReportKey
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Apr 2018 17:27:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-Volume-per-hour-same-day-over-several-weeks-Seeking/m-p/362255#M107012</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2018-04-25T17:27:03Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart Volume per hour same day over several weeks...Seeking alternative way.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-Volume-per-hour-same-day-over-several-weeks-Seeking/m-p/362256#M107013</link>
      <description>&lt;P&gt;It sounds like you approve @daljeanis, you re-editing, non-upvoting interloper!  Thanks for expanding on my answer and wrapping up the last bit.  I use &lt;CODE&gt;gentimes&lt;/CODE&gt; like this frequently; it is a nice spell to have in one's bag of magic tricks.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 18:22:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-Volume-per-hour-same-day-over-several-weeks-Seeking/m-p/362256#M107013</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-04-25T18:22:57Z</dc:date>
    </item>
  </channel>
</rss>

