<?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 Align timechart with current time in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Align-timechart-with-current-time/m-p/278203#M83982</link>
    <description>&lt;P&gt;We've been using the following search&lt;/P&gt;

&lt;P&gt;sourcetype=*_catalina ERROR logging_level=ERROR | bucket _time span=4h | timechart count span=4h&lt;/P&gt;

&lt;P&gt;that counts the errors every 4 hours throughout the day, e.g.&lt;/P&gt;

&lt;P&gt;00:00&lt;BR /&gt;
04:00&lt;BR /&gt;
08:00&lt;/P&gt;

&lt;P&gt;however, we'd like to see the errors every 4 hours from now, e.g.&lt;/P&gt;

&lt;P&gt;15:37:12&lt;BR /&gt;
19:37:12&lt;BR /&gt;
23:37:12&lt;/P&gt;

&lt;P&gt;Is this possible? How can we achieve this?&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 07:36:16 GMT</pubDate>
    <dc:creator>BenEllisCognia</dc:creator>
    <dc:date>2020-09-29T07:36:16Z</dc:date>
    <item>
      <title>Align timechart with current time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Align-timechart-with-current-time/m-p/278203#M83982</link>
      <description>&lt;P&gt;We've been using the following search&lt;/P&gt;

&lt;P&gt;sourcetype=*_catalina ERROR logging_level=ERROR | bucket _time span=4h | timechart count span=4h&lt;/P&gt;

&lt;P&gt;that counts the errors every 4 hours throughout the day, e.g.&lt;/P&gt;

&lt;P&gt;00:00&lt;BR /&gt;
04:00&lt;BR /&gt;
08:00&lt;/P&gt;

&lt;P&gt;however, we'd like to see the errors every 4 hours from now, e.g.&lt;/P&gt;

&lt;P&gt;15:37:12&lt;BR /&gt;
19:37:12&lt;BR /&gt;
23:37:12&lt;/P&gt;

&lt;P&gt;Is this possible? How can we achieve this?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:36:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Align-timechart-with-current-time/m-p/278203#M83982</guid>
      <dc:creator>BenEllisCognia</dc:creator>
      <dc:date>2020-09-29T07:36:16Z</dc:date>
    </item>
    <item>
      <title>Re: Align timechart with current time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Align-timechart-with-current-time/m-p/278204#M83983</link>
      <description>&lt;P&gt;Give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=*_catalina ERROR logging_level=ERROR | table _time | eval diff=now()-relative_time(now(),"@h") | eval _time=_time-diff | timechart span=4h count max(diff) as diff | eval _time=_time+diff |fields - diff
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 25 Oct 2015 18:29:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Align-timechart-with-current-time/m-p/278204#M83983</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-10-25T18:29:43Z</dc:date>
    </item>
    <item>
      <title>Re: Align timechart with current time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Align-timechart-with-current-time/m-p/278205#M83984</link>
      <description>&lt;P&gt;This doesn't work as I am wanting, it still gives me a truncated count for the last 4 hours.&lt;/P&gt;

&lt;P&gt;It rounds all the events to the nearest hour, if it rounded them to the nearest 4 hour block then it would possibly do what I want.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2015 11:19:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Align-timechart-with-current-time/m-p/278205#M83984</guid>
      <dc:creator>BenEllisCognia</dc:creator>
      <dc:date>2015-10-27T11:19:06Z</dc:date>
    </item>
    <item>
      <title>Re: Align timechart with current time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Align-timechart-with-current-time/m-p/278206#M83985</link>
      <description>&lt;P&gt;I've tweaked @somesoni2's answer to suit my needs and it appears to run okay though a little slow, any optimization suggestions would be appreciated.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=*_catalina (ERROR OR SEVERE OR FATAL) | where ISNULL(logging_level) OR logging_level="ERROR" OR logging_level="SEVERE" OR logging_level="FATAL" | table _time | eval diff=now()-relative_time(now(),"@d") | eval diff=case(diff &amp;lt; (4*3600), diff - (1*(4*3600)), diff &amp;lt; (2*(4*3600)), diff - (2*(4*3600)), diff &amp;lt; (3*(4*3600)), diff - (3*(4*3600)), diff &amp;lt; (4*(4*3600)), diff - (4*(4*3600)), diff &amp;lt; (5*(4*3600)), diff - (5*(4*3600)), diff &amp;lt; (6*(4*3600)), diff - (6*(4*3600)), diff &amp;lt; (7*(4*3600)), diff - (7*(4*3600))) | eval _time=_time-diff | timechart span=4h count max(diff) as diff | eval _time=_time+diff | fields - diff 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Oct 2015 17:06:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Align-timechart-with-current-time/m-p/278206#M83985</guid>
      <dc:creator>BenEllisCognia</dc:creator>
      <dc:date>2015-10-27T17:06:19Z</dc:date>
    </item>
  </channel>
</rss>

