<?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: Join different events with common values in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Join-different-events-with-common-values/m-p/565761#M197137</link>
    <description>&lt;P&gt;Thanks! Good to know.&lt;/P&gt;</description>
    <pubDate>Fri, 03 Sep 2021 09:14:26 GMT</pubDate>
    <dc:creator>PickleRick</dc:creator>
    <dc:date>2021-09-03T09:14:26Z</dc:date>
    <item>
      <title>Join different events with common values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-different-events-with-common-values/m-p/565729#M197122</link>
      <description>&lt;P&gt;I've got some logs I need to join and put on the same row.&lt;/P&gt;&lt;P&gt;I've tried a few different ways and searched the community but I can't seem to get exactly what I need.&lt;/P&gt;&lt;P&gt;There's a log every 10 minutes for each host and each drive on said hosts (there are a lot of hosts and drives). Each log has 2 events for the same time and drive letter. One for free MB and one for percent.&amp;nbsp;&lt;SPAN class="t"&gt;&lt;SPAN&gt;Basically I need to join together each set of these two separate events based on the time, host and drive letter of the log. Is this possible?&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;base query:&lt;/P&gt;&lt;P&gt;index=perfmon host=host1 Category=&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="t"&gt;PERFORMANCE&lt;/SPAN&gt;&lt;SPAN&gt;" collection="WIN_PERF"&lt;/SPAN&gt;&amp;nbsp;object="LogicalDisk" counter="% Free Space" OR counter="Free Megabytes"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Drive letter is extracted as "instance"&lt;/P&gt;&lt;P&gt;percent and MB are both extracted as "Value"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Returns these logs:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="t"&gt;09/02/2021&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="t"&gt;21:48:49&lt;/SPAN&gt;&lt;SPAN&gt;","&lt;/SPAN&gt;&lt;SPAN class="t"&gt;host1&lt;/SPAN&gt;&lt;SPAN&gt;",&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="t"&gt;PERFORMANCE&lt;/SPAN&gt;&lt;SPAN&gt;","&lt;/SPAN&gt;&lt;SPAN class="t"&gt;WIN_PERF&lt;/SPAN&gt;&lt;SPAN&gt;","&lt;/SPAN&gt;&lt;SPAN class="t"&gt;LogicalDisk&lt;/SPAN&gt;&lt;SPAN&gt;","&lt;/SPAN&gt;&lt;SPAN class="t"&gt;Free&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="t"&gt;Megabytes&lt;/SPAN&gt;&lt;SPAN&gt;","d:&lt;/SPAN&gt;&lt;SPAN&gt;","&lt;/SPAN&gt;&lt;SPAN class="t"&gt;36092.00"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="t"&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;09/02/2021 21:48:49&lt;SPAN&gt;","host1&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;,"&lt;/SPAN&gt;PERFORMANCE&lt;SPAN&gt;","&lt;/SPAN&gt;WIN_PERF&lt;SPAN&gt;","&lt;/SPAN&gt;LogicalDisk&lt;SPAN&gt;","&lt;/SPAN&gt;% Free Space&lt;SPAN&gt;","d:&lt;/SPAN&gt;&lt;SPAN&gt;","&lt;/SPAN&gt;41.47"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="t"&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;09/02/2021 22:08:49&lt;SPAN&gt;","host1&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;,"&lt;/SPAN&gt;PERFORMANCE&lt;SPAN&gt;","&lt;/SPAN&gt;WIN_PERF&lt;SPAN&gt;","&lt;/SPAN&gt;LogicalDisk&lt;SPAN&gt;","&lt;/SPAN&gt;% Free Space&lt;SPAN&gt;","&lt;/SPAN&gt;C:&lt;SPAN&gt;","&lt;/SPAN&gt;19.30"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="t"&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;09/02/2021 22:08:49&lt;SPAN&gt;","host1&lt;/SPAN&gt;&lt;SPAN&gt;",&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;PERFORMANCE&lt;SPAN&gt;","&lt;/SPAN&gt;WIN_PERF&lt;SPAN&gt;","&lt;/SPAN&gt;LogicalDisk&lt;SPAN&gt;","&lt;/SPAN&gt;Free Megabytes&lt;SPAN&gt;","&lt;/SPAN&gt;C:&lt;SPAN&gt;","&lt;/SPAN&gt;19767.00"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="t"&gt;Desired output:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="t"&gt;Time&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Host&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Drive&amp;nbsp; &amp;nbsp; &amp;nbsp; FreePercent&amp;nbsp; &amp;nbsp; &amp;nbsp;FreeGB&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="t"&gt;&amp;nbsp;09/02/2021 21:48:49&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; host1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; d:&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 41.47&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 36092.0&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="t"&gt;09/02/2021 22:08:49&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;host1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C:&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 19.30&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;19767.00&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Sep 2021 02:47:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-different-events-with-common-values/m-p/565729#M197122</guid>
      <dc:creator>met</dc:creator>
      <dc:date>2021-09-03T02:47:58Z</dc:date>
    </item>
    <item>
      <title>Re: Join different events with common values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-different-events-with-common-values/m-p/565739#M197128</link>
      <description>&lt;P class="lia-align-left"&gt;Firstly, lose the unneeded fields, then do a selfjoin on host, drive and _time fields.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Sep 2021 04:44:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-different-events-with-common-values/m-p/565739#M197128</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-09-03T04:44:49Z</dc:date>
    </item>
    <item>
      <title>Re: Join different events with common values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-different-events-with-common-values/m-p/565751#M197132</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;here is one option to do it. I just use your "Returns these logs:" here as input, but you should replace that part with your original query with correct field names.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval _raw = "_time, host, type, stype, etype, item, Drive, value
09/02/2021 21:48:49,host1,PERFORMANCE,WIN_PERF,LogicalDisk,Free Megabytes,d:,36092.00
09/02/2021 21:48:49,host1,PERFORMANCE,WIN_PERF,LogicalDisk,% Free Space,d:,41.47
09/02/2021 22:08:49,host1,PERFORMANCE,WIN_PERF,LogicalDisk,% Free Space,C:,19.30
09/02/2021 22:08:49,host1,PERFORMANCE,WIN_PERF,LogicalDisk,Free Megabytes,C:,19767.00"
| multikv forceheader=1
``` Above generates sample data ```
| eval FM = if (item = "Free Megabytes", value,null()), FS = if (item="% Free Space", value,null())
| stats  values(FM) as FreeGB values(FS) as FreePercent by _time, host Drive
| table _time host Drive FreePercent FreeGB&lt;/LI-CODE&gt;&lt;P&gt;r. Ismo&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Sep 2021 07:18:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-different-events-with-common-values/m-p/565751#M197132</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2021-09-03T07:18:38Z</dc:date>
    </item>
    <item>
      <title>Re: Join different events with common values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-different-events-with-common-values/m-p/565754#M197134</link>
      <description>&lt;P&gt;Yep, values() is another way to do it. Thought about it myself.&lt;/P&gt;&lt;P&gt;I'm wondering however which way - this or selfjoin is more effective in terms of CPU/memory usage and which has less limitations.&lt;/P&gt;&lt;P&gt;The selfjoin method is - IMHO - more obvious to construct (especially for a person with RDBMS background) but the results of selfjoin can be a bit confusing sometimes (see the example for selfjoin on splunk docs page).&lt;/P&gt;</description>
      <pubDate>Fri, 03 Sep 2021 07:58:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-different-events-with-common-values/m-p/565754#M197134</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-09-03T07:58:37Z</dc:date>
    </item>
    <item>
      <title>Re: Join different events with common values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-different-events-with-common-values/m-p/565759#M197136</link>
      <description>&lt;P&gt;Almost every time stats is better than join. Of course there could be situation where it's another way. Best way to check it is just create both queries and then check with Job inspector which one is better. There are many presentations about Job Inspector and replacing join with stats.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A href="https://conf.splunk.com/files/2020/slides/TRU1143C.pdf" target="_blank"&gt;https://conf.splunk.com/files/2020/slides/TRU1143C.pdf&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://conf.splunk.com/files/2019/slides/FNC2751.pdf" target="_blank"&gt;https://conf.splunk.com/files/2019/slides/FNC2751.pdf&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://conf.splunk.com/files/2020/slides/TRU1761C.pdf" target="_blank"&gt;https://conf.splunk.com/files/2020/slides/TRU1761C.pdf&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Above is couple of those, but you could found easily more.&lt;/P&gt;&lt;P&gt;r. Ismo&lt;/P&gt;</description>
      <pubDate>Fri, 03 Sep 2021 08:47:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-different-events-with-common-values/m-p/565759#M197136</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2021-09-03T08:47:53Z</dc:date>
    </item>
    <item>
      <title>Re: Join different events with common values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-different-events-with-common-values/m-p/565761#M197137</link>
      <description>&lt;P&gt;Thanks! Good to know.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Sep 2021 09:14:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-different-events-with-common-values/m-p/565761#M197137</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-09-03T09:14:26Z</dc:date>
    </item>
    <item>
      <title>Re: Join different events with common values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-different-events-with-common-values/m-p/566989#M197588</link>
      <description>&lt;P&gt;Thanks for all the help guys.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Sep 2021 15:36:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-different-events-with-common-values/m-p/566989#M197588</guid>
      <dc:creator>met</dc:creator>
      <dc:date>2021-09-14T15:36:36Z</dc:date>
    </item>
  </channel>
</rss>

