<?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: Combining fields from 2 sourcetypes in a stats block in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Combining-fields-from-2-sourcetypes-in-a-stats-block/m-p/409532#M118154</link>
    <description>&lt;P&gt;Of course! that is the point! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;The InstallDate is not on sourcetype 2.&lt;/P&gt;

&lt;P&gt;Said that, I need my calculations based on the InstallDate values. &lt;/P&gt;

&lt;P&gt;How can I do that?&lt;/P&gt;

&lt;P&gt;Maybe in this case I should use the JOIN with HOST field that is common to both?&lt;/P&gt;</description>
    <pubDate>Fri, 18 Jan 2019 13:43:08 GMT</pubDate>
    <dc:creator>akelbr</dc:creator>
    <dc:date>2019-01-18T13:43:08Z</dc:date>
    <item>
      <title>Combining fields from 2 sourcetypes in a stats block</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-fields-from-2-sourcetypes-in-a-stats-block/m-p/409529#M118151</link>
      <description>&lt;P&gt;All,&lt;BR /&gt;
my query below just returns the values from the first sourcetype (first 3 lines in |stats). The fields from the second sourcetype seems that are not being loaded.&lt;BR /&gt;
 Any clue? I`m sure is something really simple but I can not see it:&lt;/P&gt;

&lt;P&gt;index=uberagent (sourcetype=uberAgent:Application:SoftwareUpdateInventory host=*) OR sourcetype=uberAgent:System:SystemPerformanceSummary2 &lt;BR /&gt;
| stats&lt;BR /&gt;
    latest(DisplayName) as "Patch Name"&lt;BR /&gt;
    latest(ProductName) as "Product name"&lt;BR /&gt;
    values(State) as State&lt;BR /&gt;
    avg(CPUUsagePercent) as "CPU" &lt;BR /&gt;
    avg(RAMUsagePercent) as "RAM" &lt;BR /&gt;
    avg(IOPercentDiskTime) as "IO" &lt;BR /&gt;
    by host, InstallDate &lt;BR /&gt;
| rename host as "Machine Name" &lt;BR /&gt;
| mvexpand InstallDate &lt;BR /&gt;
| mvexpand host &lt;BR /&gt;
| eval "% of CPU" = round((CPU),2) &lt;BR /&gt;
| eval "% of RAM" = round((CPU),2) &lt;BR /&gt;
| eval "% of IO" = round((CPU),2) &lt;BR /&gt;
| eval sortfield=lower(InstallDate) &lt;BR /&gt;
| table&lt;BR /&gt;
    InstallDate&lt;BR /&gt;
    "Machine Name"&lt;BR /&gt;
    "Patch Name"&lt;BR /&gt;
    "Product name"&lt;BR /&gt;
    State&lt;BR /&gt;
    "% of CPU"&lt;BR /&gt;
    "% of RAM"&lt;BR /&gt;
    "% of IO"&lt;BR /&gt;
    sortfield &lt;BR /&gt;
| sort limit=0 sortfield &lt;BR /&gt;
| fields - sortfield&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jan 2019 13:28:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-fields-from-2-sourcetypes-in-a-stats-block/m-p/409529#M118151</guid>
      <dc:creator>akelbr</dc:creator>
      <dc:date>2019-01-18T13:28:35Z</dc:date>
    </item>
    <item>
      <title>Re: Combining fields from 2 sourcetypes in a stats block</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-fields-from-2-sourcetypes-in-a-stats-block/m-p/409530#M118152</link>
      <description>&lt;P&gt;Forgot to add: My ultimate goal is to have a list with the KBs installed on the machines and the avg resource used on that day. Trying to find any outstanding value during the patching process.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jan 2019 13:30:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-fields-from-2-sourcetypes-in-a-stats-block/m-p/409530#M118152</guid>
      <dc:creator>akelbr</dc:creator>
      <dc:date>2019-01-18T13:30:59Z</dc:date>
    </item>
    <item>
      <title>Re: Combining fields from 2 sourcetypes in a stats block</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-fields-from-2-sourcetypes-in-a-stats-block/m-p/409531#M118153</link>
      <description>&lt;P&gt;Do you have host &amp;amp; InstallDate  fields in sourcetype=uberAgent:System:SystemPerformanceSummary2 and are non null?&lt;/P&gt;

&lt;P&gt;Try the below and see if you have some events in common.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=uberagent (sourcetype=uberAgent:Application:SoftwareUpdateInventory host=*) OR sourcetype=uberAgent:System:SystemPerformanceSummary2 
|stats dc(sourcetype) as c by host,InstallDate  |where c&amp;gt;1
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Jan 2019 13:36:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-fields-from-2-sourcetypes-in-a-stats-block/m-p/409531#M118153</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2019-01-18T13:36:25Z</dc:date>
    </item>
    <item>
      <title>Re: Combining fields from 2 sourcetypes in a stats block</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-fields-from-2-sourcetypes-in-a-stats-block/m-p/409532#M118154</link>
      <description>&lt;P&gt;Of course! that is the point! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;The InstallDate is not on sourcetype 2.&lt;/P&gt;

&lt;P&gt;Said that, I need my calculations based on the InstallDate values. &lt;/P&gt;

&lt;P&gt;How can I do that?&lt;/P&gt;

&lt;P&gt;Maybe in this case I should use the JOIN with HOST field that is common to both?&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jan 2019 13:43:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-fields-from-2-sourcetypes-in-a-stats-block/m-p/409532#M118154</guid>
      <dc:creator>akelbr</dc:creator>
      <dc:date>2019-01-18T13:43:08Z</dc:date>
    </item>
    <item>
      <title>Re: Combining fields from 2 sourcetypes in a stats block</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-fields-from-2-sourcetypes-in-a-stats-block/m-p/409533#M118155</link>
      <description>&lt;P&gt;Can not really say without seeing the events. But you may try including the InstallDate  in existing stats as values(InstallDate ) as InstallDate  . In between, in the currrent search are you getting host and InstallDate as multivalue field or wha'ts the use of &lt;CODE&gt;mvexpand host&lt;/CODE&gt; and &lt;CODE&gt;mvexpand InstallDate&lt;/CODE&gt; ?&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jan 2019 14:10:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-fields-from-2-sourcetypes-in-a-stats-block/m-p/409533#M118155</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2019-01-18T14:10:31Z</dc:date>
    </item>
    <item>
      <title>Re: Combining fields from 2 sourcetypes in a stats block</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-fields-from-2-sourcetypes-in-a-stats-block/m-p/409534#M118156</link>
      <description>&lt;P&gt;Thank you for you help on this!&lt;/P&gt;

&lt;P&gt;I`ve tried to use values(InstallDate ) as InstallDate  in the current stats but got the following error: &lt;BR /&gt;
Error in 'stats' command: The output field 'InstallDate' cannot have the same name as a group-by field. &lt;/P&gt;

&lt;P&gt;if use a separated stats, nothing comes up.&lt;/P&gt;

&lt;P&gt;About the mvexpand, I`m using because was the way a found to get the same result as the splitrow in pivot.&lt;/P&gt;

&lt;P&gt;See below an example of the events:&lt;/P&gt;

&lt;P&gt;InstallDate       Machine Name     Patch Name        ProducName      %of CPU     %of RAM   % of IO&lt;BR /&gt;
2018-01-01                KB1234                Office&lt;BR /&gt;&lt;BR /&gt;
2018-01-01                KB1234                Office&lt;BR /&gt;&lt;BR /&gt;
2018-01-02                KB1234                Office                              &lt;/P&gt;</description>
      <pubDate>Fri, 18 Jan 2019 15:54:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-fields-from-2-sourcetypes-in-a-stats-block/m-p/409534#M118156</guid>
      <dc:creator>akelbr</dc:creator>
      <dc:date>2019-01-18T15:54:01Z</dc:date>
    </item>
    <item>
      <title>Re: Combining fields from 2 sourcetypes in a stats block</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-fields-from-2-sourcetypes-in-a-stats-block/m-p/409535#M118157</link>
      <description>&lt;P&gt;InstallDate Machine Name Patch Name ProducName %of CPU %of RAM % of IO&lt;BR /&gt;
2018-01-01    SERVERA         KB1234             Office             null         null              null&lt;BR /&gt;
2018-01-01    SERVERB         KB1234             Office             null         null              null&lt;BR /&gt;
2018-01-02    SERVERC         KB1234             Office             null         null              null&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jan 2019 15:55:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-fields-from-2-sourcetypes-in-a-stats-block/m-p/409535#M118157</guid>
      <dc:creator>akelbr</dc:creator>
      <dc:date>2019-01-18T15:55:18Z</dc:date>
    </item>
    <item>
      <title>Re: Combining fields from 2 sourcetypes in a stats block</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-fields-from-2-sourcetypes-in-a-stats-block/m-p/409536#M118158</link>
      <description>&lt;P&gt;&lt;CODE&gt;values(InstallDate ) as InstallDate by host&lt;/CODE&gt;  (exclude the InstallDate from by clause)&lt;/P&gt;</description>
      <pubDate>Sat, 19 Jan 2019 02:52:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-fields-from-2-sourcetypes-in-a-stats-block/m-p/409536#M118158</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2019-01-19T02:52:18Z</dc:date>
    </item>
    <item>
      <title>Re: Combining fields from 2 sourcetypes in a stats block</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-fields-from-2-sourcetypes-in-a-stats-block/m-p/409537#M118159</link>
      <description>&lt;P&gt;The solution was to have the data from sourcetype 2 exported to a file and then using a lookup with sourcetype 1.&lt;BR /&gt;
It works like a charm! The only thing is that I from time to time I need to run the export search to update the file.&lt;/P&gt;

&lt;P&gt;Thank you renjithnair for help me on this.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Feb 2019 10:24:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-fields-from-2-sourcetypes-in-a-stats-block/m-p/409537#M118159</guid>
      <dc:creator>akelbr</dc:creator>
      <dc:date>2019-02-04T10:24:59Z</dc:date>
    </item>
  </channel>
</rss>

