<?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: combine two queries in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-combine-two-queries/m-p/626014#M107567</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/252586"&gt;@MrIncredible&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;yes, but only id the results of each subsearch are less than 50,000.&lt;/P&gt;&lt;P&gt;if one answer solves your need, please accept one answer for the other people of Community or tell us how we can help you.&lt;/P&gt;&lt;P&gt;Ciao and happy splunking&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: Karma Points are appreciated by all the Contributors;-)&lt;/P&gt;</description>
    <pubDate>Thu, 05 Jan 2023 14:47:07 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2023-01-05T14:47:07Z</dc:date>
    <item>
      <title>How to combine two queries?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-combine-two-queries/m-p/595554#M104018</link>
      <description>&lt;P&gt;Hi All,&lt;BR /&gt;&lt;BR /&gt;I have 2 different queries and I want to combine their results. These 2 queries return a single value output I want these 2 values in the same search result. Thanks for any help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=“abc” (TYPE="Run bot finished" OR TYPE="Run bot Deployed")  |  search STATUS=Successful TYPE="Run bot finished" | stats  count |rename count as Success_Count

index = “abc” RPAEnvironment = "prd"  ProcessName = "*" LogType = "*" TaskName = "*Main*"  (LogLevel=ERROR OR LogLevel=FATAL)
| eval Time = strftime(_time, "%Y-%m-%d %H:%M:%S")           
| eval LogDescription = trim(replace(LogDescription, "'", ""))         
| eval LogMessage = trim(replace(LogMessage, "'", ""))          
| eval TaskName = trim(replace(TaskName, "'", ""))           
| eval host=substr(host,12,4)           | eval Account=if(User!= "" ,User,LoginUser)          
| table  Time, LogNo, host, Account, LogType, LogMessage, TaskName ,ProcessName          
| rename  LogMessage as "Log Message", TaskName as "Task Name", host as "VDI"  | sort  - Time|stats count|rename count as Failure_Count&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2023 17:29:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-combine-two-queries/m-p/595554#M104018</guid>
      <dc:creator>kranthimutyala</dc:creator>
      <dc:date>2023-01-05T17:29:53Z</dc:date>
    </item>
    <item>
      <title>Re: combine two queries</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-combine-two-queries/m-p/595559#M104020</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/177801"&gt;@kranthimutyala&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;di you already explored the "append" command?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=“abc” (TYPE="Run bot finished" OR TYPE="Run bot Deployed") STATUS=Successful TYPE="Run bot finished" 
| stats  count 
| rename count as Success_Count
| append [ search 
     index = “abc” RPAEnvironment = "prd"  ProcessName = "*" LogType = "*" TaskName = "*Main*"  (LogLevel=ERROR OR LogLevel=FATAL)
     | eval 
          Time = strftime(_time, "%Y-%m-%d %H:%M:%S"),
          LogDescription = trim(replace(LogDescription, "'", "")),
          LogMessage = trim(replace(LogMessage, "'", "")),
          TaskName = trim(replace(TaskName, "'", "")),
          host=substr(host,12,4),
          Account=if(User!= "" ,User,LoginUser)
     | stats count
     | rename count as Failure_Count ]&lt;/LI-CODE&gt;&lt;P&gt;in this way you'll have the results of the two searches in two different rows of the same table, if you want to have them in a single row you can use "transpose".&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 27 Apr 2022 11:13:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-combine-two-queries/m-p/595559#M104020</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-04-27T11:13:26Z</dc:date>
    </item>
    <item>
      <title>Re: combine two queries</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-combine-two-queries/m-p/595563#M104021</link>
      <description>&lt;P&gt;I would be very cautious with appending such wildcarded subsearch. Especially over a longer time period the subsearch has a decent chance of timing out.&lt;/P&gt;&lt;P&gt;Since both searches pull from the same index, I'd try some conditional evaluation.&lt;/P&gt;&lt;P&gt;But the other - more "high-level" - question is if one of the searches gives Success count, the other gives Failure Count, is there any additional category of events? Or maybe they can be split easier between those two categories? (I don't suppose an event can be both Success and Failure)&lt;/P&gt;</description>
      <pubDate>Wed, 27 Apr 2022 11:49:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-combine-two-queries/m-p/595563#M104021</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-04-27T11:49:15Z</dc:date>
    </item>
    <item>
      <title>Re: combine two queries</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-combine-two-queries/m-p/595565#M104022</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/177801"&gt;@kranthimutyala&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;sorry I forgot to add an information (as&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp;said) you can use a subquery if you have less than 50,000 results.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 27 Apr 2022 11:58:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-combine-two-queries/m-p/595565#M104022</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-04-27T11:58:01Z</dc:date>
    </item>
    <item>
      <title>Re: combine two queries</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-combine-two-queries/m-p/595580#M104025</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp; yes two events are different. And at the end I'm looking to take the difference between success count and Failure count , but it's not working with the query shared by&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Apr 2022 13:20:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-combine-two-queries/m-p/595580#M104025</guid>
      <dc:creator>kranthimutyala</dc:creator>
      <dc:date>2022-04-27T13:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: combine two queries</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-combine-two-queries/m-p/595586#M104026</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;I want do a eval calculation like success_count - Failure count but its not working&lt;/P&gt;</description>
      <pubDate>Wed, 27 Apr 2022 13:32:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-combine-two-queries/m-p/595586#M104026</guid>
      <dc:creator>kranthimutyala</dc:creator>
      <dc:date>2022-04-27T13:32:19Z</dc:date>
    </item>
    <item>
      <title>Re: combine two queries</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-combine-two-queries/m-p/595591#M104027</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/177801"&gt;@kranthimutyala&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;In this case, you have to put both the results on the same row and the you can use eval, something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=“abc” (TYPE="Run bot finished" OR TYPE="Run bot Deployed") STATUS=Successful TYPE="Run bot finished" 
| stats  count 
| rename count as Success_Count
| append [ search 
     index = “abc” RPAEnvironment = "prd"  ProcessName = "*" LogType = "*" TaskName = "*Main*"  (LogLevel=ERROR OR LogLevel=FATAL)
     | eval 
          Time = strftime(_time, "%Y-%m-%d %H:%M:%S"),
          LogDescription = trim(replace(LogDescription, "'", "")),
          LogMessage = trim(replace(LogMessage, "'", "")),
          TaskName = trim(replace(TaskName, "'", "")),
          host=substr(host,12,4),
          Account=if(User!= "" ,User,LoginUser)
     | stats count
     | rename count as Failure_Count ]
| stats values(Failure_Count) AS Failure_Count values(Success_Count) AS Success_Count
| eval diff=Success_Count-Failure_Count&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 27 Apr 2022 14:03:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-combine-two-queries/m-p/595591#M104027</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-04-27T14:03:21Z</dc:date>
    </item>
    <item>
      <title>Re: combine two queries</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-combine-two-queries/m-p/626013#M107566</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp;And say if there are 3 or more queries to combine the results ... append will work ?&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2023 14:43:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-combine-two-queries/m-p/626013#M107566</guid>
      <dc:creator>MrIncredible</dc:creator>
      <dc:date>2023-01-05T14:43:58Z</dc:date>
    </item>
    <item>
      <title>Re: combine two queries</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-combine-two-queries/m-p/626014#M107567</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/252586"&gt;@MrIncredible&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;yes, but only id the results of each subsearch are less than 50,000.&lt;/P&gt;&lt;P&gt;if one answer solves your need, please accept one answer for the other people of Community or tell us how we can help you.&lt;/P&gt;&lt;P&gt;Ciao and happy splunking&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: Karma Points are appreciated by all the Contributors;-)&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2023 14:47:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-combine-two-queries/m-p/626014#M107567</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-01-05T14:47:07Z</dc:date>
    </item>
    <item>
      <title>Re: combine two queries</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-combine-two-queries/m-p/626113#M107574</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;append is working more than 1 time also. My results are appearing as per attached screenshot (3 rows * 3 columns). I tried transpose command to make this in good format but somehow not able to remove last 2 columns. I mean what I am looking for, values should be shown like 3 rows &amp;amp; 2 columns. Is it possible with transpose command? can you help please&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MrIncredible_0-1672990843829.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/23227iE31B97F99FB1E991/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MrIncredible_0-1672990843829.png" alt="MrIncredible_0-1672990843829.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jan 2023 07:43:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-combine-two-queries/m-p/626113#M107574</guid>
      <dc:creator>MrIncredible</dc:creator>
      <dc:date>2023-01-06T07:43:10Z</dc:date>
    </item>
    <item>
      <title>Re: combine two queries</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-combine-two-queries/m-p/626133#M107578</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/252586"&gt;@MrIncredible&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;please share your search and next time open a new question instead append your request to another question.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jan 2023 10:49:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-combine-two-queries/m-p/626133#M107578</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-01-06T10:49:10Z</dc:date>
    </item>
    <item>
      <title>Re: combine two queries</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-combine-two-queries/m-p/626145#M107584</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;apologies!!! another question raised.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.splunk.com/t5/Getting-Data-In/how-to-format-results-getting-from-multiple-append/m-p/626144#M107583" target="_blank"&gt;https://community.splunk.com/t5/Getting-Data-In/how-to-format-results-getting-from-multiple-append/m-p/626144#M107583&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jan 2023 11:16:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-combine-two-queries/m-p/626145#M107584</guid>
      <dc:creator>MrIncredible</dc:creator>
      <dc:date>2023-01-06T11:16:05Z</dc:date>
    </item>
    <item>
      <title>Re: combine two queries</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-combine-two-queries/m-p/674051#M112828</link>
      <description>&lt;P&gt;what if ,it has more than 50k events&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index="aaam_devops_elasticsearch_idx"
| search project = Einstein360_TicketsCreated_ElasticSearch_20210419
| search source.TransactionName ="ITGTicketCreated"
| dedup id
| timechart span=1d count as ITGTicketCreated
| join max=0 _time [| search index="aaam_devops_elasticsearch_idx"
| search project = Einstein360_TruckRollCreated_ElasticSearch_20210420
| search source.TransactionName = "Truck_Roll_Create_Result"
| timechart span=1d dc(id) as TruckRollCreated]

| stats values(ITGTicketCreated) as ITGTicketCreated values(TruckRollCreated) as TruckRollCreated by _time&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2024 15:06:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-combine-two-queries/m-p/674051#M112828</guid>
      <dc:creator>pavi1611</dc:creator>
      <dc:date>2024-01-12T15:06:18Z</dc:date>
    </item>
    <item>
      <title>Re: combine two queries</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-combine-two-queries/m-p/674078#M112830</link>
      <description>&lt;P&gt;If a subsearch has more than 50,000 events or takes longer than 1 minute (i think) to run it will auto-finalize. Occurrence of either of these scenarios will cause the data returned from the subsearch to be truncated and incomplete.&lt;BR /&gt;&lt;BR /&gt;BTW I don't think the search you shared needs to use a join/subsearch, something like this will probably do the same thing.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="aaam_devops_elasticsearch_idx" ((project="Einstein360_TicketsCreated_ElasticSearch_20210419" AND "source.TransactionName"="ITGTicketCreated") OR (project="Einstein360_TruckRollCreated_ElasticSearch_20210420" AND "source.TransactionName"="Truck_Roll_Create_Result"))
    | timechart span=1d
        dc(eval(case('project'=="Einstein360_TicketsCreated_ElasticSearch_20210419" AND 'source.TransactionName'=="ITGTicketCreated", id))) as ITGTicketCreated,
        dc(eval(case('project'=="Einstein360_TruckRollCreated_ElasticSearch_20210420" AND 'source.TransactionName'=="Truck_Roll_Create_Result", id))) as TruckRollCreated&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2024 16:42:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-combine-two-queries/m-p/674078#M112830</guid>
      <dc:creator>dtburrows3</dc:creator>
      <dc:date>2024-01-12T16:42:45Z</dc:date>
    </item>
    <item>
      <title>Re: combine two queries</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-combine-two-queries/m-p/674079#M112831</link>
      <description>&lt;P&gt;By default (unless the limit is reconfigured) join uses only 50000 results from the subsearch to join with the outer search and runs for only 60 seconds to generate those results. If your subsearch exceeds 60 seconds of execution time or generates more than 50k results, it's silently finalized and only the results returned so far (up to 50k) are used for join.&lt;/P&gt;&lt;P&gt;With other subsearch uses the limits can be lower - even down to 10k results.&lt;/P&gt;&lt;P&gt;That's one of the reasons subsearches are best avoided - since they are silently finalized, you're not getting any feedback that you're not getting full results from your search and you're not aware that your final results might be incomplete or plain wrong.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2024 16:43:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-combine-two-queries/m-p/674079#M112831</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2024-01-12T16:43:04Z</dc:date>
    </item>
    <item>
      <title>Re: combine two queries</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-combine-two-queries/m-p/674348#M112865</link>
      <description>&lt;P&gt;Thanks, a lot... Its working&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2024 10:17:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-combine-two-queries/m-p/674348#M112865</guid>
      <dc:creator>pavi1611</dc:creator>
      <dc:date>2024-01-16T10:17:13Z</dc:date>
    </item>
  </channel>
</rss>

