<?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 Grouping similar fields using search syntax? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Grouping-similar-fields-using-search-syntax/m-p/47416#M11315</link>
    <description>&lt;P&gt;I have a ton of useragent type fields, like MacOutlook/some_version_x_os_version_etc and Entourage/other_version_x_os_version_etc.  How can I group these for reporting so they all show up as MacOutlook and Entourage?&lt;/P&gt;</description>
    <pubDate>Sat, 19 Feb 2011 04:53:23 GMT</pubDate>
    <dc:creator>the_wolverine</dc:creator>
    <dc:date>2011-02-19T04:53:23Z</dc:date>
    <item>
      <title>Grouping similar fields using search syntax?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Grouping-similar-fields-using-search-syntax/m-p/47416#M11315</link>
      <description>&lt;P&gt;I have a ton of useragent type fields, like MacOutlook/some_version_x_os_version_etc and Entourage/other_version_x_os_version_etc.  How can I group these for reporting so they all show up as MacOutlook and Entourage?&lt;/P&gt;</description>
      <pubDate>Sat, 19 Feb 2011 04:53:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Grouping-similar-fields-using-search-syntax/m-p/47416#M11315</guid>
      <dc:creator>the_wolverine</dc:creator>
      <dc:date>2011-02-19T04:53:23Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping similar fields using search syntax?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Grouping-similar-fields-using-search-syntax/m-p/47417#M11316</link>
      <description>&lt;P&gt;You can always use a rex to pull out a subset of the field. For example, if you just want to pull the contents of the useragent field before the /, you could do the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;YourSearch | rex field=useragent "^(?&amp;lt;GeneralAgent&amp;gt;.*?)/" | stats count by GeneralAgent
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you don't have the useragent already pulled out, you could expand that:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;YourSearch | rex field=_raw "UserAgent=(?&amp;lt;GeneralAgent&amp;gt;.*?)/" | stats count by GeneralAgent
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can then move that extraction into your props.conf to make it permanent.&lt;/P&gt;</description>
      <pubDate>Sat, 19 Feb 2011 05:00:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Grouping-similar-fields-using-search-syntax/m-p/47417#M11316</guid>
      <dc:creator>David</dc:creator>
      <dc:date>2011-02-19T05:00:48Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping similar fields using search syntax?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Grouping-similar-fields-using-search-syntax/m-p/47418#M11317</link>
      <description>&lt;P&gt;1) It's a pretty manual technique, but you can do it with eval, if and searchmatch. &lt;/P&gt;

&lt;P&gt;For example, this string of evals will create a field called userAgentType whose values are just Entourage, MacOutlook and Other. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your search&amp;gt;  
| eval userAgentType=if(searchmatch("useragent=*Entourage*"), "Entourage",userAgentType)
| eval userAgentType=if(searchmatch("useragent=*MacOutlook*"), "MacOutlook",userAgentType)
| eval userAgentType=if(isnull(userAgentType),"Other", userAgentType)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and to tack a chart on the end: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your search&amp;gt;  
| eval userAgentType=if(searchmatch("useragent=*Entourage*"), "Entourage",userAgentType)
| eval userAgentType=if(searchmatch("useragent=*MacOutlook*"), "MacOutlook",userAgentType)
| eval userAgentType=if(isnull(userAgentType),"Other", userAgentType) 
| timechart count by userAgentType
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;2) Another way you could do it, is to create a bunch of eventtypes that match based on userAgent, and then just do searches with &lt;CODE&gt;by eventtype&lt;/CODE&gt; on the end.   In that scenario though you'd have to be careful not to have overlapping eventtypes, as well as to somehow filter out all of the eventtypes that have nothing to do with 'useragent-ness'&lt;/P&gt;</description>
      <pubDate>Sat, 19 Feb 2011 05:54:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Grouping-similar-fields-using-search-syntax/m-p/47418#M11317</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2011-02-19T05:54:48Z</dc:date>
    </item>
  </channel>
</rss>

