<?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: Use results from search as input to a lookup in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Use-results-from-search-as-input-to-a-lookup/m-p/86483#M182142</link>
    <description>&lt;P&gt;This doesn't work. Just to be clear, I want to find the top 100 called numbers first, and then use those called numbers to perform the client lookup. I edited my original post to include the format of the client_info.csv file and attempted to make the question a little more understandable . Let me know if you need anything else that can help. Thanks!&lt;/P&gt;</description>
    <pubDate>Mon, 08 Apr 2013 15:02:06 GMT</pubDate>
    <dc:creator>tnkoehn</dc:creator>
    <dc:date>2013-04-08T15:02:06Z</dc:date>
    <item>
      <title>Use results from search as input to a lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-results-from-search-as-input-to-a-lookup/m-p/86481#M182140</link>
      <description>&lt;P&gt;I have an initial search that will find the top 100 Called_Numbers by the number of calls they are taking. A simplified version is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=Sonus sourcetype=Sonus earliest=-1h (START OR STOP)
|stats count(eval(CDR_Type=="START")) as starts, count(eval(CDR_Type=="STOP")) as stops by Called_Number
|eval calls=starts-stops
|sort -calls
|head 100
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I then want to take those 100 Called_Numbers and perform a lookup to find client name and application. The lookup looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|lookup client_info.csv apn as Called_Number OUTPUT client as Client_Name, program as App_Name
|table Called_Number Client_Name App_Name calls
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And the client_info.csv file contains 100's of thousands of records and looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;apn,client,program
1420102,Client A,Widgets
2004029,Client B,Web
2007172,Client C,Mobile
2007226,Client D,Customer Service
2910509,Client E,Maintenance
.
.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;After the search and the lookup, the output should be:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Called_Number     Client_Name     App_Name     calls
1234567           ABC Client      ABC App      159
2345678           XYZ Client      XYZ App      231
.
.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How do I do that in one search? I've tried subsearches and looked thru the Splunkbase for days. Can't seem to figure it out. Thanks for any help!&lt;/P&gt;</description>
      <pubDate>Fri, 05 Apr 2013 21:19:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-results-from-search-as-input-to-a-lookup/m-p/86481#M182140</guid>
      <dc:creator>tnkoehn</dc:creator>
      <dc:date>2013-04-05T21:19:21Z</dc:date>
    </item>
    <item>
      <title>Re: Use results from search as input to a lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-results-from-search-as-input-to-a-lookup/m-p/86482#M182141</link>
      <description>&lt;P&gt;try this&lt;BR /&gt;
index=Sonus sourcetype=Sonus earliest=-1h (START OR STOP) [|inputlookup client_info.csv |fields apn , client,program|rename apn as Called_Number,client as Client_Name, program as App_Name&lt;BR /&gt;
]|stats count(eval(CDR_Type=="START")) as starts, count(eval(CDR_Type=="STOP")) as stops by Called_Number&lt;BR /&gt;
|eval calls=starts-stops&lt;BR /&gt;
|sort -calls&lt;BR /&gt;
|head 100&lt;/P&gt;

&lt;P&gt;-Kamal Bisht&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 13:41:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-results-from-search-as-input-to-a-lookup/m-p/86482#M182141</guid>
      <dc:creator>kml_uvce</dc:creator>
      <dc:date>2020-09-28T13:41:05Z</dc:date>
    </item>
    <item>
      <title>Re: Use results from search as input to a lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-results-from-search-as-input-to-a-lookup/m-p/86483#M182142</link>
      <description>&lt;P&gt;This doesn't work. Just to be clear, I want to find the top 100 called numbers first, and then use those called numbers to perform the client lookup. I edited my original post to include the format of the client_info.csv file and attempted to make the question a little more understandable . Let me know if you need anything else that can help. Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 08 Apr 2013 15:02:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-results-from-search-as-input-to-a-lookup/m-p/86483#M182142</guid>
      <dc:creator>tnkoehn</dc:creator>
      <dc:date>2013-04-08T15:02:06Z</dc:date>
    </item>
    <item>
      <title>Re: Use results from search as input to a lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-results-from-search-as-input-to-a-lookup/m-p/86484#M182143</link>
      <description>&lt;P&gt;I think I may have figured this out (because it works!), although it may not be the best way. Let me know what you think:&lt;/P&gt;

&lt;P&gt;index=Sonus sourcetype=Sonus earliest=-1h (START OR STOP)&lt;BR /&gt;
|stats count(eval(CDR_Type=="START")) as starts, count(eval(CDR_Type=="STOP")) as stops by Called_Number&lt;BR /&gt;
|eval calls=starts-stops&lt;BR /&gt;
|sort -calls&lt;BR /&gt;
|head 100&lt;BR /&gt;
|eval apn=mvappend(Called_Number,calls)&lt;BR /&gt;
|lookup client_info.csv apn as apn OUTPUT apn as Called_Number, client as Client_Name, program as App_Name&lt;BR /&gt;
|table Called_Number Client_Name App_Name calls&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 13:41:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-results-from-search-as-input-to-a-lookup/m-p/86484#M182143</guid>
      <dc:creator>tnkoehn</dc:creator>
      <dc:date>2020-09-28T13:41:43Z</dc:date>
    </item>
    <item>
      <title>Re: Use results from search as input to a lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-results-from-search-as-input-to-a-lookup/m-p/86485#M182144</link>
      <description>&lt;P&gt;this is perfect...&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2013 00:39:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-results-from-search-as-input-to-a-lookup/m-p/86485#M182144</guid>
      <dc:creator>kml_uvce</dc:creator>
      <dc:date>2013-04-09T00:39:50Z</dc:date>
    </item>
    <item>
      <title>Re: Use results from search as input to a lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-results-from-search-as-input-to-a-lookup/m-p/86486#M182145</link>
      <description>&lt;P&gt;Here's the answer. Thanks for the help and confirmation.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=Sonus sourcetype=Sonus earliest=-1h (START OR STOP)
|stats count(eval(CDR_Type=="START")) as starts, count(eval(CDR_Type=="STOP")) as stops by Called_Number
|eval calls=starts-stops
|sort -calls
|head 100
|eval apn=mvappend(Called_Number,calls)
|lookup client_info.csv apn OUTPUT apn as Called_Number, client as Client_Name, program as App_Name
|table Called_Number Client_Name App_Name calls
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Apr 2013 15:09:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-results-from-search-as-input-to-a-lookup/m-p/86486#M182145</guid>
      <dc:creator>tnkoehn</dc:creator>
      <dc:date>2013-04-09T15:09:26Z</dc:date>
    </item>
  </channel>
</rss>

