<?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 do I optimize a search with too many eval commands? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-optimize-a-search-with-too-many-eval-commands/m-p/233846#M69486</link>
    <description>&lt;P&gt;The only field you need from those events is the x_status and the _time, so explicitly get rid of everything else the first moment that you can, using the fields command.  Try this and see what happens to your search time.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=my_sanitized_index_name sourcetype=web_access_logs | fields _time x_status 
| timechart count(eval(x_Status &amp;lt; 400)) as Success count(eval(x_Status&amp;gt;=400)) as Failure 
| addtotal row=f col=t labelfield=_time 
| eval SuccessRate = 100 * Success / (Success + Failure)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 10 Jan 2017 17:01:39 GMT</pubDate>
    <dc:creator>DalJeanis</dc:creator>
    <dc:date>2017-01-10T17:01:39Z</dc:date>
    <item>
      <title>How do I optimize a search with too many eval commands?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-optimize-a-search-with-too-many-eval-commands/m-p/233840#M69480</link>
      <description>&lt;P&gt;The search used looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=my_sanitized_index_name sourcetype=web_access_logs | timechart count(eval(x_Status &amp;lt; 400)) as Success count(eval(x_Status&amp;gt;=400)) as Failure | addtotal row=f col=t labelfield=_time | eval SuccessRate = 100 * Success / (Success + Failure)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Where x_Status is the return code from a web server farm's collective access logs&lt;/P&gt;

&lt;P&gt;In its current form, I did a search for the "last 15 minutes". It found 859,984 events and took 25.384 seconds to execute. I need to run this thing to give me stats for the last week. It usually stops working around the third hour.&lt;/P&gt;

&lt;P&gt;I am completely new to Splunk, I am certain there is a better way to do this. I just don't know what that is. Help?&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2017 22:30:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-optimize-a-search-with-too-many-eval-commands/m-p/233840#M69480</guid>
      <dc:creator>OstermanA</dc:creator>
      <dc:date>2017-01-09T22:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: How do I optimize a search with too many eval commands?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-optimize-a-search-with-too-many-eval-commands/m-p/233841#M69481</link>
      <description>&lt;P&gt;IMHO, your problem is not with the number of &lt;CODE&gt;eval&lt;/CODE&gt; commands (which isn't that many), but with the sheer number of events you're trying to process.  Those hundreds of millions of events should be distributed among many indexers for best performance.&lt;/P&gt;

&lt;P&gt;But that doesn't help you now.  Consider running your search across small intervals like you're doing, but save the results in a summary index.  Then run another search to collect the data from the summary search into your weekly report.  That will be much faster.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2017 23:18:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-optimize-a-search-with-too-many-eval-commands/m-p/233841#M69481</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2017-01-09T23:18:11Z</dc:date>
    </item>
    <item>
      <title>Re: How do I optimize a search with too many eval commands?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-optimize-a-search-with-too-many-eval-commands/m-p/233842#M69482</link>
      <description>&lt;P&gt;See if this make some improvements.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=my_sanitized_index_name sourcetype=web_access_logs | eval Type=if(x_Status&amp;lt;400,"Success","Failure") | timechart count by Type | addtotal row=f col=t labelfield=_time | eval SuccessRate = 100 * Success / (Success + Failure)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Jan 2017 23:31:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-optimize-a-search-with-too-many-eval-commands/m-p/233842#M69482</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-01-09T23:31:08Z</dc:date>
    </item>
    <item>
      <title>Re: How do I optimize a search with too many eval commands?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-optimize-a-search-with-too-many-eval-commands/m-p/233843#M69483</link>
      <description>&lt;P&gt;More info on summary indexing here: &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.5.1/Knowledge/Usesummaryindexing"&gt;http://docs.splunk.com/Documentation/Splunk/6.5.1/Knowledge/Usesummaryindexing&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2017 23:32:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-optimize-a-search-with-too-many-eval-commands/m-p/233843#M69483</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-01-09T23:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: How do I optimize a search with too many eval commands?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-optimize-a-search-with-too-many-eval-commands/m-p/233844#M69484</link>
      <description>&lt;P&gt;That sounds promising. Can you link me to any documentation you would recommend as a good resource for a beginning Splunk user?&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2017 23:32:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-optimize-a-search-with-too-many-eval-commands/m-p/233844#M69484</guid>
      <dc:creator>OstermanA</dc:creator>
      <dc:date>2017-01-09T23:32:20Z</dc:date>
    </item>
    <item>
      <title>Re: How do I optimize a search with too many eval commands?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-optimize-a-search-with-too-many-eval-commands/m-p/233845#M69485</link>
      <description>&lt;P&gt;Well, The one above is good. A video is available here&lt;/P&gt;

&lt;P&gt;&lt;A href="http://www.splunk.com/view/SP-CAAACZW"&gt;http://www.splunk.com/view/SP-CAAACZW&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2017 23:47:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-optimize-a-search-with-too-many-eval-commands/m-p/233845#M69485</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-01-09T23:47:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do I optimize a search with too many eval commands?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-optimize-a-search-with-too-many-eval-commands/m-p/233846#M69486</link>
      <description>&lt;P&gt;The only field you need from those events is the x_status and the _time, so explicitly get rid of everything else the first moment that you can, using the fields command.  Try this and see what happens to your search time.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=my_sanitized_index_name sourcetype=web_access_logs | fields _time x_status 
| timechart count(eval(x_Status &amp;lt; 400)) as Success count(eval(x_Status&amp;gt;=400)) as Failure 
| addtotal row=f col=t labelfield=_time 
| eval SuccessRate = 100 * Success / (Success + Failure)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Jan 2017 17:01:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-optimize-a-search-with-too-many-eval-commands/m-p/233846#M69486</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-01-10T17:01:39Z</dc:date>
    </item>
    <item>
      <title>Re: How do I optimize a search with too many eval commands?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-optimize-a-search-with-too-many-eval-commands/m-p/233847#M69487</link>
      <description>&lt;P&gt;This cut down execution time by 75%. I still should probably look into setting up summary indices, but this was very helpful. Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2017 17:12:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-optimize-a-search-with-too-many-eval-commands/m-p/233847#M69487</guid>
      <dc:creator>OstermanA</dc:creator>
      <dc:date>2017-01-10T17:12:15Z</dc:date>
    </item>
    <item>
      <title>Re: How do I optimize a search with too many eval commands?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-optimize-a-search-with-too-many-eval-commands/m-p/233848#M69488</link>
      <description>&lt;P&gt;You're welcome.  richgalloway's answer is probably your best long-term solution, but for efficiency in splunk you should also always get rid of all the data you don't need at the earliest opportunity.  &lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2017 19:05:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-optimize-a-search-with-too-many-eval-commands/m-p/233848#M69488</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-01-10T19:05:29Z</dc:date>
    </item>
    <item>
      <title>Re: How do I optimize a search with too many eval commands?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-optimize-a-search-with-too-many-eval-commands/m-p/233849#M69489</link>
      <description>&lt;P&gt;Agree. In fact, would suggest to implement @DalJeanis's optimization method to your summary index search (and any other search) solution of @richgalloway.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2017 19:32:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-optimize-a-search-with-too-many-eval-commands/m-p/233849#M69489</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-01-10T19:32:03Z</dc:date>
    </item>
    <item>
      <title>Re: How do I optimize a search with too many eval commands?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-optimize-a-search-with-too-many-eval-commands/m-p/233850#M69490</link>
      <description>&lt;P&gt;@OstermanA - Looks like you have a few possible solutions to your question. If one of them provided a working solution, please don't forget to click "Accept" below the best answer to resolve this post. If you still need help, please leave a comment. Don’t forget to upvote anything that was helpful too. Thanks!&lt;/P&gt;</description>
      <pubDate>Sun, 22 Jan 2017 01:01:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-optimize-a-search-with-too-many-eval-commands/m-p/233850#M69490</guid>
      <dc:creator>aaraneta_splunk</dc:creator>
      <dc:date>2017-01-22T01:01:08Z</dc:date>
    </item>
  </channel>
</rss>

