<?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: Syntax help to get distinct results from two queries from two different timeframes in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Syntax-help-to-get-distinct-results-from-two-queries-from-two/m-p/616340#M214211</link>
    <description>&lt;P&gt;Could you provide some sample raw data from app_a and app_b? Do they exist in the same index?&lt;/P&gt;</description>
    <pubDate>Fri, 07 Oct 2022 15:48:42 GMT</pubDate>
    <dc:creator>johnhuang</dc:creator>
    <dc:date>2022-10-07T15:48:42Z</dc:date>
    <item>
      <title>Syntax help to get distinct results from two queries from two different timeframes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Syntax-help-to-get-distinct-results-from-two-queries-from-two/m-p/616339#M214210</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;I would like a single splunk query that does the following:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Query "APP_A" for a specific log message, returning two values (key, timestamp)&lt;/LI&gt;&lt;LI&gt;Query "APP_B" for a specific log message, returning two values (key, timestamp)&lt;/LI&gt;&lt;LI&gt;Data takes roughly five min to process from APP_A to APP_B.&amp;nbsp; So, to ensure I am getting the most accurate view of the data as possible, I want to offset the queries by 600 seconds.&amp;nbsp; This likely means configuring query one to look back five min&lt;/LI&gt;&lt;LI&gt;Produce a table / report that lists ONLY the keys that are distinct to each table&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;EX:&lt;/P&gt;&lt;P&gt;QUERY 1 RESULTS&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%"&gt;a&lt;/TD&gt;&lt;TD width="50%"&gt;1665155553&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;b&lt;/TD&gt;&lt;TD width="50%"&gt;1665155554&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;c&lt;/TD&gt;&lt;TD width="50%"&gt;1665155555&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;d&lt;/TD&gt;&lt;TD width="50%"&gt;1665155556&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;QUERY 2 RESULTS&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%"&gt;a&lt;/TD&gt;&lt;TD width="50%"&gt;1665155853&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;c&lt;/TD&gt;&lt;TD width="50%"&gt;1665155854&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;d&lt;/TD&gt;&lt;TD width="50%"&gt;1665155855&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;e&lt;/TD&gt;&lt;TD&gt;1665155856&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;OVERY ALL RESULTS (what I really want)&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%"&gt;b&lt;/TD&gt;&lt;TD width="50%"&gt;1665155554&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;e&lt;/TD&gt;&lt;TD width="50%"&gt;1665155856&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For better or worse, here is what I have so far...&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;| set diff&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;[search&lt;BR /&gt;index="&amp;lt;REDACTED&amp;gt;"&lt;BR /&gt;cf_org_name="&amp;lt;REDACTED&amp;gt;"&lt;BR /&gt;cf_app_name="&amp;lt;REDACTED&amp;gt;"&lt;BR /&gt;event_type="LogMessage" "msg.logger_name"="&amp;lt;REDACTED&amp;gt;" |&lt;BR /&gt;rex field="msg.message" "&amp;lt;REDACTED&amp;gt;" |&lt;BR /&gt;table masterKey timestamp |&lt;BR /&gt;]&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;[search&lt;BR /&gt;index="&amp;lt;REDACTED&amp;gt;"&lt;BR /&gt;cf_org_name="&amp;lt;REDACTED&amp;gt;"&lt;BR /&gt;cf_app_name="&amp;lt;REDACTED&amp;gt;"&lt;BR /&gt;event_type="LogMessage" "msg.logger_name"="&amp;lt;REDACTED&amp;gt;" |&lt;BR /&gt;table masterKey timestamp |&lt;BR /&gt;]&lt;/P&gt;&lt;P&gt;My syntax is for sure off, because the diff is not producing distinct results.&amp;nbsp; Also, I haven't tried to tackle the time off set problem yet.&amp;nbsp; Any help would be greatly appreciated.&amp;nbsp; Thanks in advanced.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Oct 2022 15:28:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Syntax-help-to-get-distinct-results-from-two-queries-from-two/m-p/616339#M214210</guid>
      <dc:creator>JHorst</dc:creator>
      <dc:date>2022-10-07T15:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax help to get distinct results from two queries from two different timeframes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Syntax-help-to-get-distinct-results-from-two-queries-from-two/m-p/616340#M214211</link>
      <description>&lt;P&gt;Could you provide some sample raw data from app_a and app_b? Do they exist in the same index?&lt;/P&gt;</description>
      <pubDate>Fri, 07 Oct 2022 15:48:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Syntax-help-to-get-distinct-results-from-two-queries-from-two/m-p/616340#M214211</guid>
      <dc:creator>johnhuang</dc:creator>
      <dc:date>2022-10-07T15:48:42Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax help to get distinct results from two queries from two different timeframes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Syntax-help-to-get-distinct-results-from-two-queries-from-two/m-p/616419#M214234</link>
      <description>&lt;P&gt;set is an expensive operation. &amp;nbsp;Use stats. &amp;nbsp;Assuming that you want to look back 30 minutes, and that cf_app_name can have APP_A and APP_B, where APP_A should have a 5-minute lookback. &amp;nbsp;Do something like&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(index="&amp;lt;REDACTED&amp;gt;"
cf_org_name="&amp;lt;REDACTED&amp;gt;"
cf_app_name="APP_A" earliest=-35m latest=-5m
event_type="LogMessage" "msg.logger_name"="&amp;lt;REDACTED&amp;gt;")
OR (index="&amp;lt;REDACTED&amp;gt;"
cf_org_name="&amp;lt;REDACTED&amp;gt;"
cf_app_name="APP_B" earliest=-30m latest=now
event_type="LogMessage" "msg.logger_name"="&amp;lt;REDACTED&amp;gt;")
| rex field="msg.message" "&amp;lt;REDACTED&amp;gt;" 
| stats values(cf_app_name) by key timestamp
| where mvcount('values(cf_app_name)') = 1&lt;/LI-CODE&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Sat, 08 Oct 2022 06:20:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Syntax-help-to-get-distinct-results-from-two-queries-from-two/m-p/616419#M214234</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-10-08T06:20:22Z</dc:date>
    </item>
  </channel>
</rss>

