<?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 How can I optimize the performance of my current base search and subsearches? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-optimize-the-performance-of-my-current-base-search-and/m-p/249785#M74559</link>
    <description>&lt;P&gt;I have a base search to collect all data and some subsearches that access these base searches to draw graphs.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Base search:&lt;/STRONG&gt; &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index = app sourcetype = airchangeservice "LogName=com.expedia.www.platform.diagnostics.tracing.TraceResources"  | rex "(?{[^}]+})" | mvexpand json_field | spath input=json_field | search (eventName="AIR_CANCEL_SERVICE" OR eventName="AIR_VOID_SERVICE")  | fields eventName, context.STATUS, context.TPID
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The subsearches draw graphs for different eventName, context.STATUS, context.TPID.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;See one of my subsearches:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;      &amp;lt;query&amp;gt;| search ("PROVIDER CODE":"TF") OR ("PROVIDER_CODE":"TF") AND  eventName="AIR_CANCEL_SERVICE"| timechart span=1d count by context.STATUS&amp;lt;/query&amp;gt;  &amp;lt;/search&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Is there anything I can do to optimize the searches?&lt;/P&gt;</description>
    <pubDate>Tue, 29 Nov 2016 08:12:48 GMT</pubDate>
    <dc:creator>bhavisankar</dc:creator>
    <dc:date>2016-11-29T08:12:48Z</dc:date>
    <item>
      <title>How can I optimize the performance of my current base search and subsearches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-optimize-the-performance-of-my-current-base-search-and/m-p/249785#M74559</link>
      <description>&lt;P&gt;I have a base search to collect all data and some subsearches that access these base searches to draw graphs.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Base search:&lt;/STRONG&gt; &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index = app sourcetype = airchangeservice "LogName=com.expedia.www.platform.diagnostics.tracing.TraceResources"  | rex "(?{[^}]+})" | mvexpand json_field | spath input=json_field | search (eventName="AIR_CANCEL_SERVICE" OR eventName="AIR_VOID_SERVICE")  | fields eventName, context.STATUS, context.TPID
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The subsearches draw graphs for different eventName, context.STATUS, context.TPID.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;See one of my subsearches:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;      &amp;lt;query&amp;gt;| search ("PROVIDER CODE":"TF") OR ("PROVIDER_CODE":"TF") AND  eventName="AIR_CANCEL_SERVICE"| timechart span=1d count by context.STATUS&amp;lt;/query&amp;gt;  &amp;lt;/search&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Is there anything I can do to optimize the searches?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2016 08:12:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-optimize-the-performance-of-my-current-base-search-and/m-p/249785#M74559</guid>
      <dc:creator>bhavisankar</dc:creator>
      <dc:date>2016-11-29T08:12:48Z</dc:date>
    </item>
    <item>
      <title>Re: How can I optimize the performance of my current base search and subsearches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-optimize-the-performance-of-my-current-base-search-and/m-p/249786#M74560</link>
      <description>&lt;P&gt;Without looking at your data, its hard to recommend optimizations. I also wonder if your sub query returns anything, because your base query does not include &lt;CODE&gt;_time&lt;/CODE&gt;, needed for &lt;CODE&gt;timechart&lt;/CODE&gt;. However, there are a couple of things you could try. &lt;/P&gt;

&lt;P&gt;1) Add a transforming command to your base search. Like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=app sourcetype=airchangeservice "LogName=com.expedia.www.platform.diagnostics.tracing.TraceResources" | rex "(?&amp;lt;json_field&amp;gt;{[^}]+})" | mvexpand json_field | spath input=json_field | search (eventName="AIR_CANCEL_SERVICE" OR eventName="AIR_VOID_SERVICE") | timechart span=1d count by eventName, context.STATUS, context.TPID
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And you sub query should be&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;query&amp;gt;| search ("PROVIDER CODE":"TF") OR ("PROVIDER_CODE":"TF") AND  eventName="AIR_CANCEL_SERVICE"| table _time count context.STATUS&amp;lt;/query&amp;gt;&amp;lt;/search&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;2) Try moving more search filters to the base search, like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=app sourcetype=airchangeservice "LogName=com.expedia.www.platform.diagnostics.tracing.TraceResources" ("AIR_CANCEL_SERVICE" OR "AIR_VOID_SERVICE")  | rex "(?&amp;lt;json_field&amp;gt;{[^}]+})" | mvexpand json_field | spath input=json_field | timechart span=1d count by eventName, context.STATUS, context.TPID
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;3) Consider using accelerated data models and &lt;CODE&gt;tstats&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.5.0/Knowledge/Aboutsummaryindexing"&gt;http://docs.splunk.com/Documentation/Splunk/6.5.0/Knowledge/Aboutsummaryindexing&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2016 13:55:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-optimize-the-performance-of-my-current-base-search-and/m-p/249786#M74560</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-11-29T13:55:06Z</dc:date>
    </item>
  </channel>
</rss>

