<?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: Combining 3 queries output to produce table in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Combining-3-queries-output-to-produce-table/m-p/695604#M236514</link>
    <description>&lt;P&gt;Hey, Maybe this is a better example.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;|union

index=osp source=xxx EVENT_TYPE=xxx EVENT_SUBTYPE=xxx
| search PLNF=* REN=INT OKELS=""
| eval DATE = strftime(strptime(BADAT, "%Y%m%d"), "%Y-%m-%d")
| stats count as example1 by FNHB FNPO DATE
| eval SourceType="example 1"

[
search index=osp source=xxx EVENT_TYPE=xxx EVENT_SUBTYPE=xxx
PLNF=* REN=INT HTSZ=R OKELS="" EHUH=FIERY
| eval DATE = strftime(strptime(BADAT, "%Y%m%d"), "%Y-%m-%d")
| stats count as example2 by FNHB FNPO DATE
| eval SourceType="example 2"
]
[
search index=osp source=xxx EVENT_TYPE=xxx EVENT_SUBTYPE=xxx
PLNF=* REN=INT HTSZ=R OKELS="" NOT EHUH=FIERY
| eval DATE = strftime(strptime(BADAT, "%Y%m%d"), "%Y-%m-%d")
| stats count as example3 by FNHB FNPO DATE
| eval SourceType="example 3"
]

| stats count(example1) as "example 1" count(example2) as "example 2" count(example3) as "example 3" by DATE&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I didn't quite understand how you were filtering the search fields on that second line&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 07 Aug 2024 23:55:21 GMT</pubDate>
    <dc:creator>jjohn149</dc:creator>
    <dc:date>2024-08-07T23:55:21Z</dc:date>
    <item>
      <title>Combining 3 queries output to produce table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-3-queries-output-to-produce-table/m-p/695479#M236487</link>
      <description>&lt;LI-CODE lang="markup"&gt;|union

[ search index=osp source=xxx EVENT_TYPE=xxx  EVENT_SUBTYPE=xxx
field1=* field3=xxx field4=""
| eval DATE = strftime(strptime(xxx, "%Y%m%d"), "%Y-%m-%d")
| stats latest(source) as example1  by field5 field6 DATE]

[ search index=osp source=xxx EVENT_TYPE=xxx  EVENT_SUBTYPE=xxx
field1=* field3=xxx  field3=xxx field4=""
| eval DATE = strftime(strptime(xxx, "%Y%m%d"), "%Y-%m-%d")
| stats latest(source) as example2  by field5 field6 DATE]

[ search index=osp source=xxx EVENT_TYPE=xxx  EVENT_SUBTYPE=xxx
field1=* field3=xxx NOT field3=xxx field4=""
| eval DATE = strftime(strptime(xxx, "%Y%m%d"), "%Y-%m-%d")
| stats latest(source) as example3  by field5 field6 DATE]

| stats count(example1) as "example 1", count(example2) as "example 2", count(example3) as "example 3"   by DATE&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;The data is populating correctly for example 1 and example 3, individually, and if I just use two queries. However, I need all 3 queries for my data but data is missing from example 2.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2024 10:21:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-3-queries-output-to-produce-table/m-p/695479#M236487</guid>
      <dc:creator>jjohn149</dc:creator>
      <dc:date>2024-08-07T10:21:11Z</dc:date>
    </item>
    <item>
      <title>Re: Combining 3 queries output to produce table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-3-queries-output-to-produce-table/m-p/695496#M236491</link>
      <description>&lt;P&gt;As everyone will tell you, you are better off not using union and join, especially as your mock code suggests their similarity.&lt;/P&gt;&lt;P&gt;The best way to get help is to follow these golden rules that I call four commandments:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Illustrate data input (in raw text, anonymize as needed), whether they are raw events or output from a search that volunteers here do not have to look at.&lt;/LI&gt;&lt;LI&gt;Illustrate the desired output from illustrated data.&lt;/LI&gt;&lt;LI&gt;Explain the logic between illustrated data and desired output&amp;nbsp;&lt;EM&gt;without&lt;/EM&gt;&amp;nbsp;SPL.&lt;/LI&gt;&lt;LI&gt;If you also illustrate attempted SPL, illustrate actual output and compare with desired output, explain why they look different&amp;nbsp;&lt;U&gt;to you&lt;/U&gt;&amp;nbsp;if that is not painfully obvious.&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Wed, 07 Aug 2024 05:18:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-3-queries-output-to-produce-table/m-p/695496#M236491</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2024-08-07T05:18:46Z</dc:date>
    </item>
    <item>
      <title>Re: Combining 3 queries output to produce table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-3-queries-output-to-produce-table/m-p/695502#M236494</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/270911"&gt;@jjohn149&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Maybe it's an impression, but the searches seem the same, probably the values ​​in the conditions are different, but I would put the three searches in one, thus also avoiding the limit of 50,000 results of the subsearch; so in my example I will use condition1, condition2 and condition3 to adapt to your real need:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=osp source=xxx EVENT_TYPE IN (event_type1, event_type2, event_type3)  EVENT_SUBTYPE IN (event_subtype1, event_subtype2, event_subtype3)
field1=* field3 IN (field31, field32, field33) field4=""
| eval DATE=strftime(strptime(_time, "%Y%m%d"), "%Y-%m-%d")
| stats 
     latest(eval(if(field3=field31))),source,"") AS example1
     latest(eval(if(field3=field32))),source,"") AS example2
     latest(eval(if(field3=field33))),source,"") AS example3
     by field5 field6 DATE&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2024 06:57:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-3-queries-output-to-produce-table/m-p/695502#M236494</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-08-07T06:57:24Z</dc:date>
    </item>
    <item>
      <title>Re: Combining 3 queries output to produce table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-3-queries-output-to-produce-table/m-p/695604#M236514</link>
      <description>&lt;P&gt;Hey, Maybe this is a better example.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;|union

index=osp source=xxx EVENT_TYPE=xxx EVENT_SUBTYPE=xxx
| search PLNF=* REN=INT OKELS=""
| eval DATE = strftime(strptime(BADAT, "%Y%m%d"), "%Y-%m-%d")
| stats count as example1 by FNHB FNPO DATE
| eval SourceType="example 1"

[
search index=osp source=xxx EVENT_TYPE=xxx EVENT_SUBTYPE=xxx
PLNF=* REN=INT HTSZ=R OKELS="" EHUH=FIERY
| eval DATE = strftime(strptime(BADAT, "%Y%m%d"), "%Y-%m-%d")
| stats count as example2 by FNHB FNPO DATE
| eval SourceType="example 2"
]
[
search index=osp source=xxx EVENT_TYPE=xxx EVENT_SUBTYPE=xxx
PLNF=* REN=INT HTSZ=R OKELS="" NOT EHUH=FIERY
| eval DATE = strftime(strptime(BADAT, "%Y%m%d"), "%Y-%m-%d")
| stats count as example3 by FNHB FNPO DATE
| eval SourceType="example 3"
]

| stats count(example1) as "example 1" count(example2) as "example 2" count(example3) as "example 3" by DATE&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I didn't quite understand how you were filtering the search fields on that second line&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2024 23:55:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-3-queries-output-to-produce-table/m-p/695604#M236514</guid>
      <dc:creator>jjohn149</dc:creator>
      <dc:date>2024-08-07T23:55:21Z</dc:date>
    </item>
    <item>
      <title>Re: Combining 3 queries output to produce table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-3-queries-output-to-produce-table/m-p/695605#M236515</link>
      <description>&lt;P&gt;Also, when I enter:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| eval start_date=relative_time(now(), "-90d@d")
| eval end_date=now()
| where DATE &amp;gt;= start_date AND DATE &amp;lt;= end_date&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;below the stats count command line at the end, the query does not filter my data&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2024 23:55:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-3-queries-output-to-produce-table/m-p/695605#M236515</guid>
      <dc:creator>jjohn149</dc:creator>
      <dc:date>2024-08-07T23:55:58Z</dc:date>
    </item>
    <item>
      <title>Re: Combining 3 queries output to produce table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-3-queries-output-to-produce-table/m-p/695649#M236519</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/270911"&gt;@jjohn149&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;please try something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=osp source=xxx EVENT_TYPE=xxx EVENT_SUBTYPE=xxx PLNF=* REN=INT OKELS=""
| eval example=case(
	HTSZ="R" AND NOT EHUH="FIERY", "example 3",
	HTSZ="R", "example 2",
	true(), "example 1"
	)
| eval DATE = strftime(strptime(BADAT, "%Y%m%d"), "%Y-%m-%d")
| stats 
   count(eval(example="example 1")) AS example1_count
   count(eval(example="example 2")) AS example2_count
   count(eval(example="example 3")) AS example3_count
   BY FNHB FNPO DATE
| stats 
	sum(example1_count) AS "example 1" 
	sum(example3_count) AS "example 2"
	sum(example3_count) AS "example 3"
	BY DATE&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2024 06:33:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-3-queries-output-to-produce-table/m-p/695649#M236519</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-08-08T06:33:57Z</dc:date>
    </item>
  </channel>
</rss>

