<?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: Search Performance issue - Need help in All Apps and Add-ons</title>
    <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Search-Performance-issue-Need-help/m-p/490626#M60396</link>
    <description>&lt;P&gt;In your example, base search is a technique that performs 12 searches once.&lt;/P&gt;

&lt;P&gt;In base search, the search is performed in the most detailed unit. Aggregate each panel as needed.&lt;/P&gt;

&lt;P&gt;As a restriction, if the number of base searches is large, it may be faster to search for each panel.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;BASE SEARCH:
(your search)|bin span=24h _time|stats count by _time,your_category

PANEL01:
|bin span=7d _time|stats sum(count) as count by _time,your_category

PANEL02:
|bin span=30d _time|stats sum(count) as count by _time,your_category

&amp;lt;dashboard&amp;gt;
   &amp;lt;search id="baseSearch"&amp;gt;
     &amp;lt;query&amp;gt;(your search)|bin span=24h _time|stats count by _time,your_category&amp;lt;/query&amp;gt;
   &amp;lt;/search&amp;gt;
   &amp;lt;label&amp;gt;test&amp;lt;/label&amp;gt;
   &amp;lt;row&amp;gt;
     &amp;lt;panel&amp;gt;
       &amp;lt;chart&amp;gt;
         &amp;lt;search base="baseSearch"&amp;gt;
           &amp;lt;query&amp;gt;|bin span=7d _time|stats sum(count) as count by _time,your_category&amp;lt;/query&amp;gt;
         &amp;lt;/search&amp;gt;
         &amp;lt;option ･･････
       &amp;lt;/chart&amp;gt;
     &amp;lt;/panel&amp;gt;
   &amp;lt;/row&amp;gt;
   &amp;lt;row&amp;gt;
     &amp;lt;panel&amp;gt;
       &amp;lt;chart&amp;gt;
         &amp;lt;search base="baseSearch"&amp;gt;
           &amp;lt;query&amp;gt;|bin span=30d _time|stats sum(count) as count by _time,your_category&amp;lt;/query&amp;gt;
         &amp;lt;/search&amp;gt;
         &amp;lt;option ･･････
       &amp;lt;/chart&amp;gt;
     &amp;lt;/panel&amp;gt;
   &amp;lt;/row&amp;gt;
 &amp;lt;/dashboard&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 18 Nov 2019 06:36:09 GMT</pubDate>
    <dc:creator>HiroshiSatoh</dc:creator>
    <dc:date>2019-11-18T06:36:09Z</dc:date>
    <item>
      <title>Search Performance issue - Need help</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Search-Performance-issue-Need-help/m-p/490625#M60395</link>
      <description>&lt;P&gt;Hello Experts&lt;/P&gt;

&lt;P&gt;Actually I am trying to show the usage trends across one application on different platforms (Online, Mobile &amp;amp; other platforms) as different trends as 30 days, 7 days and 24 hrs trends.&lt;/P&gt;

&lt;P&gt;Here are the details:&lt;/P&gt;

&lt;P&gt;There are 3 indexes 1a,2b and 3c with many source types. &lt;BR /&gt;
index=1a (ONLINE PLATFORM)&lt;BR /&gt;
In index=1a the field ( say "ClientId" which I required is directly there I am doing the lookup against the file. ( since in the index 1a, both userid and clientId fields are there I Can evaluate the Userid and then join the ClientId through the lookup.&lt;BR /&gt;
Source types are sourcetype="ONLINE_ACTIVITYLOG"&lt;/P&gt;

&lt;P&gt;index=2b (other platform)&lt;BR /&gt;
But in index=2b, I have to evaluate the field "Userid" from different source types and do input lookup and join the "ClientId" from the same input lookup.&lt;BR /&gt;
Source types are :&lt;/P&gt;

&lt;P&gt;sourcetype="PROD_APPLOG",HTTP_USER,&lt;BR /&gt;&lt;BR /&gt;
 sourcetype="PROD_APPLOG",UserID,&lt;BR /&gt;&lt;BR /&gt;
 sourcetype="PROD_APPLOG",userId,&lt;BR /&gt;&lt;BR /&gt;
 sourcetype="PROD_APPLOG",usrLogin,&lt;BR /&gt;&lt;BR /&gt;
 sourcetype="PROD_APPLOG",http_user,&lt;BR /&gt;&lt;BR /&gt;
 sourcetype="PROD_APPLOG",user_cookie,&lt;BR /&gt;&lt;BR /&gt;
 sourcetype="PROD_APPLOG",userID,&lt;/P&gt;

&lt;P&gt;sourcetype="PROD1_APPLOG",Http_User,&lt;BR /&gt;&lt;BR /&gt;
 sourcetype="PROD1_APPLOG",prod_USER,&lt;/P&gt;

&lt;P&gt;sourcetype="PROD_WEBLOG",HTTP_USER,&lt;BR /&gt;&lt;BR /&gt;
 sourcetype="PROD_WEBLOG",user_cookie,&lt;BR /&gt;&lt;BR /&gt;
 sourcetype="PROD_WEBLOG",userID, &lt;/P&gt;

&lt;P&gt;sourcetype=="F5_APPLOG",http_user,&lt;BR /&gt;&lt;BR /&gt;
 sourcetype=="F5_APPLOG",user_cookie,&lt;/P&gt;

&lt;P&gt;index=3c (MOBILE PLATFORM)&lt;BR /&gt;
 Source types are:&lt;BR /&gt;
 sourcetype="MOBILE_WEBLOG",HTTP_USER,&lt;BR /&gt;
 sourcetype="MOBILE_APPLOG",user_cookie&lt;/P&gt;

&lt;P&gt;Inputlookup Filename: UserId.csv&lt;BR /&gt;
 Inputlookup file format: &lt;BR /&gt;
 Userid Clientid&lt;BR /&gt;
 User1 Client1&lt;BR /&gt;
 User2 Client2&lt;BR /&gt;
As mentioned, When I tried to show the trend for 30 days,7 days &amp;amp; 24 hrs (across 12 panels in one dashboard) - the data is not at all loading and performance is very slow.&lt;BR /&gt;
When I verified with few of my Engineering colleagues, they said "I am searching the same query in multiple panels on the dashboard that causing slowness and asking me to CREATE a BASE SEARCH and use that to draw the trend as required"&lt;/P&gt;

&lt;P&gt;As I am fairly new to splunk, &lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;I am confused how to create a base&lt;BR /&gt;
search for this issue since it is&lt;BR /&gt;
across multiple indexes. &lt;/P&gt;

&lt;P&gt;Also is the&lt;BR /&gt;
data model &amp;amp; search base query&lt;BR /&gt;
concepts are same? &lt;/P&gt;

&lt;P&gt;And they are asking&lt;BR /&gt;
me to accelerate the search once&lt;BR /&gt;
created the base query&lt;/P&gt;

&lt;P&gt;***.&lt;/P&gt;

&lt;P&gt;Could you please help me to create search base query for above issue.&lt;/P&gt;

&lt;P&gt;**&lt;BR /&gt;
ACTUAL QUERY which I am using across all the panels in the dashboard:&lt;/P&gt;

&lt;P&gt;index= "1a"  OR index="2b"  OR index="3c"&lt;/P&gt;

&lt;P&gt;|  eval Platform = case(&lt;BR /&gt;
 index="1a", "Online",&lt;BR /&gt;
 index="2b", "Mobile",&lt;BR /&gt;
 index="3c", "OtherPlatforms")&lt;/P&gt;

&lt;P&gt;|  eval Userid= case(&lt;BR /&gt;&lt;BR /&gt;
 sourcetype="PROD_APPLOG",HTTP_USER,&lt;BR /&gt;&lt;BR /&gt;
 sourcetype="PROD_APPLOG",UserID,&lt;BR /&gt;&lt;BR /&gt;
 sourcetype="PROD_APPLOG",userId,&lt;BR /&gt;&lt;BR /&gt;
 sourcetype="PROD_APPLOG",usrLogin,&lt;BR /&gt;&lt;BR /&gt;
 sourcetype="PROD_APPLOG",http_user,&lt;BR /&gt;&lt;BR /&gt;
 sourcetype="PROD_APPLOG",user_cookie,&lt;BR /&gt;&lt;BR /&gt;
 sourcetype="PROD_APPLOG",userID,&lt;/P&gt;

&lt;P&gt;sourcetype="PROD1_APPLOG",Http_User,&lt;BR /&gt;&lt;BR /&gt;
 sourcetype="PROD1_APPLOG",prod_USER,&lt;/P&gt;

&lt;P&gt;sourcetype="PROD_WEBLOG",HTTP_USER,&lt;BR /&gt;&lt;BR /&gt;
 sourcetype="PROD_WEBLOG",user_cookie,&lt;BR /&gt;&lt;BR /&gt;
 sourcetype="PROD_WEBLOG",userID, &lt;/P&gt;

&lt;P&gt;sourcetype=="F5_APPLOG",http_user,&lt;BR /&gt;&lt;BR /&gt;
 sourcetype=="F5_APPLOG",user_cookie,&lt;/P&gt;

&lt;P&gt;sourcetype="ONLINE_ACTIVITYLOG" AND  ACTIVITY_CATEGORY=="{signin}",USR_LOGIN,&lt;/P&gt;

&lt;P&gt;sourcetype="MOBILE_WEBLOG",HTTP_USER,&lt;BR /&gt;
 sourcetype="MOBILE_APPLOG",user_cookie)&lt;/P&gt;

&lt;P&gt;| lookup Userid.csv Userid AS Userid output Clientid &lt;/P&gt;

&lt;P&gt;| stats dc(Clientid) as total_clients by date_hour,date_wday,Platform | chart avg(Clientid) over date_hour by Platform&lt;/P&gt;

&lt;P&gt;only the "| stats dc(Clientid) as total_clients by date_hour,date_wday,Platform | chart avg(Clientid) over date_hour by Platform" -&amp;gt; this part is varying across all panels as I am showing as chart(avg) &amp;amp; dc etc.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:05:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Search-Performance-issue-Need-help/m-p/490625#M60395</guid>
      <dc:creator>gopiven</dc:creator>
      <dc:date>2020-09-30T03:05:08Z</dc:date>
    </item>
    <item>
      <title>Re: Search Performance issue - Need help</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Search-Performance-issue-Need-help/m-p/490626#M60396</link>
      <description>&lt;P&gt;In your example, base search is a technique that performs 12 searches once.&lt;/P&gt;

&lt;P&gt;In base search, the search is performed in the most detailed unit. Aggregate each panel as needed.&lt;/P&gt;

&lt;P&gt;As a restriction, if the number of base searches is large, it may be faster to search for each panel.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;BASE SEARCH:
(your search)|bin span=24h _time|stats count by _time,your_category

PANEL01:
|bin span=7d _time|stats sum(count) as count by _time,your_category

PANEL02:
|bin span=30d _time|stats sum(count) as count by _time,your_category

&amp;lt;dashboard&amp;gt;
   &amp;lt;search id="baseSearch"&amp;gt;
     &amp;lt;query&amp;gt;(your search)|bin span=24h _time|stats count by _time,your_category&amp;lt;/query&amp;gt;
   &amp;lt;/search&amp;gt;
   &amp;lt;label&amp;gt;test&amp;lt;/label&amp;gt;
   &amp;lt;row&amp;gt;
     &amp;lt;panel&amp;gt;
       &amp;lt;chart&amp;gt;
         &amp;lt;search base="baseSearch"&amp;gt;
           &amp;lt;query&amp;gt;|bin span=7d _time|stats sum(count) as count by _time,your_category&amp;lt;/query&amp;gt;
         &amp;lt;/search&amp;gt;
         &amp;lt;option ･･････
       &amp;lt;/chart&amp;gt;
     &amp;lt;/panel&amp;gt;
   &amp;lt;/row&amp;gt;
   &amp;lt;row&amp;gt;
     &amp;lt;panel&amp;gt;
       &amp;lt;chart&amp;gt;
         &amp;lt;search base="baseSearch"&amp;gt;
           &amp;lt;query&amp;gt;|bin span=30d _time|stats sum(count) as count by _time,your_category&amp;lt;/query&amp;gt;
         &amp;lt;/search&amp;gt;
         &amp;lt;option ･･････
       &amp;lt;/chart&amp;gt;
     &amp;lt;/panel&amp;gt;
   &amp;lt;/row&amp;gt;
 &amp;lt;/dashboard&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Nov 2019 06:36:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Search-Performance-issue-Need-help/m-p/490626#M60396</guid>
      <dc:creator>HiroshiSatoh</dc:creator>
      <dc:date>2019-11-18T06:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: Search Performance issue - Need help</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Search-Performance-issue-Need-help/m-p/490627#M60397</link>
      <description>&lt;P&gt;Answering one by one, &lt;BR /&gt;
1) how would you make a Base search for this issue?&lt;BR /&gt;
Lets see here the sub-query that is common across all queries will return you raw events, so to create base search i would recommend to table out the fields you would require as the base search is executed once and the results are stored in memory, so it will be better to store only the fields we would require and not all the unnecessary data which might affect the performance. so here after you use lookup to fetch the required values add&lt;BR /&gt;
&lt;CODE&gt;.. | table Clientid,date_wday,date_hour,Platform&lt;/CODE&gt; add any other fields you might require and make it a base search and here is how&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;Add a search with id above in the form &lt;CODE&gt;&amp;lt;search id=”base_search_id”&amp;gt;&amp;lt;query&amp;gt; whatever query we made earlier&amp;lt;/query&amp;gt;&amp;lt;/search&amp;gt;&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;Now use the base search in your chart by referencing it &lt;CODE&gt;&amp;lt;search base=”base_search_id”&amp;gt;&amp;lt;query&amp;gt; the remaining serach query&amp;lt;/query&amp;gt;&amp;lt;/search&amp;gt;&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;Example 
1st search &lt;CODE&gt;index=main source=demo_source | table fielda,fieldb| stats count(fielda) by fieldb&lt;/CODE&gt;
2nd search &lt;CODE&gt;index=main source=demo_source | table fieldc,fieldd | stats count(fieldc) by fieldd&lt;/CODE&gt;
base search will be &lt;CODE&gt;&amp;lt;search id=”base_search_id”&amp;gt;&amp;lt;query&amp;gt;index=main source=demo_source | table fielda,fieldb,fieldc,fieldd &amp;lt;/query&amp;gt;&amp;lt;/search&amp;gt;&lt;/CODE&gt;
chart 1 will have &lt;CODE&gt;&amp;lt;search base=”base_search_id”&amp;gt;&amp;lt;query&amp;gt;stats count(fielda) by fieldb&amp;lt;/query&amp;gt;&amp;lt;/search&amp;gt;&lt;/CODE&gt;
chart 2 will have &lt;CODE&gt;&amp;lt;search base=”base_search_id”&amp;gt;&amp;lt;query&amp;gt;stats count(fieldc) by fieldd&amp;lt;/query&amp;gt;&amp;lt;/search&amp;gt;&lt;/CODE&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;2)   is the data model &amp;amp; search base query concepts are same?&lt;BR /&gt;
NO, Data models are used to map the fields_names with  a common field name. Like the data might have username, USER, user_name, uname and many other of that sort but we know it all refers to the same username, so the data model allows us to map all these names to a common know or a standard name for a specific field.&lt;BR /&gt;
please refer here for full details &lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.0/Knowledge/Aboutdatamodels" target="_blank"&gt;link&lt;/A&gt;&lt;BR /&gt;
P.S. you cannot use the same query after making a data model&lt;BR /&gt;
 and also acceleration is also a feature of data model it creates an accelerated index for the selected data which makes searching faster. You can read about it more &lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.0/Knowledge/Acceleratedatamodels" target="_blank"&gt;here&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Suggestion&lt;BR /&gt;
`case(&lt;BR /&gt;
sourcetype="PROD_APPLOG",HTTP_USER,&lt;BR /&gt;
sourcetype="PROD_APPLOG",UserID,&lt;BR /&gt;
sourcetype="PROD_APPLOG",userId,&lt;BR /&gt;
sourcetype="PROD_APPLOG",usrLogin,&lt;BR /&gt;
sourcetype="PROD_APPLOG",http_user,&lt;BR /&gt;
sourcetype="PROD_APPLOG",user_cookie,&lt;BR /&gt;
sourcetype="PROD_APPLOG",userID,&lt;/P&gt;

&lt;P&gt;sourcetype="PROD1_APPLOG",Http_User,&lt;BR /&gt;
sourcetype="PROD1_APPLOG",prod_USER,&lt;/P&gt;

&lt;P&gt;sourcetype="PROD_WEBLOG",HTTP_USER,&lt;BR /&gt;
sourcetype="PROD_WEBLOG",user_cookie,&lt;BR /&gt;
sourcetype="PROD_WEBLOG",userID,&lt;/P&gt;

&lt;P&gt;sourcetype=="F5_APPLOG",http_user,&lt;BR /&gt;
sourcetype=="F5_APPLOG",user_cookie,&lt;/P&gt;

&lt;P&gt;sourcetype="ONLINE_ACTIVITYLOG" AND ACTIVITY_CATEGORY=="{signin}",USR_LOGIN,&lt;/P&gt;

&lt;P&gt;sourcetype="MOBILE_WEBLOG",HTTP_USER,&lt;BR /&gt;
sourcetype="MOBILE_APPLOG",user_cookie)&lt;CODE&gt;&lt;BR /&gt;
is same as&lt;BR /&gt;
&lt;/CODE&gt;case(&lt;BR /&gt;
sourcetype="PROD_APPLOG",HTTP_USER,&lt;/P&gt;

&lt;P&gt;sourcetype="PROD1_APPLOG",Http_User,&lt;/P&gt;

&lt;P&gt;sourcetype="PROD_WEBLOG",HTTP_USER,&lt;/P&gt;

&lt;P&gt;sourcetype=="F5_APPLOG",http_user,&lt;/P&gt;

&lt;P&gt;sourcetype="ONLINE_ACTIVITYLOG" AND ACTIVITY_CATEGORY=="{signin}",USR_LOGIN,&lt;/P&gt;

&lt;P&gt;sourcetype="MOBILE_WEBLOG",HTTP_USER,&lt;BR /&gt;
sourcetype="MOBILE_APPLOG",user_cookie)`&lt;/P&gt;

&lt;P&gt;as if the condition is matched it doesnt look for the next condition. so if  sourcetype="PROD_APPLOG" than userid will always be HTTP_USER and not any other field you mentioned after that. I Hope you got it.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:00:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Search-Performance-issue-Need-help/m-p/490627#M60397</guid>
      <dc:creator>siddharthkhatsu</dc:creator>
      <dc:date>2020-09-30T03:00:12Z</dc:date>
    </item>
    <item>
      <title>Re: Search Performance issue - Need help</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Search-Performance-issue-Need-help/m-p/490628#M60398</link>
      <description>&lt;P&gt;Thanks Sid!&lt;BR /&gt;
I am understanding it better now. &lt;/P&gt;

&lt;P&gt;However I have scheduled search ( running every hour) which creates output lookup file and from that I am drawing the trends now.&lt;BR /&gt;
The 7 days trends working fine.&lt;BR /&gt;
However I am not able to segregate the last 24hrs events ( mean I dont know how to filter last 24hrs events to draw the trend).&lt;BR /&gt;
Kindly help me how to filter the last 24hrs trend from overall lookup ( which contains 7 days data).&lt;/P&gt;

&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2019 04:58:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Search-Performance-issue-Need-help/m-p/490628#M60398</guid>
      <dc:creator>gopiven</dc:creator>
      <dc:date>2019-11-21T04:58:24Z</dc:date>
    </item>
  </channel>
</rss>

