<?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: How to pass a field value from one search  to another search? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-a-field-value-from-one-search-to-another-search/m-p/527005#M148750</link>
    <description>Hi&lt;BR /&gt;another option is first do a query for getting those IP:s and then pipe it to map which do second query for each IP.&lt;BR /&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.5/SearchReference/Map" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.5/SearchReference/Map&lt;/A&gt;&lt;BR /&gt;r. Ismo</description>
    <pubDate>Thu, 29 Oct 2020 06:44:49 GMT</pubDate>
    <dc:creator>isoutamo</dc:creator>
    <dc:date>2020-10-29T06:44:49Z</dc:date>
    <item>
      <title>How to pass a field value from one search  to another search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-a-field-value-from-one-search-to-another-search/m-p/526969#M148733</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I'm extremely new to Splunk and have been tasked to do the following:&lt;/P&gt;&lt;P&gt;Perform a query against one host (Server123) to retrieve MAC addresses then preform a query on a second&amp;nbsp; host (Server456) using the MAC addresses from the first query. I know all the MAC address from query 1 will not be found, but for the MAC address that are found, the MAC address, (which field name is different), the User Name, Network Device Name, and the IP Address would be put into a table and used as a report.&lt;/P&gt;&lt;P&gt;I run the query and get the following error: ERROR in 'stats' command: The argument 'Calling_Station_ID=(Mac addr.) When I run the 1st query by its self I see that the MAC addr. in error is the 1st MAC addr. in the 1st row.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;P&gt;index=* host="Server456" | stats count by Calling_Station_ID, User_Name, DeviceName, IP [ search index=* host="Server123" "no free leases" | eval MAC address=suibstr(_raw,52,18) | stats count by MAC address | eval MAC address=replace (MAC address," : ", " - ") | fields MAC address | return Calling_Station_ID=MAC address MAC Address $Mac_address } | table Calling_Station_ID, User_Name, DeviceName, IP |&lt;/P&gt;&lt;P&gt;Results:&lt;/P&gt;&lt;P&gt;I'm looking for the query to use the MAC from the 1st query to search the 2nd query and if there's a match return the MAC (under the Calling_Station_ID field), the User_Name, DeviceName and IP&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2020 22:53:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-a-field-value-from-one-search-to-another-search/m-p/526969#M148733</guid>
      <dc:creator>hillsw19</dc:creator>
      <dc:date>2020-10-28T22:53:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass a field value from one search  to another search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-a-field-value-from-one-search-to-another-search/m-p/526982#M148739</link>
      <description>&lt;LI-CODE lang="markup"&gt;Your Search Query - 
index=* host="Server456" 
| stats count by Calling_Station_ID, User_Name, DeviceName, IP 
    [ search index=* host="Server123" "no free leases" 
    | eval MAC address=suibstr(_raw,52,18) 
    | stats count by MAC address 
    | eval MAC address=replace (MAC address," : ", " - ") 
    | fields MAC address 
    | return Calling_Station_ID=MAC address MAC Address $Mac_address } 
    | table Calling_Station_ID, User_Name, DeviceName, IP 
    |

Edited - version 1:
index=* host="Server456" 
    [ search index=* host="Server123" "no free leases" 
    | eval MAC address=suibstr(_raw,52,18) 
    | stats count by MAC address 
    | eval MAC address=replace (MAC address," : ", " - ") 
    | fields MAC address 
    | table Calling_Station_ID=MAC address MAC Address $Mac_address ] 
| stats count by Calling_Station_ID, User_Name, DeviceName, IP 
| table Calling_Station_ID, User_Name, DeviceName, IP&lt;/LI-CODE&gt;&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/228207"&gt;@hillsw19&lt;/a&gt;&amp;nbsp;few basic editings were needed on your query, i have edited that. Pls check this. i have not understood your problem completely(so i dont know subsearch needed or not), so lets troubleshoot, one step at a time, pls run this above edited query and let us know the output, thanks.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 01:57:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-a-field-value-from-one-search-to-another-search/m-p/526982#M148739</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2020-10-29T01:57:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass a field value from one search  to another search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-a-field-value-from-one-search-to-another-search/m-p/527005#M148750</link>
      <description>Hi&lt;BR /&gt;another option is first do a query for getting those IP:s and then pipe it to map which do second query for each IP.&lt;BR /&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.5/SearchReference/Map" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.5/SearchReference/Map&lt;/A&gt;&lt;BR /&gt;r. Ismo</description>
      <pubDate>Thu, 29 Oct 2020 06:44:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-a-field-value-from-one-search-to-another-search/m-p/527005#M148750</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2020-10-29T06:44:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass a field value from one search  to another search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-a-field-value-from-one-search-to-another-search/m-p/527121#M148787</link>
      <description>&lt;P&gt;Appreciating your assistance&amp;nbsp;&lt;SPAN class=""&gt;&lt;A href="https://community.splunk.com/t5/user/viewprofilepage/user-id/80737" target="_self"&gt;inventsekar&lt;/A&gt;&amp;nbsp;, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;The script is now running with no errors, but am not sure if it's pulling the MAC addresses from the 1st query, there's one known MAC in the 1st query that's not coming out in the results. Tried to do a little troubleshooting, but can't get the known MAC to show in results.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;BR /&gt;index=* host="Server456"&lt;BR /&gt;[ search index=* host="Server123" "no free leases"&lt;BR /&gt;| eval MAC address=substr(_raw,52,18)&amp;nbsp;&lt;BR /&gt;| stats count by MAC address&lt;BR /&gt;| eval MAC address=replace (MAC address," : ", " - ")&lt;BR /&gt;| fields MAC address&lt;BR /&gt;| return Calling_Station_ID=MAC address MAC Address $Mac_address ]&amp;nbsp;&lt;BR /&gt;| stats count by Calling_Station_ID, User_Name, DeviceName, IP&lt;BR /&gt;| table Calling_Station_ID, User_Name, DeviceName, IP&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 15:40:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-a-field-value-from-one-search-to-another-search/m-p/527121#M148787</guid>
      <dc:creator>hillsw19</dc:creator>
      <dc:date>2020-10-29T15:40:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass a field value from one search  to another search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-a-field-value-from-one-search-to-another-search/m-p/527123#M148789</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/214410"&gt;@isoutamo&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Thanks for your response and your assistance - appreciated!&lt;/P&gt;&lt;P&gt;Not familiar with the map command/feature, currently looking at the link you provided to see what it's all about.&lt;/P&gt;&lt;P&gt;Thanks again for the point in the right direction!&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 15:44:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-a-field-value-from-one-search-to-another-search/m-p/527123#M148789</guid>
      <dc:creator>hillsw19</dc:creator>
      <dc:date>2020-10-29T15:44:13Z</dc:date>
    </item>
  </channel>
</rss>

