<?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 with Where Clause in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-proper-search-for-timechart-with-where-clause/m-p/522111#M147211</link>
    <description>&lt;P&gt;Try using all uppercase WHERE&lt;/P&gt;&lt;P&gt;for example :-&lt;BR /&gt;timechart count by user WHERE user&amp;gt;200&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 22:01:07 GMT</pubDate>
    <dc:creator>rajanala</dc:creator>
    <dc:date>2020-09-29T22:01:07Z</dc:date>
    <item>
      <title>How to achieve proper search for timechart with where clause?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-proper-search-for-timechart-with-where-clause/m-p/19613#M2978</link>
      <description>&lt;P&gt;Here is my search:&lt;/P&gt;
&lt;P&gt;source="WinEventLog:Security" EventCode=540 | timechart span=1h count by User&lt;/P&gt;
&lt;P&gt;This gives me the count by hour that users are logging in but I only want the users that are exceeding a threshold like 200 times an hour, so I do this.&lt;/P&gt;
&lt;P&gt;source="WinEventLog:Security" EventCode=540 | timechart span=1h count by User Where count&amp;gt;200&lt;/P&gt;
&lt;P&gt;But this does not work&lt;/P&gt;</description>
      <pubDate>Wed, 21 Sep 2022 20:21:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-proper-search-for-timechart-with-where-clause/m-p/19613#M2978</guid>
      <dc:creator>hartfoml</dc:creator>
      <dc:date>2022-09-21T20:21:59Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart with Where Clause</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-proper-search-for-timechart-with-where-clause/m-p/19614#M2979</link>
      <description>&lt;P&gt;Because the count field is not in the timechart results.The count value is part of the various User fields.&lt;/P&gt;

&lt;P&gt;Something like this might work better for you :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="WinEventLog:Security" EventCode=540 | bucket span=1h _time | stats count by _time User  | where count &amp;gt; 200 | xyseries _time,User,count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 Apr 2012 01:53:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-proper-search-for-timechart-with-where-clause/m-p/19614#M2979</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2012-04-05T01:53:03Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart with Where Clause</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-proper-search-for-timechart-with-where-clause/m-p/19615#M2980</link>
      <description>&lt;P&gt;Right I tried this and did get the results but not the format for charting&lt;/P&gt;

&lt;P&gt;My intent is to have a chart with one line per user showing the number of EventCode 540/hour for over time.  With stats I don't know how to make the chart I need. I thought to use "limit" but then I only get the top # of users and not the user exceeding the threshold.&lt;/P&gt;

&lt;P&gt;How is the count field not in the timechart results?  I get a result for count in the output.  If I knew the field for count I could do a "where" on the field.  Can I rename count like this?&lt;/P&gt;

&lt;P&gt;| timechart span=1h count AS Number by User Where Number &amp;gt; 200&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2012 12:45:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-proper-search-for-timechart-with-where-clause/m-p/19615#M2980</guid>
      <dc:creator>hartfoml</dc:creator>
      <dc:date>2012-04-05T12:45:21Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart with Where Clause</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-proper-search-for-timechart-with-where-clause/m-p/19616#M2981</link>
      <description>&lt;P&gt;nope, i dont think the where clause can act on results of the chart, only fields within the search. renaming using AS only changes the name in the chart. this search fails to display the data the way you want. &lt;BR /&gt;
index=cisco_firewall error_code=106023 | chart count(error_code) AS number by src where number&amp;gt;50&lt;/P&gt;

&lt;P&gt;however, i am sure there is a way to get what you need.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 11:37:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-proper-search-for-timechart-with-where-clause/m-p/19616#M2981</guid>
      <dc:creator>cvajs</dc:creator>
      <dc:date>2020-09-28T11:37:46Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart with Where Clause</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-proper-search-for-timechart-with-where-clause/m-p/19617#M2982</link>
      <description>&lt;P&gt;I used this code for now since I could not find how to use the where clause with TimeChart.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| timechart limit=5 span=1h count by User useother=f 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I tried this code:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| timechart span=1h count(EventCode) by User useother=f where count &amp;gt; 200
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But this didn't work.  I tried this code:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| timechart span=1h (EVAL count(EventCode)) by User useother=f where count &amp;gt; 200
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But this didn't work either.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2012 14:18:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-proper-search-for-timechart-with-where-clause/m-p/19617#M2982</guid>
      <dc:creator>hartfoml</dc:creator>
      <dc:date>2012-04-05T14:18:52Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart with Where Clause</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-proper-search-for-timechart-with-where-clause/m-p/19618#M2983</link>
      <description>&lt;P&gt;Find the list of users over the threshold with a subsearch, then search for only those users, and timechart it.&lt;/P&gt;

&lt;P&gt;Example only, not definitive:&lt;/P&gt;

&lt;PRE&gt;
source="WinEventLog:Security" EventCode=540
  [ search source="WinEventLog:Security" EventCode=540 | stats count by User | where count &amp;gt; 200 | fields + User ]
  | timechart count by User
&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 Apr 2012 15:16:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-proper-search-for-timechart-with-where-clause/m-p/19618#M2983</guid>
      <dc:creator>sowings</dc:creator>
      <dc:date>2012-04-05T15:16:41Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart with Where Clause</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-proper-search-for-timechart-with-where-clause/m-p/19619#M2984</link>
      <description>&lt;P&gt;Add an "xyseries" command to format the stats output for the charting you require.&lt;BR /&gt;
I have edited my original answer showing how to do this.&lt;BR /&gt;
Enjoy !&lt;/P&gt;</description>
      <pubDate>Fri, 06 Apr 2012 07:18:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-proper-search-for-timechart-with-where-clause/m-p/19619#M2984</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2012-04-06T07:18:07Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart with Where Clause</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-proper-search-for-timechart-with-where-clause/m-p/19620#M2985</link>
      <description>&lt;P&gt;I love this approach.  However, there seems to be a caveat.  If I use "where count=0", nothing returns, even though there are "cells" in my xyseries without a count (count=0).  If tried to insert ifnull logic to the count, but I didn't pull it off.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jul 2014 14:41:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-proper-search-for-timechart-with-where-clause/m-p/19620#M2985</guid>
      <dc:creator>essklau</dc:creator>
      <dc:date>2014-07-22T14:41:55Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart with Where Clause</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-proper-search-for-timechart-with-where-clause/m-p/19621#M2986</link>
      <description>&lt;P&gt;I had this same problem.&lt;BR /&gt;
I also ended up using " | bucket ... | stats ... | where ... " to get what I needed.&lt;/P&gt;

&lt;P&gt;It seems like the timechart documentation says it, the original problem above, should work:&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.0.2/SearchReference/Timechart" target="_blank"&gt;http://docs.splunk.com/Documentation/Splunk/6.0.2/SearchReference/Timechart&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Example 4: Using the where clause with the count function measures the total number of events over the period. This yields results similar to using the sum function.&lt;BR /&gt;
The following two searches returns the sources series with a total count of events greater than 100. All other series values will be labeled as "other".&lt;BR /&gt;
index=_internal | timechart span=1h count by source WHERE count &amp;gt; 100&lt;BR /&gt;
index=_internal | timechart span=1h count by source WHERE sum &amp;gt; 100&lt;/P&gt;

&lt;P&gt;Am I reading this right?&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;Because the count field is not in the timechart results.The count value is part of the various User fields.&lt;BR /&gt;
So is this documentation wrong?&lt;BR /&gt;
If so, can it be corrected?&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;Thanks for the info!&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 17:46:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-proper-search-for-timechart-with-where-clause/m-p/19621#M2986</guid>
      <dc:creator>wjblazek</dc:creator>
      <dc:date>2020-09-28T17:46:10Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart with Where Clause</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-proper-search-for-timechart-with-where-clause/m-p/19622#M2987</link>
      <description>&lt;P&gt;I'm just taking this from memory (I can't run a test whilst I write this), but I think it's just:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;source="WinEventLog:Security" EventCode=540 | timechart span=1h count by User where max &amp;gt; 200&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2016 08:52:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-proper-search-for-timechart-with-where-clause/m-p/19622#M2987</guid>
      <dc:creator>tedwroks</dc:creator>
      <dc:date>2016-10-19T08:52:41Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart with Where Clause</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-proper-search-for-timechart-with-where-clause/m-p/19623#M2988</link>
      <description>&lt;P&gt;This is exactly what I needed, thanks&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2019 08:17:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-proper-search-for-timechart-with-where-clause/m-p/19623#M2988</guid>
      <dc:creator>splunklearner12</dc:creator>
      <dc:date>2019-07-09T08:17:59Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart with Where Clause</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-proper-search-for-timechart-with-where-clause/m-p/507225#M141843</link>
      <description>&lt;P&gt;Anyone here got the solution worked? I have tried with bucket -&amp;gt; stats -&amp;gt; where but it is not working for me. Here is my query:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;....| dedup customerID | bucket span=2h _time | stats count as "Actived customer" by Event where count &amp;gt; 0 | xyseries _time, customerID, count&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jul 2020 10:18:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-proper-search-for-timechart-with-where-clause/m-p/507225#M141843</guid>
      <dc:creator>thinhdinh</dc:creator>
      <dc:date>2020-07-03T10:18:12Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart with Where Clause</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-proper-search-for-timechart-with-where-clause/m-p/522111#M147211</link>
      <description>&lt;P&gt;Try using all uppercase WHERE&lt;/P&gt;&lt;P&gt;for example :-&lt;BR /&gt;timechart count by user WHERE user&amp;gt;200&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 22:01:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-proper-search-for-timechart-with-where-clause/m-p/522111#M147211</guid>
      <dc:creator>rajanala</dc:creator>
      <dc:date>2020-09-29T22:01:07Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart with Where Clause</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-proper-search-for-timechart-with-where-clause/m-p/613993#M213364</link>
      <description>&lt;P&gt;i used as per suggestion but it didn't work for '0' ? any other options Please&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Sep 2022 20:16:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-proper-search-for-timechart-with-where-clause/m-p/613993#M213364</guid>
      <dc:creator>DT</dc:creator>
      <dc:date>2022-09-21T20:16:05Z</dc:date>
    </item>
  </channel>
</rss>

