<?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 can you restrict a timechart to display only weekdays? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-you-restrict-a-timechart-to-display-only-weekdays/m-p/157932#M44483</link>
    <description>&lt;P&gt;Hi Phil&lt;BR /&gt;
In the search reference for the bin command, &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Bin"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Bin&lt;/A&gt; there are 4 bucketing options : &lt;BR /&gt;
bins=&lt;INT&gt;&lt;BR /&gt;
minspan=&lt;SPAN-LENGTH&gt;&lt;BR /&gt;
span=&lt;LOG-SPAN&gt; | &lt;SPAN-LENGTH&gt; &lt;BR /&gt;
&lt;START-END&gt;&lt;/START-END&gt;&lt;/SPAN-LENGTH&gt;&lt;/LOG-SPAN&gt;&lt;/SPAN-LENGTH&gt;&lt;/INT&gt;&lt;/P&gt;

&lt;P&gt;Dave&lt;/P&gt;</description>
    <pubDate>Wed, 27 Nov 2013 14:16:06 GMT</pubDate>
    <dc:creator>davebrooking</dc:creator>
    <dc:date>2013-11-27T14:16:06Z</dc:date>
    <item>
      <title>How can you restrict a timechart to display only weekdays?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-you-restrict-a-timechart-to-display-only-weekdays/m-p/157924#M44475</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;This has been asked before, over 18 month's ago, and there was no answer to it. &lt;BR /&gt;
&lt;A href="http://answers.splunk.com/answers/44743/how-can-you-restrict-timechart-to-display-only-weekdays"&gt;http://answers.splunk.com/answers/44743/how-can-you-restrict-timechart-to-display-only-weekdays&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Has anyone got any idea how to remove certain days from a timechart? (In my case: weekends) I can remove them from the search, by using &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;date_wday!=saturday date_wday!=sunday
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;...but this is then displayed on the timechart like so (i.e. with the Sat and Sun data as "zero":&lt;/P&gt;

&lt;P&gt;&lt;IMG src="http://answers.splunk.com//storage/timechart.bmp" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;I want the timechart to exclude the Sat and Sun from the x axis completely. Any ideas?&lt;/P&gt;</description>
      <pubDate>Wed, 27 Nov 2013 11:26:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-you-restrict-a-timechart-to-display-only-weekdays/m-p/157924#M44475</guid>
      <dc:creator>philallen1</dc:creator>
      <dc:date>2013-11-27T11:26:40Z</dc:date>
    </item>
    <item>
      <title>Re: How can you restrict a timechart to display only weekdays?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-you-restrict-a-timechart-to-display-only-weekdays/m-p/157925#M44476</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;

&lt;P&gt;Have you tried to use a chart instead of a timechart command. Something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your search ... date_wday!=saturday date_wday!=sunday | bin span=1d _time | chart count by _time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Wed, 27 Nov 2013 11:39:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-you-restrict-a-timechart-to-display-only-weekdays/m-p/157925#M44476</guid>
      <dc:creator>gfuente</dc:creator>
      <dc:date>2013-11-27T11:39:39Z</dc:date>
    </item>
    <item>
      <title>Re: How can you restrict a timechart to display only weekdays?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-you-restrict-a-timechart-to-display-only-weekdays/m-p/157926#M44477</link>
      <description>&lt;P&gt;Your answer does what I want - so thanks a lot for responding so promptly.&lt;/P&gt;

&lt;P&gt;I do have a slight issue: because I use a timepicker on my dashboard, the x axis gets very crowded when I select a wide time range. The other issue is when I select a small time range (i.e. last 24 hours) because the data is bucketed into 'days' I only get 1 point on my chart - whereas before the timechart would cleverly adjust the x axis into hours. &lt;/P&gt;

&lt;P&gt;If there's a solution to exclude weekends from a timechart, rather than a chart, then I'm all ears still and will award karma points.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Nov 2013 12:02:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-you-restrict-a-timechart-to-display-only-weekdays/m-p/157926#M44477</guid>
      <dc:creator>philallen1</dc:creator>
      <dc:date>2013-11-27T12:02:28Z</dc:date>
    </item>
    <item>
      <title>Re: How can you restrict a timechart to display only weekdays?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-you-restrict-a-timechart-to-display-only-weekdays/m-p/157927#M44478</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| your time chart search | eval date_wday=lower(strftime(_time,"%A")) |where NOT (date_wday=saturday OR date_wday=sunday) | fields - date_wday
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Nov 2013 12:08:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-you-restrict-a-timechart-to-display-only-weekdays/m-p/157927#M44478</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2013-11-27T12:08:25Z</dc:date>
    </item>
    <item>
      <title>Re: How can you restrict a timechart to display only weekdays?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-you-restrict-a-timechart-to-display-only-weekdays/m-p/157928#M44479</link>
      <description>&lt;P&gt;I don't have a Splunk instance to check this on, but could you replace the span=1d in the bin command with the bins=&lt;NUM&gt; option?&lt;/NUM&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Nov 2013 12:19:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-you-restrict-a-timechart-to-display-only-weekdays/m-p/157928#M44479</guid>
      <dc:creator>davebrooking</dc:creator>
      <dc:date>2013-11-27T12:19:52Z</dc:date>
    </item>
    <item>
      <title>Re: How can you restrict a timechart to display only weekdays?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-you-restrict-a-timechart-to-display-only-weekdays/m-p/157929#M44480</link>
      <description>&lt;P&gt;Hi Dave&lt;BR /&gt;
What exactly do you mean? I've tried googling what you suggest but can't fine anything. Could you give me a pointer to some documentation? I couldn't see anything in the 'bin' docs...&lt;/P&gt;</description>
      <pubDate>Wed, 27 Nov 2013 13:25:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-you-restrict-a-timechart-to-display-only-weekdays/m-p/157929#M44480</guid>
      <dc:creator>philallen1</dc:creator>
      <dc:date>2013-11-27T13:25:34Z</dc:date>
    </item>
    <item>
      <title>Re: How can you restrict a timechart to display only weekdays?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-you-restrict-a-timechart-to-display-only-weekdays/m-p/157930#M44481</link>
      <description>&lt;P&gt;Hi somesoni2&lt;BR /&gt;
I couldn't get this to work...&lt;BR /&gt;
My current search is:&lt;/P&gt;

&lt;P&gt;sourcetype="UserLogs" UserName=%star% App=%star%  "started in" OR "initialised in" | timechart count(App)&lt;/P&gt;

&lt;P&gt;I've tried adding in your 'eval', 'where' and 'fields' commands in after and before the 'timechart' command, but with no luck...&lt;/P&gt;</description>
      <pubDate>Wed, 27 Nov 2013 13:27:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-you-restrict-a-timechart-to-display-only-weekdays/m-p/157930#M44481</guid>
      <dc:creator>philallen1</dc:creator>
      <dc:date>2013-11-27T13:27:53Z</dc:date>
    </item>
    <item>
      <title>Re: How can you restrict a timechart to display only weekdays?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-you-restrict-a-timechart-to-display-only-weekdays/m-p/157931#M44482</link>
      <description>&lt;P&gt;Try again putting his pipes after the timechart, and put the saturday and sunday after the equal signs in quotes:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | timechart ... | eval date_wday=lower(strftime(_time,"%A")) |where NOT (date_wday="saturday" OR date_wday="sunday") | fields - date_wday
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Nov 2013 14:04:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-you-restrict-a-timechart-to-display-only-weekdays/m-p/157931#M44482</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2013-11-27T14:04:21Z</dc:date>
    </item>
    <item>
      <title>Re: How can you restrict a timechart to display only weekdays?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-you-restrict-a-timechart-to-display-only-weekdays/m-p/157932#M44483</link>
      <description>&lt;P&gt;Hi Phil&lt;BR /&gt;
In the search reference for the bin command, &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Bin"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Bin&lt;/A&gt; there are 4 bucketing options : &lt;BR /&gt;
bins=&lt;INT&gt;&lt;BR /&gt;
minspan=&lt;SPAN-LENGTH&gt;&lt;BR /&gt;
span=&lt;LOG-SPAN&gt; | &lt;SPAN-LENGTH&gt; &lt;BR /&gt;
&lt;START-END&gt;&lt;/START-END&gt;&lt;/SPAN-LENGTH&gt;&lt;/LOG-SPAN&gt;&lt;/SPAN-LENGTH&gt;&lt;/INT&gt;&lt;/P&gt;

&lt;P&gt;Dave&lt;/P&gt;</description>
      <pubDate>Wed, 27 Nov 2013 14:16:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-you-restrict-a-timechart-to-display-only-weekdays/m-p/157932#M44483</guid>
      <dc:creator>davebrooking</dc:creator>
      <dc:date>2013-11-27T14:16:06Z</dc:date>
    </item>
    <item>
      <title>Re: How can you restrict a timechart to display only weekdays?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-you-restrict-a-timechart-to-display-only-weekdays/m-p/157933#M44484</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I don't see the point of your first question if you only get data from last 24 hours, as you won't need to exclude data.&lt;/P&gt;

&lt;P&gt;Anyway, i think you could calculate the buckets size dinamycally using this:&lt;BR /&gt;
addinfo : to include searh earliest and latest time in epoch. Then substract the earliest to the latest, you get the difference in seconds. Then use eval with a case like:&lt;BR /&gt;
case(diff&amp;lt;86000,"1h",diff&amp;gt;86000,"1d"). This will calculate the buckets size for your bin command&lt;/P&gt;

&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Wed, 27 Nov 2013 14:21:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-you-restrict-a-timechart-to-display-only-weekdays/m-p/157933#M44484</guid>
      <dc:creator>gfuente</dc:creator>
      <dc:date>2013-11-27T14:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: How can you restrict a timechart to display only weekdays?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-you-restrict-a-timechart-to-display-only-weekdays/m-p/157934#M44485</link>
      <description>&lt;P&gt;That works Martin. Thanks a lot guys.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Nov 2013 14:38:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-you-restrict-a-timechart-to-display-only-weekdays/m-p/157934#M44485</guid>
      <dc:creator>philallen1</dc:creator>
      <dc:date>2013-11-27T14:38:03Z</dc:date>
    </item>
  </channel>
</rss>

