Could someone with more experience with SPL than me please take a look and help me nail this down? 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: filter 'account_lookup.csv' on one account name 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 count the number of matching rows and return that as "Records updated in the last 7 days" (my search)
| inputlookup account_lookup.csv
| search account=ACCT_A
| eval Date = mvmap(date, strptime(date, "%Y-%m-%d")), latest = max(date)
| where latest > relative_time(now(),"-7d@d")
| stats values(account) AS account count as "Records updated in the last 7 days" The output will have at least one row, and potentially several rows. An example final output is: Account Records updated in the last 7 days ACCT_A 11 ACCT_B 8 ACCT_C 3 ACCT_D 9 Or, based on the results of the first part of the search, the output may be: account Records updated in the last 7 days ACCT_A 11 I have pasted a sample ‘account_lookup.csv’ below The results of the second part of the above search against ‘account_lookup.csv’ are what is listed above. 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. 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. Many thanks to yuanliu for looking at this earlier. 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. Now, I have had a chance again to work to get this nailed down and appreciate any guidance. account date date2 ACCT_D 1679061065 3/17/2023 13:51 ACCT_C 1679038288 3/17/2023 7:31 ACCT_A 1679015511 3/17/2023 1:11 ACCT_B 1678992734 3/16/2023 18:52 ACCT_D 1679607713 3/23/2023 21:41 ACCT_A 1679584936 3/23/2023 15:22 ACCT_B 1679562159 3/23/2023 9:02 ACCT_D 1679539382 3/23/2023 2:43 ACCT_A 1679379943 3/21/2023 6:25 ACCT_B 1679357166 3/21/2023 0:06 ACCT_D 1679334389 3/20/2023 17:46 ACCT_A 1679311612 3/20/2023 11:26 ACCT_B 1679288835 3/20/2023 5:07 ACCT_D 1679516605 3/22/2023 20:23 ACCT_C 1679493828 3/22/2023 14:03 ACCT_A 1679698821 3/24/2023 23:00 ACCT_A 1679676044 3/24/2023 16:40 ACCT_A 1679653267 3/24/2023 10:21 ACCT_B 1679630490 3/24/2023 4:01 ACCT_D 1679266058 3/19/2023 22:47 ACCT_A 1679243281 3/19/2023 16:28
... View more