<?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 query to remove results from another source. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Search-query-to-remove-results-from-another-source/m-p/564754#M196726</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/206061"&gt;@scelikok&lt;/a&gt;&lt;/P&gt;&lt;P&gt;Thanks, but, it's only returning one event from one ID.&lt;/P&gt;&lt;P&gt;I need to get the last event for every ID that is in the 'inserted'.&lt;/P&gt;&lt;P&gt;I appreciate your help.&lt;/P&gt;</description>
    <pubDate>Wed, 25 Aug 2021 15:52:13 GMT</pubDate>
    <dc:creator>rodrigomarfei</dc:creator>
    <dc:date>2021-08-25T15:52:13Z</dc:date>
    <item>
      <title>Search query to remove results from another source.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-query-to-remove-results-from-another-source/m-p/564733#M196718</link>
      <description>&lt;P&gt;I have the following sourcers: "inserted" and "deleted"&lt;/P&gt;&lt;P&gt;In the "inserted" i have these fields:&lt;BR /&gt;Id, Timestamp&lt;BR /&gt;1, 2021-08-18T19:39:31.3003273&lt;BR /&gt;2, 2021-08-18T02:25:05.786293&lt;BR /&gt;3, 2021-08-18T19:39:31.301158&lt;BR /&gt;etc....&lt;/P&gt;&lt;P&gt;In the "deleted" I have the same fields:&lt;BR /&gt;Id, Timestamp&lt;BR /&gt;1, 2021-08-18T19:39:31.3003234&lt;BR /&gt;1, 2021-08-18T19:28:00.8425431&lt;BR /&gt;1, 2021-08-18T19:27:07.2603396&lt;BR /&gt;2, 2021-08-18T18:57:52.3556542&lt;BR /&gt;2, 2021-08-18T15:06:19.3365628&lt;BR /&gt;3, 2021-08-18T15:06:02.5264226&lt;BR /&gt;3, 2021-08-18T12:06:29.5371453&lt;BR /&gt;3, 2021-08-18T11:55:40.7562728&lt;BR /&gt;3, 2021-08-18T03:22:06.3672773&lt;/P&gt;&lt;P&gt;I need to filter the events in the 'inserted' that are newer than in the 'deleted', where the Id's are the same in both sourcers and the timestamp in the 'inserted' is greater than the Timestamp in the 'deleted'.&lt;/P&gt;&lt;P&gt;I've managed to set up a search for one ID and manually setting the last timestamp that I found in the 'deleted', as per below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;index=something source=inserted Id=1
| eval data_inserted = strptime('Timestamp', "%Y-%m-%dT%H:%M:%S.%Q")
| eval data_deleted = "2021-08-18T19:39:31.3003234"
| eval data_deleted = strptime('data_deleted', "%Y-%m-%dT%H:%M:%S.%Q")
| where data_inserted &amp;gt; data_deleted&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My goal and help needed is on how to do this automatically for the IDs and Timestamp I have in the source='deleted'.&lt;/P&gt;&lt;P&gt;Your help is very much appreciated.&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 25 Aug 2021 14:23:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-query-to-remove-results-from-another-source/m-p/564733#M196718</guid>
      <dc:creator>rodrigomarfei</dc:creator>
      <dc:date>2021-08-25T14:23:03Z</dc:date>
    </item>
    <item>
      <title>Re: Search query to remove results from another source.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-query-to-remove-results-from-another-source/m-p/564741#M196721</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/237773"&gt;@rodrigomarfei&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Please try below search;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=something (source=inserted OR source=deleted)
| eval timestamp = strptime('Timestamp', "%Y-%m-%dT%H:%M:%S.%Q")
| sort -timestamp
| dedup id
| search source=inserted&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 25 Aug 2021 15:01:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-query-to-remove-results-from-another-source/m-p/564741#M196721</guid>
      <dc:creator>scelikok</dc:creator>
      <dc:date>2021-08-25T15:01:34Z</dc:date>
    </item>
    <item>
      <title>Re: Search query to remove results from another source.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-query-to-remove-results-from-another-source/m-p/564754#M196726</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/206061"&gt;@scelikok&lt;/a&gt;&lt;/P&gt;&lt;P&gt;Thanks, but, it's only returning one event from one ID.&lt;/P&gt;&lt;P&gt;I need to get the last event for every ID that is in the 'inserted'.&lt;/P&gt;&lt;P&gt;I appreciate your help.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Aug 2021 15:52:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-query-to-remove-results-from-another-source/m-p/564754#M196726</guid>
      <dc:creator>rodrigomarfei</dc:creator>
      <dc:date>2021-08-25T15:52:13Z</dc:date>
    </item>
    <item>
      <title>Re: Search query to remove results from another source.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-query-to-remove-results-from-another-source/m-p/564758#M196727</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/237773"&gt;@rodrigomarfei&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Using your sample data below search is working. There is only a typo on Id field but I think you already corrected.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults | eval _raw="Id,Timestamp,source
1,2021-08-18T19:39:31.3003234,deleted
1,2021-08-18T19:28:00.8425431,deleted
1,2021-08-18T19:27:07.2603396,deleted
2,2021-08-18T18:57:52.3556542,deleted
2,2021-08-18T15:06:19.3365628,deleted
3,2021-08-18T15:06:02.5264226,deleted
3,2021-08-18T12:06:29.5371453,deleted
3,2021-08-18T11:55:40.7562728,deleted
3,2021-08-18T03:22:06.3672773,deleted
1,2021-08-18T19:39:31.3003273,inserted
2,2021-08-18T02:25:05.786293,inserted
3,2021-08-18T19:39:31.301158,inserted"
| multikv forceheader=1
| fields - _raw _time linecount
| eval timestamp = strptime('Timestamp', "%Y-%m-%dT%H:%M:%S.%7Q")
| sort -timestamp
| dedup Id
| search source=inserted&lt;/LI-CODE&gt;&lt;P&gt;,&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="scelikok_0-1629908079548.png" style="width: 2294px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/15736iB680E1A3DEEF9FEB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="scelikok_0-1629908079548.png" alt="scelikok_0-1629908079548.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Is it possible that your real data is somehow different?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Aug 2021 16:15:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-query-to-remove-results-from-another-source/m-p/564758#M196727</guid>
      <dc:creator>scelikok</dc:creator>
      <dc:date>2021-08-25T16:15:42Z</dc:date>
    </item>
    <item>
      <title>Re: Search query to remove results from another source.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-query-to-remove-results-from-another-source/m-p/565071#M196848</link>
      <description>&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;The problem was that sort limits to 10.000 results and I have more than 6 millions events.&lt;/P&gt;&lt;P&gt;All I had to do was to set sort to unlimited. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Aug 2021 14:06:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-query-to-remove-results-from-another-source/m-p/565071#M196848</guid>
      <dc:creator>rodrigomarfei</dc:creator>
      <dc:date>2021-08-27T14:06:53Z</dc:date>
    </item>
  </channel>
</rss>

