<?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: How to compare two searches and find common data between them in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-searches-and-find-common-data-between-them/m-p/521776#M147052</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Its difficult to say as format of _time in a readable format. Also, I have noticed duplicate Plugin_ID's.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Plugin_ID first last Name&lt;BR /&gt;101371 1590721200 1598498520 Security Update for Microsoft Office Products (July 2017)&lt;BR /&gt;103137 1590721200 1590721200 Security and Quality Rollup for .NET Framework (Sep 2017)&lt;BR /&gt;103138 1590721200 1598498520 Security Update for Microsoft Office Excel Products (September 2017)&lt;BR /&gt;104556 1590721200 1598498520 Security Updates for Microsoft Excel Products (November 2017)&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 12:45:07 GMT</pubDate>
    <dc:creator>bhagatdd</dc:creator>
    <dc:date>2020-09-28T12:45:07Z</dc:date>
    <item>
      <title>How to compare two searches and find common data between them</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-searches-and-find-common-data-between-them/m-p/521621#M146999</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have following search where I'm searching for the common Plugin_ID between searches. However with the 'stats count by', i'm loosing other fields (Name, _time) that are important part of over all goal. End goal is to find common Plugin_ID between two searches, when it (Plugin_ID) was first detected (date) and number of days from when it was first detected.&amp;nbsp;&lt;/P&gt;&lt;P&gt;index=main sourcetype="csv_nessus" Risk=High earliest=-180d@d latest=-35d@d AND [search index=main sourcetype="csv_nessus" Risk=High earliest=-35d@d latest=now | stats count by Plugin_ID | table Plugin_ID Name _time ] |chart count by Plugin_ID | table Plugin_ID, Name,&amp;nbsp; _time&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Please help me. Thanks,&lt;/P&gt;&lt;P&gt;Bhagatdd&lt;/P&gt;</description>
      <pubDate>Sat, 26 Sep 2020 18:16:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-searches-and-find-common-data-between-them/m-p/521621#M146999</guid>
      <dc:creator>bhagatdd</dc:creator>
      <dc:date>2020-09-26T18:16:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare two searches and find common data between them</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-searches-and-find-common-data-between-them/m-p/521624#M147000</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/226797"&gt;@bhagatdd&lt;/a&gt;&amp;nbsp;..&lt;BR /&gt;one important thing to remember,...&lt;BR /&gt;earliest&lt;SPAN&gt;&amp;nbsp;and&amp;nbsp;&lt;/SPAN&gt;latest&lt;SPAN&gt;&amp;nbsp;only work when you use them in the base search(1st search), not inside the Subsearch(2nd search).&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;and also, for your case, there is no need of subsearch altogether., the earliest and latest also supports an OR condition.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;index=main sourcetype="csv_nessus" Risk=High (earliest=-7d@d latest=-1d@d OR earliest=-35d@d latest=now)&lt;BR /&gt;| stats count by Plugin_ID | table Plugin_ID Name _time ] |chart count by Plugin_ID | table Plugin_ID, Name,&amp;nbsp; _time&lt;/SPAN&gt;&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;&lt;SPAN&gt;documentation for ref:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;index=myindex ((earliest=-24h latest&amp;lt;@d) OR (earliest&amp;gt;=@d+1h))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Search/Specifytimemodifiersinyoursearch" target="_blank" rel="noopener"&gt;https://docs.splunk.com/Documentation/Splunk/latest/Search/Specifytimemodifiersinyoursearch&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(PS - i have given around 350+ karma points so far, received badge for that, if an answer helped you, a karma point would be nice!. we all should start "Learn, Give Back, Have Fun")&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 26 Sep 2020 20:09:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-searches-and-find-common-data-between-them/m-p/521624#M147000</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2020-09-26T20:09:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare two searches and find common data between them</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-searches-and-find-common-data-between-them/m-p/521637#M147005</link>
      <description>&lt;P&gt;Just to clarify, do you mean "&lt;SPAN&gt;End goal is to find common Plugin_ID between two searches, when it (Plugin_ID) was first detected (date) &lt;STRONG&gt;between 180 and 35 days ago&lt;/STRONG&gt; and number of days from when it was first detected&lt;STRONG&gt; to when it was last detected in the last 35 days&lt;/STRONG&gt;"?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=main sourcetype="csv_nessus" Risk=High earliest=-180d@d latest=now
| stats earliest(_time) as first latest(_time) as last values(Name) as Name by Plugin_ID 
| where last &amp;gt; relative_time(now(),"-35d@d") AND first &amp;lt; relative_time(now(),"-35d@d")
| eval difference=((relative_time(last,"@d") - relative_time(first,"@d")) / (60*60*24)
| eval _time=latest
| table Plugin_ID, Name,  _time, difference&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Sep 2020 10:21:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-searches-and-find-common-data-between-them/m-p/521637#M147005</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2020-09-27T10:21:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare two searches and find common data between them</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-searches-and-find-common-data-between-them/m-p/521657#M147009</link>
      <description>&lt;P&gt;Yes.&amp;nbsp;&lt;/P&gt;&lt;P&gt;When Plugin_ID was first detected and also find out if its still present in last 35 days. So, 'OR' is not going to work. I have also tried your last suggestion with AND and its not finding any common data. Thanks.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Sep 2020 21:31:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-searches-and-find-common-data-between-them/m-p/521657#M147009</guid>
      <dc:creator>bhagatdd</dc:creator>
      <dc:date>2020-09-27T21:31:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare two searches and find common data between them</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-searches-and-find-common-data-between-them/m-p/521659#M147010</link>
      <description>&lt;P&gt;Does this at least give you a row for each Plugin_Id with the first and last as you expect?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=main sourcetype="csv_nessus" Risk=High earliest=-180d@d latest=now
| stats earliest(_time) as first latest(_time) as last values(Name) as Name by Plugin_ID&lt;/LI-CODE&gt;&lt;P&gt;Make sure the timepicker for the query is at least&amp;nbsp; earliest of180d back&lt;/P&gt;</description>
      <pubDate>Sun, 27 Sep 2020 22:43:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-searches-and-find-common-data-between-them/m-p/521659#M147010</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2020-09-27T22:43:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare two searches and find common data between them</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-searches-and-find-common-data-between-them/m-p/521776#M147052</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Its difficult to say as format of _time in a readable format. Also, I have noticed duplicate Plugin_ID's.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Plugin_ID first last Name&lt;BR /&gt;101371 1590721200 1598498520 Security Update for Microsoft Office Products (July 2017)&lt;BR /&gt;103137 1590721200 1590721200 Security and Quality Rollup for .NET Framework (Sep 2017)&lt;BR /&gt;103138 1590721200 1598498520 Security Update for Microsoft Office Excel Products (September 2017)&lt;BR /&gt;104556 1590721200 1598498520 Security Updates for Microsoft Excel Products (November 2017)&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:45:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-searches-and-find-common-data-between-them/m-p/521776#M147052</guid>
      <dc:creator>bhagatdd</dc:creator>
      <dc:date>2020-09-28T12:45:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare two searches and find common data between them</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-searches-and-find-common-data-between-them/m-p/521777#M147053</link>
      <description>&lt;LI-CODE lang="markup"&gt;index=main sourcetype="csv_nessus" Risk=High earliest=-180d@d latest=now
| stats earliest(_time) as first latest(_time) as last values(Name) as Name by Plugin_ID
| fieldformat first=stftime(first, "%Y-%m-%d %H:%M:%S")
| fieldformat lasst=stftime(last, "%Y-%m-%d %H:%M:%S")&lt;/LI-CODE&gt;&lt;P&gt;Make it easier to read!&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:50:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-searches-and-find-common-data-between-them/m-p/521777#M147053</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2020-09-28T12:50:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare two searches and find common data between them</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-searches-and-find-common-data-between-them/m-p/521779#M147054</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Receiving following error:&lt;/P&gt;&lt;P&gt;Error in 'fieldformat' command: The 'stftime' function is unsupported or undefined.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:52:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-searches-and-find-common-data-between-them/m-p/521779#M147054</guid>
      <dc:creator>bhagatdd</dc:creator>
      <dc:date>2020-09-28T12:52:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare two searches and find common data between them</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-searches-and-find-common-data-between-them/m-p/521782#M147057</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;with fixing typo 'strftime'&lt;/P&gt;&lt;P&gt;its now showing&amp;nbsp;&lt;SPAN&gt;query is at least&amp;nbsp; earliest of180d back.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:58:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-searches-and-find-common-data-between-them/m-p/521782#M147057</guid>
      <dc:creator>bhagatdd</dc:creator>
      <dc:date>2020-09-28T12:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare two searches and find common data between them</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-searches-and-find-common-data-between-them/m-p/521796#M147063</link>
      <description>&lt;P&gt;Sorry about the typo&lt;/P&gt;&lt;P&gt;Let's see what is being removed by the where firstly for Plugin_IDs that first appeared over 35 days ago&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=main sourcetype="csv_nessus" Risk=High earliest=-180d@d latest=now
| stats earliest(_time) as first latest(_time) as last values(Name) as Name by Plugin_ID
| where first &amp;lt; relative_time(now(),"-35d@d")
| fieldformat first=strftime(first, "%Y-%m-%d %H:%M:%S")
| fieldformat lasst=strftime(last, "%Y-%m-%d %H:%M:%S")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp; And then for Plugin_IDs that last appeared less than 35 days ago&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=main sourcetype="csv_nessus" Risk=High earliest=-180d@d latest=now
| stats earliest(_time) as first latest(_time) as last values(Name) as Name by Plugin_ID
| where last &amp;gt; relative_time(now(),"-35d@d")
| fieldformat first=strftime(first, "%Y-%m-%d %H:%M:%S")
| fieldformat lasst=strftime(last, "%Y-%m-%d %H:%M:%S")&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 28 Sep 2020 13:30:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-searches-and-find-common-data-between-them/m-p/521796#M147063</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2020-09-28T13:30:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare two searches and find common data between them</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-searches-and-find-common-data-between-them/m-p/521800#M147065</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Last query (&lt;SPAN&gt;Plugin_IDs that last appeared less than 35 days ago&lt;/SPAN&gt;) showing correct data. Only missing field is # of days from it was first detected.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 13:41:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-searches-and-find-common-data-between-them/m-p/521800#M147065</guid>
      <dc:creator>bhagatdd</dc:creator>
      <dc:date>2020-09-28T13:41:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare two searches and find common data between them</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-searches-and-find-common-data-between-them/m-p/521816#M147074</link>
      <description>&lt;P&gt;OK let's use different names to avoid clashes with reserve words&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=main sourcetype="csv_nessus" Risk=High earliest=-180d@d latest=now
| stats earliest(_time) as firstseen latest(_time) as lastseen values(Name) as Name by Plugin_ID
| where firstseen &amp;lt; relative_time(now(),"-35d@d")
| fieldformat firstseen=strftime(firstseen, "%Y-%m-%d %H:%M:%S")
| fieldformat lasstseen=strftime(lastseen, "%Y-%m-%d %H:%M:%S")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;If that gives you the events first seen between 180 and 35 days ago, then the full query would be&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=main sourcetype="csv_nessus" Risk=High earliest=-180d@d latest=now
| stats earliest(_time) as firstseen latest(_time) as lastseen values(Name) as Name by Plugin_ID 
| where lastseen &amp;gt; relative_time(now(),"-35d@d") AND firstseen &amp;lt; relative_time(now(),"-35d@d")
| eval difference=((relative_time(lastseen,"@d") - relative_time(firstseen,"@d")) / (60*60*24)
| eval _time=latest
| table Plugin_ID, Name,  _time, difference&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 28 Sep 2020 14:14:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-searches-and-find-common-data-between-them/m-p/521816#M147074</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2020-09-28T14:14:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare two searches and find common data between them</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-searches-and-find-common-data-between-them/m-p/521823#M147076</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Excellent.&lt;/P&gt;&lt;P&gt;This query showing expected results. Thank you for your help.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 14:33:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-searches-and-find-common-data-between-them/m-p/521823#M147076</guid>
      <dc:creator>bhagatdd</dc:creator>
      <dc:date>2020-09-28T14:33:19Z</dc:date>
    </item>
  </channel>
</rss>

