<?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 Subsearch Question in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-Question/m-p/152679#M42767</link>
    <description>&lt;P&gt;I am trying to create a report that includes failed log on attempts from our windows security logs with the originating host name from the network_dhcp log files.  I can pull the failed log ons using this search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=os_windows source="WinEventLog:Security" EventCode=4771 NOT user="*$" Failure_Code="0x18" | rex mode=sed field=src_ip "s/::ffff://" | stats count(user) as Attempts dc(src_ip) as IPs values(src_ip) as "IP Addresses" by user | where Attempts &amp;gt; 2 | table user Attempts IPs "IP Addresses" | sort -Attempts
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This returns:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;user    Attempts   IPs   IP Address
xxx        5        2    192.168.1.10
                         192.168.1.11
yyy        4        3    192.168.1.20
                         192.168.1.21
                         192.168.1.31
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I would like to then lookup by IP Address in the dhcp logs to get the hostname of the offending workstation.  This search works for this purpose:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=network_dhcp dest_ip="192.168.1.102" | table nt_host dest_ip
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Ideally the finished search would look like this...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;user    Attempts   IPs   IP Address     nt_host
xxx        5        2    192.168.1.10   wkstation01
                         192.168.1.11   wkstation02
yyy        4        3    192.168.1.20   wkstation03
                         192.168.1.21   wkstation04
                         192.168.1.31   wkstation05
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have this subsearch but it does not return any results.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=network_dhcp [search index=os_windows source="WinEventLog:Security" EventCode=4771 NOT user="*$" Failure_Code="0x18" | rex mode=sed field=src_ip "s/::ffff://"  | fields + src_ip] | table nt_host dest_ip
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks for any help!&lt;/P&gt;

&lt;P&gt;Mike&lt;/P&gt;</description>
    <pubDate>Mon, 05 May 2014 15:47:58 GMT</pubDate>
    <dc:creator>lehrfeld</dc:creator>
    <dc:date>2014-05-05T15:47:58Z</dc:date>
    <item>
      <title>Subsearch Question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-Question/m-p/152679#M42767</link>
      <description>&lt;P&gt;I am trying to create a report that includes failed log on attempts from our windows security logs with the originating host name from the network_dhcp log files.  I can pull the failed log ons using this search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=os_windows source="WinEventLog:Security" EventCode=4771 NOT user="*$" Failure_Code="0x18" | rex mode=sed field=src_ip "s/::ffff://" | stats count(user) as Attempts dc(src_ip) as IPs values(src_ip) as "IP Addresses" by user | where Attempts &amp;gt; 2 | table user Attempts IPs "IP Addresses" | sort -Attempts
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This returns:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;user    Attempts   IPs   IP Address
xxx        5        2    192.168.1.10
                         192.168.1.11
yyy        4        3    192.168.1.20
                         192.168.1.21
                         192.168.1.31
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I would like to then lookup by IP Address in the dhcp logs to get the hostname of the offending workstation.  This search works for this purpose:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=network_dhcp dest_ip="192.168.1.102" | table nt_host dest_ip
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Ideally the finished search would look like this...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;user    Attempts   IPs   IP Address     nt_host
xxx        5        2    192.168.1.10   wkstation01
                         192.168.1.11   wkstation02
yyy        4        3    192.168.1.20   wkstation03
                         192.168.1.21   wkstation04
                         192.168.1.31   wkstation05
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have this subsearch but it does not return any results.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=network_dhcp [search index=os_windows source="WinEventLog:Security" EventCode=4771 NOT user="*$" Failure_Code="0x18" | rex mode=sed field=src_ip "s/::ffff://"  | fields + src_ip] | table nt_host dest_ip
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks for any help!&lt;/P&gt;

&lt;P&gt;Mike&lt;/P&gt;</description>
      <pubDate>Mon, 05 May 2014 15:47:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-Question/m-p/152679#M42767</guid>
      <dc:creator>lehrfeld</dc:creator>
      <dc:date>2014-05-05T15:47:58Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch Question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-Question/m-p/152680#M42768</link>
      <description>&lt;P&gt;Perhaps something like this will do the job:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search index=os_windows source="WinEventLog:Security" EventCode=4771 NOT user="*$" Failure_Code="0x18" | rex mode=sed field=src_ip "s/::ffff://" | rename src_ip as dest_ip | join dest_ip [search index=network_dhcp] | stats count(user) as Attempts dc(src_ip) as IPs values(dest_ip) as "IP Addresses" by user | where Attempts &amp;gt; 2 | table user Attempts IPs "IP Addresses" nt_host | sort -Attempts
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 May 2014 16:45:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-Question/m-p/152680#M42768</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2014-05-05T16:45:59Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch Question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-Question/m-p/152681#M42769</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=os_windows source="WinEventLog:Security" EventCode=4771 NOT user="*$" Failure_Code="0x18" | rex mode=sed field=src_ip "s/::ffff://" | stats count(user) as Attempts dc(src_ip) as IPs by src_ip,user | where Attempts &amp;gt; 2 | table user Attempts IPs src_ip | sort -Attempts | join src_ip [search index=network_dhcp  | stats count by nt_host dest_ip | rename dest_ip as src_ip  | table nt_host src_ip] | stats list(src_ip) as "IP Addresses" list(nt_host) as "Host Names" by user,Attempts,IPs 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 May 2014 17:34:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-Question/m-p/152681#M42769</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-05-05T17:34:32Z</dc:date>
    </item>
  </channel>
</rss>

