<?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: Merging two searches where initial output is fed to lookup table in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-searches-where-initial-output-is-fed-to-lookup/m-p/636003#M220935</link>
    <description>&lt;P&gt;Awesome.&amp;nbsp; Thank you yuanliu.&amp;nbsp; &amp;nbsp; I appreciate it!&lt;/P&gt;</description>
    <pubDate>Sat, 25 Mar 2023 03:16:34 GMT</pubDate>
    <dc:creator>Sven1</dc:creator>
    <dc:date>2023-03-25T03:16:34Z</dc:date>
    <item>
      <title>How to merge two searches where initial output is fed to lookup table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-searches-where-initial-output-is-fed-to-lookup/m-p/634504#M220436</link>
      <description>&lt;P&gt;I am working to merge two searches. The first search outputs one or more account names:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=x sourcetype=y
| table account&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The second search (below), for each account name, filters lookup csv table 'account lookup' on that account name and counts the number of dates in an adjacent column in the lookup table that are within the last seven days.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| inputlookup append=T account_lookup where account=Account_A
| where time &amp;gt; relative_time(now(),"-7d")
| stats count as "Accounts Updated in Last 7 Days"]&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My searches and attempts to apply related information have not yet revealed how I can pass the account names outputted in the first search into the lookup that is in the second search.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many thanks for any help.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sven&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2023 17:01:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-searches-where-initial-output-is-fed-to-lookup/m-p/634504#M220436</guid>
      <dc:creator>Sven1</dc:creator>
      <dc:date>2023-03-15T17:01:53Z</dc:date>
    </item>
    <item>
      <title>Re: Merging two searches where initial output is fed to lookup table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-searches-where-initial-output-is-fed-to-lookup/m-p/634507#M220438</link>
      <description>&lt;P&gt;I think you meant to use lookup instead of inputlookup, like&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=x sourcetype=y
| table account
| lookup account_lookup account
| where where time &amp;gt; relative_time(now(),"-7d")
| stats dc(account) as "Accounts Updated in Last 7 Days"&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 15 Mar 2023 05:18:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-searches-where-initial-output-is-fed-to-lookup/m-p/634507#M220438</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-03-15T05:18:33Z</dc:date>
    </item>
    <item>
      <title>Re: Merging two searches where initial output is fed to lookup table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-searches-where-initial-output-is-fed-to-lookup/m-p/634534#M220444</link>
      <description>&lt;P&gt;Thank you! I appreciate it.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2023 08:50:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-searches-where-initial-output-is-fed-to-lookup/m-p/634534#M220444</guid>
      <dc:creator>Sven1</dc:creator>
      <dc:date>2023-03-15T08:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: Merging two searches where initial output is fed to lookup table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-searches-where-initial-output-is-fed-to-lookup/m-p/634655#M220485</link>
      <description>&lt;P&gt;Thank you very much yuanliu.&amp;nbsp; Please let me clarify that for each account identified in the first part of the search, I want to:&lt;/P&gt;&lt;P&gt;(1) filter the&amp;nbsp;'account_lookup' table on that account&lt;/P&gt;&lt;P&gt;(2) filter the&amp;nbsp;'account_lookup' table on the]dates in an adjacent 'Date' column&amp;nbsp;&lt;SPAN&gt;that are within seven days of the current date, and then&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(3) count the number of matching rows and return that as "Records updated in the last 7 days"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here, a "Record" is the same as a row.&amp;nbsp; (I should have used the word "Record" in my original post.) Main columns in the&amp;nbsp;account_lookup' table are "Account" and "Date".&amp;nbsp; The&amp;nbsp;account_lookup' table will typically have multiple rows for a given account.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;The first two lines below generate a table of one or more accounts, and for each account, the above steps are to be taken. The end result will be a table listing each account and the associated number of rows for that account that have been updated within the last 7 days.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=x sourcetype=y
| table account
| lookup account_lookup account
| where time &amp;gt; relative_time(now(),"-7d")
| stats count as"Records updated in the last 7 days" values(account) AS account&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Variations of the above search have not produced the desired result. Thanks again for any help in nailing this down.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2023 00:46:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-searches-where-initial-output-is-fed-to-lookup/m-p/634655#M220485</guid>
      <dc:creator>Sven1</dc:creator>
      <dc:date>2023-03-16T00:46:33Z</dc:date>
    </item>
    <item>
      <title>Re: Merging two searches where initial output is fed to lookup table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-searches-where-initial-output-is-fed-to-lookup/m-p/634707#M220502</link>
      <description>&lt;P&gt;The above missed two points. &amp;nbsp;First, &lt;EM&gt;time&lt;/EM&gt; field (which you now indicate is named &lt;FONT face="andale mono,times"&gt;Date&lt;/FONT&gt;) is more likely a string than real time. (This also mean that the second search in the description could not possibly work.) &amp;nbsp;Second, that Date could have multiple values. &amp;nbsp;Correcting for these, you can try (assuming that Date field has the format "YYYY-MM-DD" which "%F" will match):&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=x sourcetype=y
| table account ``` it is better to not use table at this stage; use fields if RAM and performance is a concern or nothing at all ```
| lookup account_lookup account output Date
| eval Date = mvmap(Date, strptime(Date, "%F")) ``` "%F" is the same as "%Y-%m-%d" ```, latest = max(Date)
| where latest &amp;gt; relative_time(now(),"-7d")
| stats count as"Records updated in the last 7 days" values(account) AS account&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2023 05:30:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-searches-where-initial-output-is-fed-to-lookup/m-p/634707#M220502</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-03-16T05:30:24Z</dc:date>
    </item>
    <item>
      <title>Re: Merging two searches where initial output is fed to lookup table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-searches-where-initial-output-is-fed-to-lookup/m-p/634809#M220544</link>
      <description>&lt;P&gt;Thank you.&amp;nbsp; I appreciate it.&amp;nbsp; I have tried variations of the search you sent and am still working to converge on the solution.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, if the first line of the below search returns 'ACCT_A' - I can use the below 'append' statement to identify how many 'ACCT_A' records have been updated in the last 7 days. This SPL works. I can go into the 'account_lookup' table and verify that it works.&lt;/P&gt;&lt;P&gt;I really appreciate help in establishing what is needed to generalize the below search into a search that takes each value of 'account' returned by the first part of the search (whether it is one or several values) and performs the analysis represented by the append statement below.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=x sourcetype=y
| append [inputlookup account_lookup where account=ACCT_A
| where date &amp;gt; relative_time(now(),"-7d")
| stats count as "Records updated in the last 7 days" values(account) AS account]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2023 18:05:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-searches-where-initial-output-is-fed-to-lookup/m-p/634809#M220544</guid>
      <dc:creator>Sven1</dc:creator>
      <dc:date>2023-03-16T18:05:37Z</dc:date>
    </item>
    <item>
      <title>Re: Merging two searches where initial output is fed to lookup table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-searches-where-initial-output-is-fed-to-lookup/m-p/634871#M220557</link>
      <description>&lt;P&gt;I am still confused. &amp;nbsp;Could you clarify the following:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Is the time/date field in account_lookup named &lt;U&gt;time&lt;/U&gt;, &lt;U&gt;date&lt;/U&gt;, or &lt;U&gt;Date&lt;/U&gt;? &amp;nbsp;You referred to it in three different forms. &amp;nbsp;I will take &lt;U&gt;date&lt;/U&gt; this time as that is in your latest illustration.&lt;/LI&gt;&lt;LI&gt;Is this time/date field in the form of epoch seconds, or is it in the form of a calendar string? &amp;nbsp;If latter, the subsearch cannot possible do any filtering. &amp;nbsp;So, I will assume that the &lt;U&gt;date&lt;/U&gt; field is in epoch.&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;The biggest confusion I had was perhaps which information is supposed to be&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;"Records updated in the last 7 days". &amp;nbsp;Is it event count from search index=x, sourcetype=y or number of values returned from the lookup? &amp;nbsp;So far I have assumed that it is the former. &amp;nbsp;I can try to use the latter interpretation, like this:&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=x sourcetype=y
| lookup account_lookup account output date
| eval "Records updated in the last 7 days" = mvcount(mvmap(date, if(date &amp;gt; relative_time(now(), "-7d@d"), date, null())))
``` assumptions:
1. account_lookup contains a date field in epoch.
2. date comparison is within lookup output, unrelated to events
```&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Mar 2023 06:36:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-searches-where-initial-output-is-fed-to-lookup/m-p/634871#M220557</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-03-17T06:36:31Z</dc:date>
    </item>
    <item>
      <title>Re: Merging two searches where initial output is fed to lookup table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-searches-where-initial-output-is-fed-to-lookup/m-p/634903#M220566</link>
      <description>&lt;P&gt;Thank you.&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(1) The time/date field in account_lookup is named&amp;nbsp;&lt;/SPAN&gt;&lt;U&gt;date.&amp;nbsp;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(2) The time/date field is in epoch seconds.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(3) The first part of the search will return at least one and potentially several account names. For each account name, the remaining part of the search will one at a time, successively:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;(a) filter the&amp;nbsp;'account_lookup' table on one account name&lt;/P&gt;&lt;P&gt;(b) for that one account, filter the&amp;nbsp;'account_lookup' table on the dates in an adjacent 'date' column&amp;nbsp;&lt;SPAN&gt;that are within seven days of the current date, and then&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(c) count the number of matching rows and return that as "Records updated in the last 7 days"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The output will have at least one row, and potentially several rows. An example output of the search is:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Account&amp;nbsp; &amp;nbsp; &amp;nbsp; Records updated in the last 7 days&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ACCT_A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;12&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ACCT_G&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;7&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ACCT_ M&amp;nbsp; &amp;nbsp; &amp;nbsp;15&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ACCT_R&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Again, thank you.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Mar 2023 12:01:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-searches-where-initial-output-is-fed-to-lookup/m-p/634903#M220566</guid>
      <dc:creator>Sven1</dc:creator>
      <dc:date>2023-03-17T12:01:37Z</dc:date>
    </item>
    <item>
      <title>Re: Merging two searches where initial output is fed to lookup table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-searches-where-initial-output-is-fed-to-lookup/m-p/634986#M220594</link>
      <description>&lt;P&gt;In that case, the search in my previous reply should add the desired &lt;SPAN&gt;"Records updated in the last 7 days" if the count is nonzero&lt;/SPAN&gt;. &amp;nbsp;No stats needed. &amp;nbsp;Did you try that?&lt;/P&gt;</description>
      <pubDate>Fri, 17 Mar 2023 22:22:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-searches-where-initial-output-is-fed-to-lookup/m-p/634986#M220594</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-03-17T22:22:49Z</dc:date>
    </item>
    <item>
      <title>Re: Merging two searches where initial output is fed to lookup table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-searches-where-initial-output-is-fed-to-lookup/m-p/634994#M220601</link>
      <description>&lt;P&gt;I appreciate your help! Unfortunately, careful use of that SPL, copied below, does not work yet.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=x sourcetype=y
| lookup account_lookup account output date
| eval "Records updated in the last 7 days" = mvcount(mvmap(date, if(date &amp;gt; relative_time(now(), "-7d@d"), date, null())))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The "Records updated in the last 7 days" field is blank.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The date field within 'account_lookup.csv' is a&amp;nbsp;10-digit number.&amp;nbsp; I noticed that If I run the following, the 'date' field formatting reverts to a 10-digit number.&amp;nbsp; However, the formatting of an additional date/time field "initial_date" remains intact.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=x sourcetype=y
| convert timeformat="%m/%d/%Y %H:%M:%S" ctime(date) 
| convert timeformat="%m/%d/%Y %H:%M:%S" ctime(initial_date)
| lookup account_lookup account output date
| eval "Records updated in the last 7 days" = mvcount(mvmap(date, if(date &amp;gt; relative_time(now(), "-7d@d"), date, null())))
| table account date initial_date&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 18 Mar 2023 02:44:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-searches-where-initial-output-is-fed-to-lookup/m-p/634994#M220601</guid>
      <dc:creator>Sven1</dc:creator>
      <dc:date>2023-03-18T02:44:52Z</dc:date>
    </item>
    <item>
      <title>Re: Merging two searches where initial output is fed to lookup table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-searches-where-initial-output-is-fed-to-lookup/m-p/635992#M220930</link>
      <description>&lt;P&gt;Could someone with more experience with SPL than me please take a look and help me nail this down?&lt;/P&gt;&lt;P&gt;I am working to merge two searches. The first part of the search will return at least one and potentially several account names. For each account name, the remaining part of the search will one at a time, successively:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;filter 'account_lookup.csv' on one account name&lt;/LI&gt;&lt;LI&gt;for that one account, filter 'account_lookup.csv' on the dates in an adjacent 'date' column that are within seven days of the current date, and then&lt;/LI&gt;&lt;LI&gt;count the number of matching rows and return that as "Records updated in the last 7 days"&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(my search)
| inputlookup account_lookup.csv
| search account=ACCT_A
| eval Date = mvmap(date, strptime(date, "%Y-%m-%d")), latest = max(date)
| where latest &amp;gt; relative_time(now(),"-7d@d")
| stats values(account) AS account count as "Records updated in the last 7 days"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The output will have at least one row, and potentially several rows. An example final output is:&lt;/P&gt;&lt;PRE&gt;Account&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Records updated in the last 7 days&lt;BR /&gt;ACCT_A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  11&lt;BR /&gt;ACCT_B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&lt;BR /&gt;ACCT_C&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;3&lt;BR /&gt;ACCT_D&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9&lt;/PRE&gt;&lt;P&gt;Or, based on the results of the first part of the search, the output may be:&lt;/P&gt;&lt;PRE&gt;account     Records updated in the last 7 days&lt;BR /&gt;ACCT_A      11&lt;/PRE&gt;&lt;P&gt;I have pasted a sample ‘account_lookup.csv’ below&amp;nbsp; &amp;nbsp;The results of the second part of the above search against ‘account_lookup.csv’ are what is listed above.&lt;/P&gt;&lt;P&gt;However, I am trying to dynamically feed the account name(s) generated from the first part of the search into the proper SPL that will generate the results described above.&amp;nbsp; Specifically: if there are 1, 2 or ‘x’ number of account names generated as output from the first part of the search, that is how many distinct rows are listed in the final output, with each row listing the number of “Records updated in the last 7 days’ for that account.&lt;/P&gt;&lt;P&gt;Many thanks to&amp;nbsp;&lt;SPAN&gt;yuanliu for looking at this earlier.&amp;nbsp; The SPL suggested earlier, as well as different variations, would collapse the results into one row and typically list '0' records updated - no matter if the first part of the search generated one account or multiple accounts. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Now, I have had a chance again to work to get this nailed down and appreciate any guidance.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE width="343"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="64"&gt;account&lt;/TD&gt;&lt;TD width="122"&gt;date&lt;/TD&gt;&lt;TD width="157"&gt;date2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;ACCT_D&lt;/TD&gt;&lt;TD&gt;1679061065&lt;/TD&gt;&lt;TD&gt;3/17/2023 13:51&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;ACCT_C&lt;/TD&gt;&lt;TD&gt;1679038288&lt;/TD&gt;&lt;TD&gt;3/17/2023 7:31&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;ACCT_A&lt;/TD&gt;&lt;TD&gt;1679015511&lt;/TD&gt;&lt;TD&gt;3/17/2023 1:11&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;ACCT_B&lt;/TD&gt;&lt;TD&gt;1678992734&lt;/TD&gt;&lt;TD&gt;3/16/2023 18:52&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;ACCT_D&lt;/TD&gt;&lt;TD&gt;1679607713&lt;/TD&gt;&lt;TD&gt;3/23/2023 21:41&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;ACCT_A&lt;/TD&gt;&lt;TD&gt;1679584936&lt;/TD&gt;&lt;TD&gt;3/23/2023 15:22&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;ACCT_B&lt;/TD&gt;&lt;TD&gt;1679562159&lt;/TD&gt;&lt;TD&gt;3/23/2023 9:02&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;ACCT_D&lt;/TD&gt;&lt;TD&gt;1679539382&lt;/TD&gt;&lt;TD&gt;3/23/2023 2:43&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;ACCT_A&lt;/TD&gt;&lt;TD&gt;1679379943&lt;/TD&gt;&lt;TD&gt;3/21/2023 6:25&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;ACCT_B&lt;/TD&gt;&lt;TD&gt;1679357166&lt;/TD&gt;&lt;TD&gt;3/21/2023 0:06&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;ACCT_D&lt;/TD&gt;&lt;TD&gt;1679334389&lt;/TD&gt;&lt;TD&gt;3/20/2023 17:46&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;ACCT_A&lt;/TD&gt;&lt;TD&gt;1679311612&lt;/TD&gt;&lt;TD&gt;3/20/2023 11:26&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;ACCT_B&lt;/TD&gt;&lt;TD&gt;1679288835&lt;/TD&gt;&lt;TD&gt;3/20/2023 5:07&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;ACCT_D&lt;/TD&gt;&lt;TD&gt;1679516605&lt;/TD&gt;&lt;TD&gt;3/22/2023 20:23&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;ACCT_C&lt;/TD&gt;&lt;TD&gt;1679493828&lt;/TD&gt;&lt;TD&gt;3/22/2023 14:03&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;ACCT_A&lt;/TD&gt;&lt;TD&gt;1679698821&lt;/TD&gt;&lt;TD&gt;3/24/2023 23:00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;ACCT_A&lt;/TD&gt;&lt;TD&gt;1679676044&lt;/TD&gt;&lt;TD&gt;3/24/2023 16:40&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;ACCT_A&lt;/TD&gt;&lt;TD&gt;1679653267&lt;/TD&gt;&lt;TD&gt;3/24/2023 10:21&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;ACCT_B&lt;/TD&gt;&lt;TD&gt;1679630490&lt;/TD&gt;&lt;TD&gt;3/24/2023 4:01&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;ACCT_D&lt;/TD&gt;&lt;TD&gt;1679266058&lt;/TD&gt;&lt;TD&gt;3/19/2023 22:47&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;ACCT_A&lt;/TD&gt;&lt;TD&gt;1679243281&lt;/TD&gt;&lt;TD&gt;3/19/2023 16:28&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&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;</description>
      <pubDate>Sat, 25 Mar 2023 00:30:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-searches-where-initial-output-is-fed-to-lookup/m-p/635992#M220930</guid>
      <dc:creator>Sven1</dc:creator>
      <dc:date>2023-03-25T00:30:22Z</dc:date>
    </item>
    <item>
      <title>Re: Merging two searches where initial output is fed to lookup table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-searches-where-initial-output-is-fed-to-lookup/m-p/636000#M220934</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| lookup account_lookup account
| eval "Records updated in the last 7 days" = mvcount(mvmap(date, if(date &amp;gt; relative_time(now(), "-7d@d"), date, null())))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't understand why the above is not working for you. &amp;nbsp;It certainly works for me. &amp;nbsp;Let me show my emulation:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval account = mvappend("ACCT_A", "ACCT_B", "ACCT_C", "ACCT_D")
| mvexpand account
``` data emulation above ```
| lookup account_lookup account
| eval "Records updated in the last 7 days" = mvcount(mvmap(date, if(date &amp;gt; relative_time(now(), "-7d@d"), date, null())))
``` assumptions:
1. account_lookup contains a date field in epoch.
2. date comparison is within lookup output, unrelated to events
```&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With your latest lookup sample, the output is&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="214.703125px" height="25px"&gt;Records updated in the last 7 days&lt;/TD&gt;&lt;TD width="166.046875px" height="25px"&gt;_time&lt;/TD&gt;&lt;TD width="72.15625px" height="25px"&gt;account&lt;/TD&gt;&lt;TD width="107px" height="25px"&gt;&lt;DIV class=""&gt;date&lt;/DIV&gt;&lt;/TD&gt;&lt;TD width="138.234375px" height="25px"&gt;&lt;DIV class=""&gt;date2&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="214.703125px" height="179px"&gt;7&lt;/TD&gt;&lt;TD width="166.046875px" height="179px"&gt;2023-03-24 19:41:06&lt;/TD&gt;&lt;TD width="72.15625px" height="179px"&gt;ACCT_A&lt;/TD&gt;&lt;TD width="107px" height="179px"&gt;&lt;DIV class=""&gt;1679015511&lt;/DIV&gt;&lt;DIV class=""&gt;1679584936&lt;/DIV&gt;&lt;DIV class=""&gt;1679379943&lt;/DIV&gt;&lt;DIV class=""&gt;1679311612&lt;/DIV&gt;&lt;DIV class=""&gt;1679698821&lt;/DIV&gt;&lt;DIV class=""&gt;1679676044&lt;/DIV&gt;&lt;DIV class=""&gt;1679653267&lt;/DIV&gt;&lt;DIV class=""&gt;1679243281&lt;/DIV&gt;&lt;/TD&gt;&lt;TD width="138.234375px" height="179px"&gt;&lt;DIV class=""&gt;3/17/2023 1:11&lt;/DIV&gt;&lt;DIV class=""&gt;3/23/2023 15:22&lt;/DIV&gt;&lt;DIV class=""&gt;3/21/2023 6:25&lt;/DIV&gt;&lt;DIV class=""&gt;3/20/2023 11:26&lt;/DIV&gt;&lt;DIV class=""&gt;3/24/2023 23:00&lt;/DIV&gt;&lt;DIV class=""&gt;3/24/2023 16:40&lt;/DIV&gt;&lt;DIV class=""&gt;3/24/2023 10:21&lt;/DIV&gt;&lt;DIV class=""&gt;3/19/2023 16:28&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="214.703125px" height="113px"&gt;4&lt;/TD&gt;&lt;TD width="166.046875px" height="113px"&gt;2023-03-24 19:41:06&lt;/TD&gt;&lt;TD width="72.15625px" height="113px"&gt;ACCT_B&lt;/TD&gt;&lt;TD width="107px" height="113px"&gt;&lt;DIV class=""&gt;1678992734&lt;/DIV&gt;&lt;DIV class=""&gt;1679562159&lt;/DIV&gt;&lt;DIV class=""&gt;1679357166&lt;/DIV&gt;&lt;DIV class=""&gt;1679288835&lt;/DIV&gt;&lt;DIV class=""&gt;1679630490&lt;/DIV&gt;&lt;/TD&gt;&lt;TD width="138.234375px" height="113px"&gt;&lt;DIV class=""&gt;3/16/2023 18:52&lt;/DIV&gt;&lt;DIV class=""&gt;3/23/2023 9:02&lt;/DIV&gt;&lt;DIV class=""&gt;3/21/2023 0:06&lt;/DIV&gt;&lt;DIV class=""&gt;3/20/2023 5:07&lt;/DIV&gt;&lt;DIV class=""&gt;3/24/2023 4:01&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="214.703125px" height="47px"&gt;2&lt;/TD&gt;&lt;TD width="166.046875px" height="47px"&gt;2023-03-24 19:41:06&lt;/TD&gt;&lt;TD width="72.15625px" height="47px"&gt;ACCT_C&lt;/TD&gt;&lt;TD width="107px" height="47px"&gt;&lt;DIV class=""&gt;1679038288&lt;/DIV&gt;&lt;DIV class=""&gt;1679493828&lt;/DIV&gt;&lt;/TD&gt;&lt;TD width="138.234375px" height="47px"&gt;&lt;DIV class=""&gt;3/17/2023 7:31&lt;/DIV&gt;&lt;DIV class=""&gt;3/22/2023 14:03&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="214.703125px" height="135px"&gt;6&lt;/TD&gt;&lt;TD width="166.046875px" height="135px"&gt;2023-03-24 19:41:06&lt;/TD&gt;&lt;TD width="72.15625px" height="135px"&gt;ACCT_D&lt;/TD&gt;&lt;TD width="107px" height="135px"&gt;&lt;DIV class=""&gt;1679061065&lt;/DIV&gt;&lt;DIV class=""&gt;1679607713&lt;/DIV&gt;&lt;DIV class=""&gt;1679539382&lt;/DIV&gt;&lt;DIV class=""&gt;1679334389&lt;/DIV&gt;&lt;DIV class=""&gt;1679516605&lt;/DIV&gt;&lt;DIV class=""&gt;1679266058&lt;/DIV&gt;&lt;/TD&gt;&lt;TD width="138.234375px" height="135px"&gt;&lt;DIV class=""&gt;3/17/2023 13:51&lt;/DIV&gt;&lt;DIV class=""&gt;3/23/2023 21:41&lt;/DIV&gt;&lt;DIV class=""&gt;3/23/2023 2:43&lt;/DIV&gt;&lt;DIV class=""&gt;3/20/2023 17:46&lt;/DIV&gt;&lt;DIV class=""&gt;3/22/2023 20:23&lt;/DIV&gt;&lt;DIV class=""&gt;3/19/2023 22:47&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Sat, 25 Mar 2023 02:48:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-searches-where-initial-output-is-fed-to-lookup/m-p/636000#M220934</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-03-25T02:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: Merging two searches where initial output is fed to lookup table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-searches-where-initial-output-is-fed-to-lookup/m-p/636003#M220935</link>
      <description>&lt;P&gt;Awesome.&amp;nbsp; Thank you yuanliu.&amp;nbsp; &amp;nbsp; I appreciate it!&lt;/P&gt;</description>
      <pubDate>Sat, 25 Mar 2023 03:16:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-searches-where-initial-output-is-fed-to-lookup/m-p/636003#M220935</guid>
      <dc:creator>Sven1</dc:creator>
      <dc:date>2023-03-25T03:16:34Z</dc:date>
    </item>
  </channel>
</rss>

