<?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 How do I search 2 source types with matching data and display the values in a table? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-search-2-source-types-with-matching-data-and-display/m-p/328817#M97877</link>
    <description>&lt;P&gt;Greetings, I have 2 sourcetypes that I am matching PID. How do I table the remaining values that corresponds to the PIDs&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;sourcetype=Windows:Netstat&lt;BR /&gt;
    "Protocol":  "TCP",&lt;BR /&gt;
    "LocalAddressIP":  "127.0.0.1",&lt;BR /&gt;
    "LocalAddressPort":  "65365",&lt;BR /&gt;
    "ForeignAddressIP":  "127.0.0.1",&lt;BR /&gt;
    "ForeignAddressPort":  "65364",&lt;BR /&gt;
    "State":  "ESTABLISHED",&lt;BR /&gt;
    "PID":  "1608"&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;sourcetype=Windows:Process&lt;BR /&gt;
"ProcessName":  "firefox",&lt;BR /&gt;
"Id":  1608,&lt;BR /&gt;
"Path":  "D:\Program Files\Mozilla Firefox\firefox.exe",&lt;BR /&gt;
"CPU":  241.7079494,&lt;BR /&gt;
"UserName":  "Domain\UserName"&lt;/EM&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=windows sourcetype="Windows:NetStat" OR sourcetype="Windows:Process"
| stats values(PID) as NetstatPID, values(Id) as ProcessId
| mvexpand NetstatPID
| mvexpand ProcessId
| where ProcessId=NetstatPID
| table ProcessId, NetstatPID
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I can match the ProcessId with NetstatPID, but i would like to table: &lt;BR /&gt;
ForeignAddressIP&lt;BR /&gt;
ForeignAddressPort&lt;BR /&gt;
ProcessName&lt;BR /&gt;
Path&lt;BR /&gt;
UserName&lt;/P&gt;

&lt;P&gt;Thanks in Advance&lt;/P&gt;</description>
    <pubDate>Tue, 06 Jun 2017 21:11:53 GMT</pubDate>
    <dc:creator>jscraig2006</dc:creator>
    <dc:date>2017-06-06T21:11:53Z</dc:date>
    <item>
      <title>How do I search 2 source types with matching data and display the values in a table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-search-2-source-types-with-matching-data-and-display/m-p/328817#M97877</link>
      <description>&lt;P&gt;Greetings, I have 2 sourcetypes that I am matching PID. How do I table the remaining values that corresponds to the PIDs&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;sourcetype=Windows:Netstat&lt;BR /&gt;
    "Protocol":  "TCP",&lt;BR /&gt;
    "LocalAddressIP":  "127.0.0.1",&lt;BR /&gt;
    "LocalAddressPort":  "65365",&lt;BR /&gt;
    "ForeignAddressIP":  "127.0.0.1",&lt;BR /&gt;
    "ForeignAddressPort":  "65364",&lt;BR /&gt;
    "State":  "ESTABLISHED",&lt;BR /&gt;
    "PID":  "1608"&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;sourcetype=Windows:Process&lt;BR /&gt;
"ProcessName":  "firefox",&lt;BR /&gt;
"Id":  1608,&lt;BR /&gt;
"Path":  "D:\Program Files\Mozilla Firefox\firefox.exe",&lt;BR /&gt;
"CPU":  241.7079494,&lt;BR /&gt;
"UserName":  "Domain\UserName"&lt;/EM&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=windows sourcetype="Windows:NetStat" OR sourcetype="Windows:Process"
| stats values(PID) as NetstatPID, values(Id) as ProcessId
| mvexpand NetstatPID
| mvexpand ProcessId
| where ProcessId=NetstatPID
| table ProcessId, NetstatPID
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I can match the ProcessId with NetstatPID, but i would like to table: &lt;BR /&gt;
ForeignAddressIP&lt;BR /&gt;
ForeignAddressPort&lt;BR /&gt;
ProcessName&lt;BR /&gt;
Path&lt;BR /&gt;
UserName&lt;/P&gt;

&lt;P&gt;Thanks in Advance&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jun 2017 21:11:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-search-2-source-types-with-matching-data-and-display/m-p/328817#M97877</guid>
      <dc:creator>jscraig2006</dc:creator>
      <dc:date>2017-06-06T21:11:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do I search 2 source types with matching data and display the values in a table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-search-2-source-types-with-matching-data-and-display/m-p/328818#M97878</link>
      <description>&lt;P&gt;That's not doing what you think it is. It's just throwing all the values in a pot, then pulling out the ones that match, but they aren't still connected to anything.  You need to connect the Process records to the NetStat records by their matching values.  &lt;/P&gt;

&lt;P&gt;Start with this --&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=windows sourcetype="Windows:NetStat" OR sourcetype="Windows:Process"
| eval matchID=coalesce(ProcessId,NetstatPID)
| stats values(*) as * by matchID
| table matchID ...all your other fields you care about...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Technically, you could have used ProcessId OR NetstatPID instead of creating a new field, but it's clearer what is going on here this way.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jun 2017 22:27:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-search-2-source-types-with-matching-data-and-display/m-p/328818#M97878</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-06-06T22:27:58Z</dc:date>
    </item>
    <item>
      <title>Re: How do I search 2 source types with matching data and display the values in a table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-search-2-source-types-with-matching-data-and-display/m-p/328819#M97879</link>
      <description>&lt;P&gt;Excellent, that is exactly what I needed. Works like a champ! Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jun 2017 23:54:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-search-2-source-types-with-matching-data-and-display/m-p/328819#M97879</guid>
      <dc:creator>jscraig2006</dc:creator>
      <dc:date>2017-06-06T23:54:02Z</dc:date>
    </item>
    <item>
      <title>Re: How do I search 2 source types with matching data and display the values in a table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-search-2-source-types-with-matching-data-and-display/m-p/328820#M97880</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;index=windows sourcetype="Windows:NetStat" OR sourcetype="Windows:Process"
 | lookup dnslookup clientip as ForeignAddressIP OUTPUT clienthost as d_host
 | eval matchID=coalesce(PID,Id)
 | stats values(*) as * by matchID
 | table host, matchID, ProcessName, Path, d_host,State, UserName
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks to DalJeanis&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jun 2017 23:58:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-search-2-source-types-with-matching-data-and-display/m-p/328820#M97880</guid>
      <dc:creator>jscraig2006</dc:creator>
      <dc:date>2017-06-06T23:58:39Z</dc:date>
    </item>
    <item>
      <title>Re: How do I search 2 source types with matching data and display the values in a table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-search-2-source-types-with-matching-data-and-display/m-p/328821#M97881</link>
      <description>&lt;P&gt;to better understand the coalesce command - from splunk blogs&lt;/P&gt;

&lt;P&gt;Sample data:&lt;BR /&gt;
Thu Mar 6 11:33:49 EST 2014 src_ip=1.1.1.1&lt;BR /&gt;
Thu Mar 6 11:33:45 EST 2014 sourceip=8.1.2.3&lt;BR /&gt;
Thu Mar 6 11:33:48 EST 2014 source_ip=1.1.1.0&lt;BR /&gt;
Thu Mar 6 11:33:47 EST 2014 sip=1.1.1.199&lt;BR /&gt;
Thu Mar 6 11:33:46 EST 2014 ip=&lt;BR /&gt;
Thu Mar 6 11:33:46 EST 2014 ip=22.22.22.22&lt;/P&gt;

&lt;P&gt;Here we are going to “coalesce” all the desperate keys for source ip and put them under one common name src_ip for further statistics.&lt;BR /&gt;
For this example, copy and paste the above data into a file called firewall.log. Then use the oneshot command to index the file:&lt;BR /&gt;
./splunk add oneshot “/your/log/file/firewall.log” –sourcetype firewall&lt;BR /&gt;
&lt;PRE&gt;sourcetype=firewall |eval src_ip = coalesce(src_ip,sourceip,source_ip,sip,ip)&lt;/PRE&gt;&lt;/P&gt;

&lt;P&gt;&lt;IMG src="https://www.splunk.com/content/dam/splunk-blogs/images/2014/03/FirstBlogUpload.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="https://www.splunk.com/blog/2014/03/21/search-command-coalesce.html" target="_blank"&gt;https://www.splunk.com/blog/2014/03/21/search-command-coalesce.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:19:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-search-2-source-types-with-matching-data-and-display/m-p/328821#M97881</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2020-09-29T14:19:23Z</dc:date>
    </item>
    <item>
      <title>Re: How do I search 2 source types with matching data and display the values in a table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-search-2-source-types-with-matching-data-and-display/m-p/622578#M216435</link>
      <description>&lt;P&gt;Hi, I have similar usecase ,But ProcessId is present both the source types.But i need to match the data &lt;STRONG&gt;ProcessId&lt;/STRONG&gt; of &lt;STRONG&gt;source1&lt;/STRONG&gt; and &lt;STRONG&gt;NetStatPID&lt;/STRONG&gt; of &lt;STRONG&gt;source2&lt;/STRONG&gt;. Since field name(ProcessId) is common in both the sources ,it's not working fine.&lt;/P&gt;&lt;P&gt;Please suggest.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2022 09:04:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-search-2-source-types-with-matching-data-and-display/m-p/622578#M216435</guid>
      <dc:creator>M28</dc:creator>
      <dc:date>2022-11-30T09:04:24Z</dc:date>
    </item>
  </channel>
</rss>

