<?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: Do you think we can optimize this long search? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356602#M164223</link>
    <description>&lt;P&gt;yes but here we are doing for only specific queues but if I want to do multiple queues, what I need to do?&lt;BR /&gt;
I'm thinking that I need to use tokens for multiple queues, is that right?&lt;/P&gt;</description>
    <pubDate>Fri, 22 Dec 2017 03:51:24 GMT</pubDate>
    <dc:creator>venkatesh296</dc:creator>
    <dc:date>2017-12-22T03:51:24Z</dc:date>
    <item>
      <title>Do you think we can optimize this long search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356594#M164215</link>
      <description>&lt;P&gt;The search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=queues sourcetype="jms:queues" "Queues.name"="road.sa**" earliest=-5m@m 
| stats max("Queues.pendingMessageCount") as "maxpendingcount_current" by "Queues.name" 
|join type=outer "Queues.name"[search index=queuesqueues sourcetype="jms:queues" 
"Queues.name"="road.sa**" earliest=-1h@-5m latest=-1h  | stats max("Queues.pendingMessageCount") 
as "maxpendingcount_Earlier" by "Queues.name"] |eval onehr_growth=round(((maxpendingcount_current-maxpendingcount_E
arlier)/maxpendingcount_Earlier)*100,2) |appendcols[search index=queuesqueues sourcetype="jms:queues" 
"Queues.name"="road.sa**" earliest=-5m@m | stats max("Queues.pendingMessageCount") as "maxpendingcou
nt_current" by "Queues.name" |join type=outer "Queues.name"[search index=queuesqueues sourcetype="jms:queu
es" "Queues.name"="road.sa**" earliest=-7d@-5m latest=-7d  | stats max("Queues.pendingMessageCount") 
as "maxpendingcount_7dEarlier" by "Queues.name"]|eval sevenday_growth=round(((maxpendingcount_current-maxpendingco
unt_7dEarlier)/maxpendingcount_7dEarlier)*100,2) ] |search onehr_growth&amp;gt;300 AND sevenday_growth&amp;gt;300 | table "Queue
s.name",maxpendingcount_current,maxpendingcount_Earlier, onehr_growth, maxpendingcount_7dEarlier, sevenday_growth
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Dec 2017 19:56:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356594#M164215</guid>
      <dc:creator>venkatesh296</dc:creator>
      <dc:date>2017-12-21T19:56:24Z</dc:date>
    </item>
    <item>
      <title>Re: Do you think we can optimize this long search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356595#M164216</link>
      <description>&lt;P&gt;Yes.  Here is an optimization for readability ( you can do the same by pressing ctrl+\ in your Splunk search)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=queues sourcetype="jms:queues" "Queues.name"="road.sa*" earliest=-5m@m 
| stats max("Queues.pendingMessageCount") as "maxpendingcount_current" by "Queues.name" 
| join type=outer "Queues.name" 
    [ search index=queuesqueues sourcetype="jms:queues" "Queues.name"="road.sa" earliest=-1h@-5m latest=-1h 
    | stats max("Queues.pendingMessageCount") as "maxpendingcount_Earlier" by "Queues.name"] 
| eval onehr_growth=round(((maxpendingcount_current-maxpendingcount_Earlier)/maxpendingcount_Earlier)100,2) 
| appendcols 
    [ search index=queuesqueues sourcetype="jms:queues" "Queues.name"="road.sa" earliest=-5m@m 
    | stats max("Queues.pendingMessageCount") as "maxpendingcount_current" by "Queues.name" 
    | join type=outer "Queues.name" 
        [ search index=queuesqueues sourcetype="jms:queues" "Queues.name"="road.sa**" earliest=-7d@-5m latest=-7d 
        | stats max("Queues.pendingMessageCount") as "maxpendingcount_7dEarlier" by "Queues.name"] 
    | eval sevenday_growth=round(((maxpendingcount_current-maxpendingcount_7dEarlier)/maxpendingcount_7dEarlier)*100,2) ] 
| search onehr_growth&amp;gt;300 AND sevenday_growth&amp;gt;300 
| table "Queues.name",maxpendingcount_current,maxpendingcount_Earlier, onehr_growth, maxpendingcount_7dEarlier, sevenday_growth
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Dec 2017 21:51:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356595#M164216</guid>
      <dc:creator>MonkeyK</dc:creator>
      <dc:date>2017-12-21T21:51:38Z</dc:date>
    </item>
    <item>
      <title>Re: Do you think we can optimize this long search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356596#M164217</link>
      <description>&lt;P&gt;It's pretty difficult to modify searches without knowing:&lt;/P&gt;

&lt;P&gt;a) the intent of the search (what you want the results to look like and represent)&lt;BR /&gt;
b) some sample data to test with&lt;/P&gt;</description>
      <pubDate>Thu, 21 Dec 2017 22:11:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356596#M164217</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2017-12-21T22:11:24Z</dc:date>
    </item>
    <item>
      <title>Re: Do you think we can optimize this long search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356597#M164218</link>
      <description>&lt;P&gt;next, you should be able to get rid of one of your searches for "Queues.name"="road.sa" for the last 5m&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=queues sourcetype="jms:queues" "Queues.name"="road.sa*" earliest=-5m@m 
| stats max("Queues.pendingMessageCount") as "maxpendingcount_current" by "Queues.name" 
| join type=outer "Queues.name" 
    [ search index=queuesqueues sourcetype="jms:queues" "Queues.name"="road.sa" earliest=-1h@-5m latest=-1h 
    | stats max("Queues.pendingMessageCount") as "maxpendingcount_Earlier" by "Queues.name"] 
| eval onehr_growth=round(((maxpendingcount_current-maxpendingcount_Earlier)/maxpendingcount_Earlier)100,2) 
| join type=outer "Queues.name" 
     [ search index=queuesqueues sourcetype="jms:queues" "Queues.name"="road.sa**" earliest=-7d@-5m latest=-7d 
     | stats max("Queues.pendingMessageCount") as "maxpendingcount_7dEarlier" by "Queues.name"]
| eval sevenday_growth=round(((maxpendingcount_current-maxpendingcount_7dEarlier)/maxpendingcount_7dEarlier)*100,2)
| search onehr_growth&amp;gt;300 AND sevenday_growth&amp;gt;300 
| table "Queues.name",maxpendingcount_current,maxpendingcount_Earlier, onehr_growth, maxpendingcount_7dEarlier, sevenday_growth
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Dec 2017 22:12:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356597#M164218</guid>
      <dc:creator>MonkeyK</dc:creator>
      <dc:date>2017-12-21T22:12:29Z</dc:date>
    </item>
    <item>
      <title>Re: Do you think we can optimize this long search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356598#M164219</link>
      <description>&lt;P&gt;After that, I might remove the joins and just append the values that you are interested in.  you will be able to summarize by Queue.name:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=queues sourcetype="jms:queues" "Queues.name"="road.sa*" earliest=-5m@m 
| stats max("Queues.pendingMessageCount") as "maxpendingcount_current" by "Queues.name" 
| append [|search index=queuesqueues sourcetype="jms:queues" "Queues.name"="road.sa" earliest=-1h@-5m latest=-1h 
    | stats max("Queues.pendingMessageCount") as "maxpendingcount_Earlier" by "Queues.name"]
| append [|search index=queuesqueues sourcetype="jms:queues" "Queues.name"="road.sa**" earliest=-7d@-5m latest=-7d 
     | stats max("Queues.pendingMessageCount") as "maxpendingcount_7dEarlier" by "Queues.name"]
| stats max("maxpendingcount_current") max("maxpendingcount_Earlier") max("maxpendingcount_7dEarlier") by "Queues.name"
| eval onehr_growth=round(((maxpendingcount_current-maxpendingcount_Earlier)/maxpendingcount_Earlier)100,2) 
| eval sevenday_growth=round(((maxpendingcount_current-maxpendingcount_7dEarlier)/maxpendingcount_7dEarlier)*100,2)
| search onehr_growth&amp;gt;300 AND sevenday_growth&amp;gt;300 
| table "Queues.name",maxpendingcount_current,maxpendingcount_Earlier, onehr_growth, maxpendingcount_7dEarlier, sevenday_growth
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I left the stats in the appends because I do not know how much data they are summarizing.  If the totals are small, you could just append the pendingMessageCounts and do a single stats at the end:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=queues sourcetype="jms:queues" "Queues.name"="road.sa*" earliest=-5m@m 
| stats max("Queues.pendingMessageCount") as "maxpendingcount_current" by "Queues.name" 
| append [|search index=queuesqueues sourcetype="jms:queues" "Queues.name"="road.sa" earliest=-1h@-5m latest=-1h 
    | rename "Queues.pendingMessageCount" as "maxpendingcount_Earlier" 
    | table "maxpendingcount_Earlier" "Queues.name"]
| append [|search index=queuesqueues sourcetype="jms:queues" "Queues.name"="road.sa**" earliest=-7d@-5m latest=-7d 
    | rename "Queues.pendingMessageCount" as "maxpendingcount_7dEarlier" 
    | table "maxpendingcount_7dEarlier" "Queues.name"]
| stats max("maxpendingcount_current") max("maxpendingcount_Earlier") max("maxpendingcount_7dEarlier") by "Queues.name"
| eval onehr_growth=round(((maxpendingcount_current-maxpendingcount_Earlier)/maxpendingcount_Earlier)100,2) 
| eval sevenday_growth=round(((maxpendingcount_current-maxpendingcount_7dEarlier)/maxpendingcount_7dEarlier)*100,2)
| search onehr_growth&amp;gt;300 AND sevenday_growth&amp;gt;300 
| table "Queues.name",maxpendingcount_current,maxpendingcount_Earlier, onehr_growth, maxpendingcount_7dEarlier, sevenday_growth
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Dec 2017 22:20:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356598#M164219</guid>
      <dc:creator>MonkeyK</dc:creator>
      <dc:date>2017-12-21T22:20:04Z</dc:date>
    </item>
    <item>
      <title>Re: Do you think we can optimize this long search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356599#M164220</link>
      <description>&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Fri, 22 Dec 2017 00:58:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356599#M164220</guid>
      <dc:creator>venkatesh296</dc:creator>
      <dc:date>2017-12-22T00:58:00Z</dc:date>
    </item>
    <item>
      <title>Re: Do you think we can optimize this long search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356600#M164221</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
     My intention was the result should compare the queues with the last 7 days, current and then if the growth is greater than some X then the result need to display.Let me know if you need anything.&lt;BR /&gt;
Thanks,&lt;BR /&gt;
-Venkat&lt;/P&gt;</description>
      <pubDate>Fri, 22 Dec 2017 01:02:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356600#M164221</guid>
      <dc:creator>venkatesh296</dc:creator>
      <dc:date>2017-12-22T01:02:16Z</dc:date>
    </item>
    <item>
      <title>Re: Do you think we can optimize this long search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356601#M164222</link>
      <description>&lt;P&gt;Does it do what you are hoping for?&lt;/P&gt;</description>
      <pubDate>Fri, 22 Dec 2017 02:57:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356601#M164222</guid>
      <dc:creator>MonkeyK</dc:creator>
      <dc:date>2017-12-22T02:57:07Z</dc:date>
    </item>
    <item>
      <title>Re: Do you think we can optimize this long search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356602#M164223</link>
      <description>&lt;P&gt;yes but here we are doing for only specific queues but if I want to do multiple queues, what I need to do?&lt;BR /&gt;
I'm thinking that I need to use tokens for multiple queues, is that right?&lt;/P&gt;</description>
      <pubDate>Fri, 22 Dec 2017 03:51:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356602#M164223</guid>
      <dc:creator>venkatesh296</dc:creator>
      <dc:date>2017-12-22T03:51:24Z</dc:date>
    </item>
    <item>
      <title>Re: Do you think we can optimize this long search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356603#M164224</link>
      <description>&lt;P&gt;I guess that depends on how the queue names are related.  I think that they are the same&lt;BR /&gt;
for each part of the query since you joined on Queues.name&lt;BR /&gt;
If queue name is really common across all queries, you should be able to remove or refine the search term and it will work just fine.&lt;/P&gt;

&lt;P&gt;if there is a more complicated relationship, accounting for it will take some more work (not necessarily requiring a token, though)&lt;/P&gt;</description>
      <pubDate>Fri, 22 Dec 2017 12:14:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356603#M164224</guid>
      <dc:creator>MonkeyK</dc:creator>
      <dc:date>2017-12-22T12:14:19Z</dc:date>
    </item>
    <item>
      <title>Re: Do you think we can optimize this long search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356604#M164225</link>
      <description>&lt;P&gt;@venkatesh296&lt;BR /&gt;
I edited your post and used the code (101010) button on that text so special characters won't get eaten by the rendering.&lt;/P&gt;

&lt;P&gt;You might want to a) confirm it's still right and b) maybe even reformat it to include newlines and spacing to make it easier to read.  You can do that while it is a search in your Splunk search bar by pressing Ctrl-\ (control - backslash) and it'll reformat it all pretty for you.  Then paste THAT one in.&lt;/P&gt;

&lt;P&gt;But either way, it's probably good enough now!&lt;/P&gt;

&lt;P&gt;-Rich&lt;/P&gt;</description>
      <pubDate>Fri, 22 Dec 2017 12:36:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356604#M164225</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2017-12-22T12:36:19Z</dc:date>
    </item>
    <item>
      <title>Re: Do you think we can optimize this long search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356605#M164226</link>
      <description>&lt;P&gt;AND, somewhere along the line I TOTALLY did not see the fixups already applied.  &lt;/P&gt;

&lt;P&gt;Duh.&lt;/P&gt;

&lt;P&gt;Ignore my comments. Problem sorted. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;-Rich&lt;/P&gt;</description>
      <pubDate>Fri, 22 Dec 2017 12:37:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356605#M164226</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2017-12-22T12:37:35Z</dc:date>
    </item>
    <item>
      <title>Re: Do you think we can optimize this long search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356606#M164227</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
      Before doing statistics I just tried this but it showing values for one field i.e; maxpendingcount_current. can I know why?&lt;/P&gt;

&lt;P&gt;index=queues sourcetype="jms:queues" "Queues.name"="road.sa*" earliest=-5m@m &lt;BR /&gt;
| rename Queues.pendingMessageCount as maxpendingcount_current &lt;BR /&gt;
| table maxpendingcount_current Queues.name &lt;BR /&gt;
| append &lt;BR /&gt;
    [| search index=queues sourcetype="jms:queues" "Queues.name"="road.sa*" earliest=-1h@-5m latest=-1h &lt;BR /&gt;
    | rename Queues.pendingMessageCount as maxpendingcount_Earlier &lt;BR /&gt;
    | table maxpendingcount_Earlier Queues.name] &lt;BR /&gt;
| append &lt;BR /&gt;
    [| search index=queues sourcetype="jms:queues" "Queues.name"="road.sa*" earliest=-7d@-5m latest=-7d &lt;BR /&gt;
    | rename Queues.pendingMessageCount as maxpendingcount_7dEarlier &lt;BR /&gt;
    | table maxpendingcount_7dEarlier Queues.name]&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:21:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356606#M164227</guid>
      <dc:creator>venkatesh296</dc:creator>
      <dc:date>2020-09-29T17:21:28Z</dc:date>
    </item>
    <item>
      <title>Re: Do you think we can optimize this long search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356607#M164228</link>
      <description>&lt;P&gt;this is how the results showing for above query&lt;/P&gt;

&lt;P&gt;maxpendingcount_current Queues.name maxpendingcount_7dEarlier   maxpendingcount_Earlier&lt;BR /&gt;
0   .SCAN06&lt;BR /&gt;&lt;BR /&gt;
0   t.SCAN00&lt;BR /&gt;&lt;BR /&gt;
0   it.SCAN11&lt;BR /&gt;&lt;BR /&gt;
0   FAN10&lt;BR /&gt;&lt;BR /&gt;
0   FSCAN09&lt;BR /&gt;&lt;BR /&gt;
0   N08&lt;BR /&gt;&lt;BR /&gt;
0   N07&lt;BR /&gt;&lt;BR /&gt;
0   N06&lt;BR /&gt;&lt;BR /&gt;
0   AN05&lt;BR /&gt;&lt;BR /&gt;
0   AN04&lt;BR /&gt;&lt;BR /&gt;
0   FXS3&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:21:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356607#M164228</guid>
      <dc:creator>venkatesh296</dc:creator>
      <dc:date>2020-09-29T17:21:30Z</dc:date>
    </item>
    <item>
      <title>Re: Do you think we can optimize this long search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356608#M164229</link>
      <description>&lt;P&gt;My first guess would be that the appending searches are not returning data.  Can you try them separately.  If they return nothing, then we need to fix them first.&lt;/P&gt;

&lt;P&gt;One difference that I noticed is that in your original query, those searches were against&lt;BR /&gt;
index=queuesqueues&lt;BR /&gt;
while in your most recent example, they are searching against&lt;BR /&gt;
index=queues&lt;/P&gt;</description>
      <pubDate>Fri, 22 Dec 2017 15:35:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356608#M164229</guid>
      <dc:creator>MonkeyK</dc:creator>
      <dc:date>2017-12-22T15:35:24Z</dc:date>
    </item>
    <item>
      <title>Re: Do you think we can optimize this long search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356609#M164230</link>
      <description>&lt;P&gt;when I running the individual searches its working, after that I run the stats command, then it showing results&lt;BR /&gt;
but after that I'm running eval but these fields are not showing in interesting fields.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Dec 2017 16:25:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356609#M164230</guid>
      <dc:creator>venkatesh296</dc:creator>
      <dc:date>2017-12-22T16:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: Do you think we can optimize this long search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356610#M164231</link>
      <description>&lt;P&gt;interesting fields is influenced by your search mode.  If you are in "fast mode" or "smart mode", and you do stats, you will not get interesting fields.  &lt;/P&gt;

&lt;P&gt;I have found that depending on the nature of the query, you may even get nothing back in "verbose mode".  I think that this is just because there are so few fields to analyze.&lt;/P&gt;

&lt;P&gt;That said, I would like to make sure that I have solved your original problem.   It sounds like you are getting the stats with max values for maxpendingcount_current, maxpendingcount_Earlier, and maxpendingcount_7dEarlier.  Is that correct?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:25:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356610#M164231</guid>
      <dc:creator>MonkeyK</dc:creator>
      <dc:date>2020-09-29T17:25:36Z</dc:date>
    </item>
    <item>
      <title>Re: Do you think we can optimize this long search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356611#M164232</link>
      <description>&lt;P&gt;after getting the max values I need to get the difference between them, are you in slack?&lt;/P&gt;</description>
      <pubDate>Fri, 22 Dec 2017 17:03:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356611#M164232</guid>
      <dc:creator>venkatesh296</dc:creator>
      <dc:date>2017-12-22T17:03:29Z</dc:date>
    </item>
    <item>
      <title>Re: Do you think we can optimize this long search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356612#M164233</link>
      <description>&lt;P&gt;Sorry, I am not in slack (and my work firewall would prevent it if I were).&lt;/P&gt;

&lt;P&gt;So you are getting stats and now are having trouble with eval?  Can you post a sample of what you see from stats and also the eval statement that is problematic?&lt;/P&gt;</description>
      <pubDate>Fri, 22 Dec 2017 18:43:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356612#M164233</guid>
      <dc:creator>MonkeyK</dc:creator>
      <dc:date>2017-12-22T18:43:40Z</dc:date>
    </item>
    <item>
      <title>Re: Do you think we can optimize this long search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356613#M164234</link>
      <description>&lt;P&gt;One thing that I see, is it seems you're running a search over the current timeframe multiple times. It might be more efficient if you only iterated over each timeframe once... You'll want to play with the &lt;A href="https://docs.splunk.com/Documentation/Splunk/7.0.1/Search/ViewsearchjobpropertieswiththeJobInspector"&gt;job inspector&lt;/A&gt; to evaluate if these options would be more efficient or not.&lt;/P&gt;

&lt;P&gt;These are three options I came up with that you may want to look into:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=queues sourcetype="jms:queues" "Queues.name"="road.sa*" ((earliest=-5m latest=now) OR (earliest=-1h-5m latest=-1h) OR (earliest=-7d-5m latest=-7d))
| eval timeframe=case(_time&amp;gt;=relative_time(now(),"-5m"),"c", _time&amp;gt;=relative_time(now(),"-1h-5m"),"p1h",1=1,"p7d")
| chart max("Queues.pendingMessageCount") over "Queues.name" by timeframe
| eval onehr_growth=round((c-p1h)/p1h*100,2),sevenday_growth=round((c-p7d)/p7d*100,2) 
| where onehr_growth&amp;gt;300 AND sevenday_growth&amp;gt;300
| table "Queues.name",c,p1h,onehr_growth,p7d,sevenday_growth
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The above would run a search across the time range of &lt;CODE&gt;[-7d-5m, now]&lt;/CODE&gt;, and filters based on _time... &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| multisearch
  [search index=queues sourcetype="jms:queues" "Queues.name"="road.sa*" (earliest=-5m latest=now) | eval timeframe="c" | fields "Queues.pendingMessageCount","Queues.name",timeframe ]
  [search index=queues sourcetype="jms:queues" "Queues.name"="road.sa*" (earliest=-1h-5m latest=-1h) | eval timeframe="p1h" | fields "Queues.pendingMessageCount","Queues.name",timeframe]
  [search index=queues sourcetype="jms:queues" "Queues.name"="road.sa*" (earliest=-7d-5m latest=-7d) | eval timeframe="p7d" | fields "Queues.pendingMessageCount","Queues.name",timeframe]
| chart max("Queues.pendingMessageCount") over "Queues.name" by timeframe
| eval onehr_growth=round((c-p1h)/p1h*100,2),sevenday_growth=round((c-p7d)/p7d*100,2) 
| where onehr_growth&amp;gt;300 AND sevenday_growth&amp;gt;300
| table "Queues.name",c,p1h,onehr_growth,p7d,sevenday_growth
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This one is similar to the previous one, but instead of searching the entire timeframe, uses &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Multisearch"&gt;multisearch&lt;/A&gt; to limit the timeranges being searched.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=queues sourcetype="jms:queues" "Queues.name"="road.sa*" (earliest=-5m latest=now) | eval timeframe="c" | stats max("Queues.pendingMessageCount") as mc by "Queues.name", timeframe
| append [search index=queues sourcetype="jms:queues" "Queues.name"="road.sa*" (earliest=-1h-5m latest=-1h) | eval timeframe="p1h" | stats max("Queues.pendingMessageCount") as mc by "Queues.name", timeframe]
| append [search index=queues sourcetype="jms:queues" "Queues.name"="road.sa*" (earliest=-7d-5m latest=-7d) | eval timeframe="p7d" | stats max("Queues.pendingMessageCount") as mc by "Queues.name", timeframe]
| xyseries "Queues.name" timeframe mc
| eval onehr_growth=round((c-p1h)/p1h*100,2),sevenday_growth=round((c-p7d)/p7d*100,2) 
| where onehr_growth&amp;gt;300 AND sevenday_growth&amp;gt;300
| table "Queues.name",c,p1h,onehr_growth,p7d,sevenday_growth
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This one is the closest to yours, instead of using join, using append to gather the independent sets of data, and then using &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/xyseries"&gt;xyseries&lt;/A&gt; to combine the statistics from all three.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Dec 2017 20:28:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Do-you-think-we-can-optimize-this-long-search/m-p/356613#M164234</guid>
      <dc:creator>acharlieh</dc:creator>
      <dc:date>2017-12-22T20:28:04Z</dc:date>
    </item>
  </channel>
</rss>

