<?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: Get a list of ID by date and compare with lookup file and get result not in search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Get-a-list-of-ID-by-date-and-compare-with-lookup-file-and-get/m-p/537407#M151920</link>
    <description>&lt;P&gt;Thank you! It's worked perfectly&lt;/P&gt;</description>
    <pubDate>Wed, 27 Jan 2021 12:55:25 GMT</pubDate>
    <dc:creator>mzn1979</dc:creator>
    <dc:date>2021-01-27T12:55:25Z</dc:date>
    <item>
      <title>Get a list of ID by date and compare with lookup file and get result not in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-a-list-of-ID-by-date-and-compare-with-lookup-file-and-get/m-p/537167#M151838</link>
      <description>&lt;P&gt;Hi everyone&lt;/P&gt;&lt;P&gt;I have a lookupfile that contains a name and an ID&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Brokers.csv
Name        ID
Broker1     101
Broker2     102
Broker3     103
Broker4     201
Broker5     202
Broker6     203&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I run this search query on my data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=SQL 
| fields BrokerID host
| convert timeformat="%Y-%m-%d" ctime(_time) AS date
| stats values(BrokerID) by date&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and this is my results&lt;/P&gt;&lt;TABLE border="1" width="36.284022803492604%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="23.289830231330356%"&gt;&lt;STRONG&gt;date&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="27.655337386725662%" height="20"&gt;&lt;STRONG&gt;BrokerID&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="23.289830231330356%"&gt;2020-12-27&lt;/TD&gt;&lt;TD width="27.655337386725662%"&gt;101&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="23.289830231330356%"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="27.655337386725662%"&gt;102&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="23.289830231330356%"&gt;2020-12-27&lt;/TD&gt;&lt;TD width="27.655337386725662%"&gt;201&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="23.289830231330356%"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="27.655337386725662%"&gt;202&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="23.289830231330356%"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="27.655337386725662%"&gt;203&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="23.289830231330356%"&gt;2020-12-28&lt;/TD&gt;&lt;TD width="27.655337386725662%"&gt;101&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="23.289830231330356%"&gt;2020-12-29&lt;/TD&gt;&lt;TD width="27.655337386725662%"&gt;101&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="23.289830231330356%"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="27.655337386725662%"&gt;102&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="23.289830231330356%"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="27.655337386725662%"&gt;103&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="23.289830231330356%"&gt;2020-12-29&lt;/TD&gt;&lt;TD width="27.655337386725662%"&gt;201&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="23.289830231330356%"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="27.655337386725662%"&gt;202&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="23.289830231330356%"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="27.655337386725662%"&gt;203&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So What query I should run to get following result?&lt;/P&gt;&lt;TABLE border="1" width="35.53198751779051%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="17.279029472577864%" height="25px"&gt;2020-12-27&lt;/TD&gt;&lt;TD width="22.86046257103425%" height="25px"&gt;Broker3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="17.279029472577864%" height="25px"&gt;2020-12-28&lt;/TD&gt;&lt;TD width="22.86046257103425%" height="25px"&gt;Broker2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="17.279029472577864%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="22.86046257103425%" height="25px"&gt;Broker3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="17.279029472577864%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="22.86046257103425%" height="25px"&gt;Broker4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="17.279029472577864%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="22.86046257103425%" height="25px"&gt;Broker5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="17.279029472577864%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="22.86046257103425%" height="25px"&gt;Broker6&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jan 2021 09:07:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-a-list-of-ID-by-date-and-compare-with-lookup-file-and-get/m-p/537167#M151838</guid>
      <dc:creator>mzn1979</dc:creator>
      <dc:date>2021-01-26T09:07:26Z</dc:date>
    </item>
    <item>
      <title>Re: Get a list of ID by date and compare with lookup file and get result not in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-a-list-of-ID-by-date-and-compare-with-lookup-file-and-get/m-p/537306#M151879</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/45228"&gt;@mzn1979&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's a bit fiddly, which is often the case when proving negatives, but what this is doing is appending the entire Brokers.csv file to a new column for &lt;STRONG&gt;_every_&lt;/STRONG&gt; row in the results set. See the stats values(BrokerID) command down for the solution. Up to there, it's just setting up your example data.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval x=split("2020-12-27,101:2020-12-27,102:2020-12-27,201:2020-12-27,202:2020-12-27,203:2020-12-28,101:2020-12-29,101:2020-12-29,102:2020-12-29,103:2020-12-29,201:2020-12-29,202:2020-12-29,203",":")
| mvexpand x
| rex field=x "(?&amp;lt;date&amp;gt;[^,]*),(?&amp;lt;BrokerID&amp;gt;\d+)"
| stats values(BrokerID) as BrokerID by date
| appendcols [
  | inputlookup Brokers.csv | stats values(ID) as IDS
]
| filldown IDS
| mvexpand IDS
| eval Missing=if(isnull(mvfind(BrokerID,IDS)),true(), null())
| where !isnull(Missing)
| stats values(IDS) as IDS by date
| lookup Brokers.csv ID as IDS
| fields - IDS&lt;/LI-CODE&gt;&lt;P&gt;appendcols is doing the adding of all the brokers to a new column called IDS in the first result set row and then filldown will copy that column to all subsequent rows.&lt;/P&gt;&lt;P&gt;Then it's just a matter of expanding out that data and effectively doing a lookup of itself for each row to see which ones are missing.&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jan 2021 21:10:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-a-list-of-ID-by-date-and-compare-with-lookup-file-and-get/m-p/537306#M151879</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2021-01-26T21:10:28Z</dc:date>
    </item>
    <item>
      <title>Re: Get a list of ID by date and compare with lookup file and get result not in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-a-list-of-ID-by-date-and-compare-with-lookup-file-and-get/m-p/537407#M151920</link>
      <description>&lt;P&gt;Thank you! It's worked perfectly&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2021 12:55:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-a-list-of-ID-by-date-and-compare-with-lookup-file-and-get/m-p/537407#M151920</guid>
      <dc:creator>mzn1979</dc:creator>
      <dc:date>2021-01-27T12:55:25Z</dc:date>
    </item>
  </channel>
</rss>

