<?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: comparing two fields from two different source types in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-fields-from-two-different-source-types/m-p/593513#M206575</link>
    <description>&lt;P&gt;Try to avoid using join where possible, it has a number of limitations) - and in this case it's possible&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(index=wineventlog sourcetype=Script:ListeningPorts dest="172.*.*.*" host="Computer1") OR (index=wineventlog sourcetype=WinHostMon host=Computer1)
| eval process_id=coalesce(process_id, ProcessId)
| stats values(dest) as dest values(Path) as Path values(process) as process by host process_id dest_port&lt;/LI-CODE&gt;&lt;P&gt;The final stats statement will depend on what you want your output to be. This will probably be faster than a join and avoid its limitations&lt;/P&gt;</description>
    <pubDate>Tue, 12 Apr 2022 23:03:42 GMT</pubDate>
    <dc:creator>bowesmana</dc:creator>
    <dc:date>2022-04-12T23:03:42Z</dc:date>
    <item>
      <title>How to compare two fields from two different source types?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-fields-from-two-different-source-types/m-p/593511#M206573</link>
      <description>&lt;P&gt;Hello everybody,&lt;/P&gt;
&lt;P&gt;This is actually my first post here so forgive me if I missed up or posted in the wrong section. I'm trying to compare/corelate two fields values from different source types and same index. Please find two sample of event I'm trying to work on.&lt;/P&gt;
&lt;P&gt;1) sample of the first source type&lt;/P&gt;
&lt;P&gt;index=wineventlog&lt;/P&gt;
&lt;P&gt;sourcetype=Script:ListeningPorts&lt;/P&gt;
&lt;P&gt;host=computer1&lt;/P&gt;
&lt;P&gt;dest=172.*.*.*&lt;/P&gt;
&lt;P&gt;dest_port=50000&lt;/P&gt;
&lt;P&gt;process_id=151111&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) sample of the second source type&lt;/P&gt;
&lt;P&gt;index=wineventlog&lt;/P&gt;
&lt;P&gt;sourcetype=WinHostMon&lt;/P&gt;
&lt;P&gt;source=process&lt;/P&gt;
&lt;P&gt;host=computer1&lt;/P&gt;
&lt;P&gt;Path=***.exe&lt;/P&gt;
&lt;P&gt;Process=**.exe&lt;/P&gt;
&lt;P&gt;ProcessId=151111&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to corelate&amp;nbsp;process_id and ProcessId fields to get the process field and make a count table. Sample output:&lt;/P&gt;
&lt;P&gt;process_id&amp;nbsp; &amp;nbsp;|&amp;nbsp; dest_port&amp;nbsp; |&amp;nbsp; count&amp;nbsp; &amp;nbsp;|&amp;nbsp; host&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|&amp;nbsp; Path&amp;nbsp; &amp;nbsp; &amp;nbsp; |&amp;nbsp; process&lt;/P&gt;
&lt;P&gt;151111&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;50000&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Computer1&amp;nbsp; &amp;nbsp; &amp;nbsp; **.exe&amp;nbsp; &amp;nbsp; &amp;nbsp; **.exe&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried this query but it didn't give me the right result&lt;/P&gt;
&lt;P&gt;index=wineventlog sourcetype=Script:ListeningPorts dest="172.*.*.*" host="Computer1"&lt;BR /&gt;| table host process_id dest, dest_port&lt;BR /&gt;| rename process_id as ProcessId&lt;/P&gt;
&lt;P&gt;| join type=inner host ProcessId&lt;BR /&gt;[search index=wineventlog sourcetype=WinHostMon&lt;BR /&gt;| table&amp;nbsp; ProcessId dest_port host Path process]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2022 15:06:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-fields-from-two-different-source-types/m-p/593511#M206573</guid>
      <dc:creator>ahmed_aladwani</dc:creator>
      <dc:date>2022-04-13T15:06:06Z</dc:date>
    </item>
    <item>
      <title>Re: comparing two fields from two different source types</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-fields-from-two-different-source-types/m-p/593513#M206575</link>
      <description>&lt;P&gt;Try to avoid using join where possible, it has a number of limitations) - and in this case it's possible&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(index=wineventlog sourcetype=Script:ListeningPorts dest="172.*.*.*" host="Computer1") OR (index=wineventlog sourcetype=WinHostMon host=Computer1)
| eval process_id=coalesce(process_id, ProcessId)
| stats values(dest) as dest values(Path) as Path values(process) as process by host process_id dest_port&lt;/LI-CODE&gt;&lt;P&gt;The final stats statement will depend on what you want your output to be. This will probably be faster than a join and avoid its limitations&lt;/P&gt;</description>
      <pubDate>Tue, 12 Apr 2022 23:03:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-fields-from-two-different-source-types/m-p/593513#M206575</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2022-04-12T23:03:42Z</dc:date>
    </item>
  </channel>
</rss>

