<?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 Group results by similar name into one in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Group-results-by-similar-name-into-one/m-p/352823#M104432</link>
    <description>&lt;P&gt;The name for Windows 7 Enterprise is spelt incorrectly for 6 machines as "Entreprise" and I need to group both these Windows 7 results together into one so the total count becomes 100 for Windows 7 Enterprise and the incorrect spelling is removed from the table.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=ad source=otl_addnsscan 
      | eval machine=lower(name)
  | rename User_Name0 as LastKnownUser, Caption0 as operatingSystem, Version0 as Version, Model0 as Model 
  | rename data as IPAddress 
  | search machine="***" operatingSystem="***" OR NOT operatingSystem="*" 
  | fillnull value="No OS listed" operatingSystem
  | dedup machine 
  | stats count(machine) as count by operatingSystem 
  | eventstats sum(count) as total
 | eval percentage = ((count/total)*100)
 | eval percentage = round(percentage,2)
 |eval percentage =percentage ."%"
 |table operatingSystem ,count, percentage 
 |sort operatingSystem
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;IMG src="https://community.splunk.com/storage/temp/228625-splunk-os.png" alt="" /&gt; &lt;/P&gt;</description>
    <pubDate>Thu, 01 Feb 2018 10:25:46 GMT</pubDate>
    <dc:creator>davidcraven02</dc:creator>
    <dc:date>2018-02-01T10:25:46Z</dc:date>
    <item>
      <title>Group results by similar name into one</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Group-results-by-similar-name-into-one/m-p/352823#M104432</link>
      <description>&lt;P&gt;The name for Windows 7 Enterprise is spelt incorrectly for 6 machines as "Entreprise" and I need to group both these Windows 7 results together into one so the total count becomes 100 for Windows 7 Enterprise and the incorrect spelling is removed from the table.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=ad source=otl_addnsscan 
      | eval machine=lower(name)
  | rename User_Name0 as LastKnownUser, Caption0 as operatingSystem, Version0 as Version, Model0 as Model 
  | rename data as IPAddress 
  | search machine="***" operatingSystem="***" OR NOT operatingSystem="*" 
  | fillnull value="No OS listed" operatingSystem
  | dedup machine 
  | stats count(machine) as count by operatingSystem 
  | eventstats sum(count) as total
 | eval percentage = ((count/total)*100)
 | eval percentage = round(percentage,2)
 |eval percentage =percentage ."%"
 |table operatingSystem ,count, percentage 
 |sort operatingSystem
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;IMG src="https://community.splunk.com/storage/temp/228625-splunk-os.png" alt="" /&gt; &lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2018 10:25:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Group-results-by-similar-name-into-one/m-p/352823#M104432</guid>
      <dc:creator>davidcraven02</dc:creator>
      <dc:date>2018-02-01T10:25:46Z</dc:date>
    </item>
    <item>
      <title>Re: Group results by similar name into one</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Group-results-by-similar-name-into-one/m-p/352824#M104433</link>
      <description>&lt;P&gt;Hi @davidcraven02,&lt;BR /&gt;
Try This:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=ad source=otl_addnsscan 
       | eval machine=lower(name)
   | rename User_Name0 as LastKnownUser, Caption0 as operatingSystem, Version0 as Version, Model0 as Model 
   | rename data as IPAddress 
   | search machine="***" operatingSystem="***" OR NOT operatingSystem="*" 
   | fillnull value="No OS listed" operatingSystem
   | dedup machine 
   |eval operatingSystem=replace(operatingSystem,"Entreprise", "Enterprise")
   | stats count(machine) as count by operatingSystem 
   | eventstats sum(count) as total
  | eval percentage = ((count/total)*100)
  | eval percentage = round(percentage,2)
  |eval percentage =percentage ."%"
  |table operatingSystem ,count, percentage 
  |sort operatingSystem
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2018 10:45:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Group-results-by-similar-name-into-one/m-p/352824#M104433</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-02-01T10:45:25Z</dc:date>
    </item>
    <item>
      <title>Re: Group results by similar name into one</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Group-results-by-similar-name-into-one/m-p/352825#M104434</link>
      <description>&lt;P&gt;Thanks but this didn't make any difference to the table. &lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2018 11:26:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Group-results-by-similar-name-into-one/m-p/352825#M104434</guid>
      <dc:creator>davidcraven02</dc:creator>
      <dc:date>2018-02-01T11:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: Group results by similar name into one</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Group-results-by-similar-name-into-one/m-p/352826#M104435</link>
      <description>&lt;P&gt;Try this anywhere search :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults|eval operatingSystem="Microsoft Windows 10 Entreprise"|append[|makeresults|eval operatingSystem="Microsoft Windows 10 Enterprise"]|append[|makeresults|eval operatingSystem="Microsoft Windows 10 Pro"]|table operatingSystem|eval operatingSystem=replace(operatingSystem,"Entreprise", "Enterprise")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;same way include &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...|eval operatingSystem=replace(operatingSystem,"Entreprise", "Enterprise")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;so that it will replace "Entreprise" by "Enterprise"...&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2018 11:33:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Group-results-by-similar-name-into-one/m-p/352826#M104435</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-02-01T11:33:24Z</dc:date>
    </item>
    <item>
      <title>Re: Group results by similar name into one</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Group-results-by-similar-name-into-one/m-p/352827#M104436</link>
      <description>&lt;P&gt;This didnt work unfortunately. &lt;/P&gt;

&lt;P&gt;Microsoft Windows 10 Pro&lt;BR /&gt;
Microsoft Windows 10 Enterprise&lt;BR /&gt;
Microsoft Windows 10 Enterprise&lt;/P&gt;

&lt;P&gt;It doesn't merge the into one row, same issue with the other guys comment. &lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2018 13:37:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Group-results-by-similar-name-into-one/m-p/352827#M104436</guid>
      <dc:creator>davidcraven02</dc:creator>
      <dc:date>2018-02-01T13:37:34Z</dc:date>
    </item>
    <item>
      <title>Re: Group results by similar name into one</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Group-results-by-similar-name-into-one/m-p/352828#M104437</link>
      <description>&lt;P&gt;But the string replacing worked.&lt;/P&gt;

&lt;P&gt;Did you add that eval statement in your original search in the exact place that was suggested? Given your comment it seems that you might have added the eval statement to fix the OS name after the stats count by operatingSystem line?&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2018 13:47:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Group-results-by-similar-name-into-one/m-p/352828#M104437</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2018-02-01T13:47:45Z</dc:date>
    </item>
    <item>
      <title>Re: Group results by similar name into one</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Group-results-by-similar-name-into-one/m-p/352829#M104438</link>
      <description>&lt;P&gt;There are several performance issues with your query&lt;/P&gt;

&lt;P&gt;1) &lt;CODE&gt;| search&lt;/CODE&gt; should be added to base search to restrict events pulled from index.&lt;BR /&gt;
2) Field rename, eval should happen after transforming command unless it can't be avoided i.e. &lt;CODE&gt;stats&lt;/CODE&gt; so that they operate only on few aggregated rows rather than all events. &lt;BR /&gt;
3) &lt;CODE&gt;lower(name)&lt;/CODE&gt; seems unnecessary additional command.&lt;BR /&gt;
4) eval command can be cascaded&lt;/P&gt;

&lt;P&gt;Besides the above can you explain your intention with &lt;CODE&gt;operatingSystem="***" OR NOT operatingSystem="*"&lt;/CODE&gt;&lt;BR /&gt;
Try the changes suggested below and confirm:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    index="ad" source="otl_addnsscan" Caption0="yourOSSearchPattern*"  name="yourMachineSearchPattern*"
   | dedup name
   | fillnull value="No OS listed" Caption0
   | stats count(name) as count by Caption0
   | eval Caption0=replace(Caption0,"Entreprise","Enterprise")
   | stats sum(count) as count by Caption0 
   | eventstats sum(count) as total
   | eval percentage = round(((count/total)*100),2)."%"
   | rename Caption0 as  operatingSystem
   | sort operatingSystem
   | table operatingSystem ,count, percentage 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Feb 2018 14:00:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Group-results-by-similar-name-into-one/m-p/352829#M104438</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-02-01T14:00:24Z</dc:date>
    </item>
    <item>
      <title>Re: Group results by similar name into one</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Group-results-by-similar-name-into-one/m-p/352830#M104439</link>
      <description>&lt;P&gt;Thanks for a follow up. Yes this renames it the incorrect one to 'Microsoft Windows 7 Enterprise' correctly but when displaying in a table or pie chart they are both listed individually with the same name not as one as I intended. &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Actual Results&lt;/STRONG&gt;&lt;BR /&gt;
Microsoft Windows 7 Enterprise  94  2.19%&lt;BR /&gt;
Microsoft Windows 7 Enterprise  6   0.14%&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Desired Results&lt;/STRONG&gt;&lt;BR /&gt;
Microsoft Windows 7 Enterprise  100 3.33%&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2018 10:01:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Group-results-by-similar-name-into-one/m-p/352830#M104439</guid>
      <dc:creator>davidcraven02</dc:creator>
      <dc:date>2018-02-02T10:01:47Z</dc:date>
    </item>
    <item>
      <title>Re: Group results by similar name into one</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Group-results-by-similar-name-into-one/m-p/352831#M104440</link>
      <description>&lt;P&gt;I appreciate the follow up. Its displaying them as separate in a table and chart format even though they are spelt the same. &lt;/P&gt;

&lt;P&gt;Actual Output&lt;BR /&gt;
Microsoft Windows 7 Enterprise  94  2.19%&lt;BR /&gt;
Microsoft Windows 7 Enterprise  6   0.14%&lt;/P&gt;

&lt;P&gt;Desired Output&lt;BR /&gt;
Microsoft Windows 7 Enterprise  100 2.33%&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2018 10:21:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Group-results-by-similar-name-into-one/m-p/352831#M104440</guid>
      <dc:creator>davidcraven02</dc:creator>
      <dc:date>2018-02-02T10:21:12Z</dc:date>
    </item>
    <item>
      <title>Re: Group results by similar name into one</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Group-results-by-similar-name-into-one/m-p/352832#M104441</link>
      <description>&lt;P&gt;Hi @davidcraven02. Have you also added the second &lt;CODE&gt;stats sum(count) as count by Caption0&lt;/CODE&gt;. Percent should be calculated afterwards. Following is a run anywhere search . Commands till the following are used to mimica some sample data as per your current output. &lt;CODE&gt;|  eval Caption0=replace(Caption0,"Entreprise","Enterprise")&lt;/CODE&gt;.  The commands with stats starting after the above &lt;CODE&gt;replace()&lt;/CODE&gt; eval are exactly the same as per the answer. Please try out and confirm.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|  makeresults
|  eval Caption0="Microsoft Windows 10 Enterprise,208;Microsoft Windows 10 Pro,2083;Microsoft Windows 10 Pro N,1;Microsoft Windows 7 Enterprise,94;Microsoft Windows 7 Professional,1409;Microsoft Windows 7 Ultimate,3;Microsoft Windows 7 Entreprise,1409;"
|  makemv Caption0 delim=";"
|  mvexpand Caption0
|  eval Caption0=split(Caption0,",")
|  eval count=mvindex(Caption0,1)
|  eval Caption0=mvindex(Caption0,0)
|  eval Caption0=replace(Caption0,"Entreprise","Enterprise")
|  stats sum(count) as count by Caption0 
|  eventstats sum(count) as total
|  eval percentage = round(((count/total)*100),2)."%"
|  rename Caption0 as  operatingSystem
|  sort operatingSystem
|  table operatingSystem ,count, percentage
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Feb 2018 11:28:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Group-results-by-similar-name-into-one/m-p/352832#M104441</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-02-02T11:28:04Z</dc:date>
    </item>
    <item>
      <title>Re: Group results by similar name into one</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Group-results-by-similar-name-into-one/m-p/352833#M104442</link>
      <description>&lt;P&gt;Yes that runs correctly but I found that when I download the raw logs it lists the OS as "Microsoft WindowsÂ 7 Entreprise" but in Splunk it displays it as "Microsoft Windows 7 Entreprise".&lt;/P&gt;

&lt;P&gt;Perhaps this is why Splunk doesn't recognize them as being the same because of this character. &lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2018 15:02:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Group-results-by-similar-name-into-one/m-p/352833#M104442</guid>
      <dc:creator>davidcraven02</dc:creator>
      <dc:date>2018-02-02T15:02:17Z</dc:date>
    </item>
  </channel>
</rss>

