<?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: creating an 'other' field with eval in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/creating-an-other-field-with-eval/m-p/212403#M62196</link>
    <description>&lt;P&gt;Try this - one always equals one so it'll always be true...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=cpdata | eval ua = case(
     match(userAgent, "MSIE"), "Windows",
     match(userAgent, "Windows"), "Windows",
     match(userAgent, "Android"), "Android",
     match(userAgent, "BlackBerry"), "BlackBerry",
     match(userAgent, "like Mac OS X"), "iOS",
     1==1, "Other"
 ) | chart count by ua | sort by count | reverse
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 22 Apr 2016 11:55:47 GMT</pubDate>
    <dc:creator>Richfez</dc:creator>
    <dc:date>2016-04-22T11:55:47Z</dc:date>
    <item>
      <title>creating an 'other' field with eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/creating-an-other-field-with-eval/m-p/212402#M62195</link>
      <description>&lt;P&gt;I am quite knew to this and not remotely wedded to eval as the solution for this problem, I am eager to know if there is a better way to do this.&lt;/P&gt;

&lt;P&gt;I am currently using this query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=cpdata | eval ua = case(
    match(userAgent, "MSIE"), "Windows",
    match(userAgent, "Windows"), "Windows",
    match(userAgent, "Android"), "Android",
    match(userAgent, "BlackBerry"), "BlackBerry",
    match(userAgent, "like Mac OS X"), "iOS"
) | chart count by ua | sort by count | reverse
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Which is successfully  giving me what I expect to see.. I want to create a further case of 'Other' where anything that doesn't match is counted though.  I have not managed to do this.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2016 09:40:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/creating-an-other-field-with-eval/m-p/212402#M62195</guid>
      <dc:creator>tomlongfield</dc:creator>
      <dc:date>2016-04-22T09:40:28Z</dc:date>
    </item>
    <item>
      <title>Re: creating an 'other' field with eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/creating-an-other-field-with-eval/m-p/212403#M62196</link>
      <description>&lt;P&gt;Try this - one always equals one so it'll always be true...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=cpdata | eval ua = case(
     match(userAgent, "MSIE"), "Windows",
     match(userAgent, "Windows"), "Windows",
     match(userAgent, "Android"), "Android",
     match(userAgent, "BlackBerry"), "BlackBerry",
     match(userAgent, "like Mac OS X"), "iOS",
     1==1, "Other"
 ) | chart count by ua | sort by count | reverse
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Apr 2016 11:55:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/creating-an-other-field-with-eval/m-p/212403#M62196</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2016-04-22T11:55:47Z</dc:date>
    </item>
    <item>
      <title>Re: creating an 'other' field with eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/creating-an-other-field-with-eval/m-p/212404#M62197</link>
      <description>&lt;P&gt;Works perfectly, thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2016 12:00:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/creating-an-other-field-with-eval/m-p/212404#M62197</guid>
      <dc:creator>tomlongfield</dc:creator>
      <dc:date>2016-04-22T12:00:09Z</dc:date>
    </item>
  </channel>
</rss>

