<?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: Eval for known and unknown field values in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Eval-for-known-and-unknown-field-values/m-p/129632#M35275</link>
    <description>&lt;P&gt;Sorry my bad. Its was indded a syntax from my end. Thank you so much for your help, Martin.&lt;/P&gt;</description>
    <pubDate>Sun, 08 Feb 2015 01:05:11 GMT</pubDate>
    <dc:creator>ashabc</dc:creator>
    <dc:date>2015-02-08T01:05:11Z</dc:date>
    <item>
      <title>Eval for known and unknown field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-for-known-and-unknown-field-values/m-p/129628#M35271</link>
      <description>&lt;P&gt;I am using a search command to rename ip address output to device names something like below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=syslog | eval srcip = case(srcip = "192.168.x.5","Samsung S4", srcip = "192.168.x.8","iPhone5", srcip = "192.168.x.10","Laptop") | rename "srcip" as "Device Name"  | stats count by "Device Name" 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The problem is with the above command is,  it only displays the devices that are in the case statement. How can I display all the devices in the sourcetype/log both defined in the case statement and those are not defined (the IP address instead of name is fine for the devices which are not defined in the case statement). For example there could be a device in the logfile with srcip=192.168.x.21 which is not defned in the case statement, and hence will not show in the output, but I would lke this device be displayed as 192.168.x.21 in the stats command output.&lt;/P&gt;</description>
      <pubDate>Sat, 07 Feb 2015 10:05:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-for-known-and-unknown-field-values/m-p/129628#M35271</guid>
      <dc:creator>ashabc</dc:creator>
      <dc:date>2015-02-07T10:05:33Z</dc:date>
    </item>
    <item>
      <title>Re: Eval for known and unknown field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-for-known-and-unknown-field-values/m-p/129629#M35272</link>
      <description>&lt;P&gt;You need to do the eval and rename after your stats: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=syslog | stats count by srcip | eval srcip = case(srcip = "192.168.x.5","Samsung S4", srcip = "192.168.x.8","iPhone5", srcip = "192.168.x.10","Laptop", true(), srcip) | rename "srcip" as "Device Name" 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 07 Feb 2015 13:32:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-for-known-and-unknown-field-values/m-p/129629#M35272</guid>
      <dc:creator>_d_</dc:creator>
      <dc:date>2015-02-07T13:32:43Z</dc:date>
    </item>
    <item>
      <title>Re: Eval for known and unknown field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-for-known-and-unknown-field-values/m-p/129630#M35273</link>
      <description>&lt;P&gt;Make your &lt;CODE&gt;case()&lt;/CODE&gt; keep the original value for unknown values like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval srcip = case(srcip = "192.168.x.5","Samsung S4", srcip = "192.168.x.8","iPhone5", srcip = "192.168.x.10","Laptop", 1=1, srcip)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;As an entirely different alternative, define a lookup table containing your known mapped values. That'll keep this knowledge out of potentially many searches.&lt;/P&gt;</description>
      <pubDate>Sat, 07 Feb 2015 14:11:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-for-known-and-unknown-field-values/m-p/129630#M35273</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2015-02-07T14:11:26Z</dc:date>
    </item>
    <item>
      <title>Re: Eval for known and unknown field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-for-known-and-unknown-field-values/m-p/129631#M35274</link>
      <description>&lt;P&gt;Thank you Martin for responding to my post. When I use the command you suggested, it throws an error "Unknown search command 'case'. "&lt;BR /&gt;
Any syntax issue in 1=1, srcip ?&lt;/P&gt;</description>
      <pubDate>Sun, 08 Feb 2015 00:59:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-for-known-and-unknown-field-values/m-p/129631#M35274</guid>
      <dc:creator>ashabc</dc:creator>
      <dc:date>2015-02-08T00:59:32Z</dc:date>
    </item>
    <item>
      <title>Re: Eval for known and unknown field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-for-known-and-unknown-field-values/m-p/129632#M35275</link>
      <description>&lt;P&gt;Sorry my bad. Its was indded a syntax from my end. Thank you so much for your help, Martin.&lt;/P&gt;</description>
      <pubDate>Sun, 08 Feb 2015 01:05:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-for-known-and-unknown-field-values/m-p/129632#M35275</guid>
      <dc:creator>ashabc</dc:creator>
      <dc:date>2015-02-08T01:05:11Z</dc:date>
    </item>
  </channel>
</rss>

