<?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: Help with Splunk search (EVAL command) in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Splunk-search-EVAL-command/m-p/38176#M8660</link>
    <description>&lt;P&gt;OK, this works now:&lt;/P&gt;

&lt;P&gt;eval Severity=if(sourcetype=="Low", "Low", null())&lt;/P&gt;</description>
    <pubDate>Tue, 20 Dec 2011 19:38:09 GMT</pubDate>
    <dc:creator>efelder0</dc:creator>
    <dc:date>2011-12-20T19:38:09Z</dc:date>
    <item>
      <title>Help with Splunk search (EVAL command)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Splunk-search-EVAL-command/m-p/38172#M8656</link>
      <description>&lt;P&gt;I am trying to assign a value to a Severity field when the sourcetype = "low" or "Med" or "high".&lt;/P&gt;

&lt;P&gt;I.e. - IF sourcetype = Low, then Severity = "Low".&lt;/P&gt;

&lt;P&gt;I am certain that an EVAL statement should work here, but not sure what the statement would read??&lt;/P&gt;

&lt;P&gt;thx&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2011 16:43:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Splunk-search-EVAL-command/m-p/38172#M8656</guid>
      <dc:creator>efelder0</dc:creator>
      <dc:date>2011-12-20T16:43:02Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Splunk search (EVAL command)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Splunk-search-EVAL-command/m-p/38173#M8657</link>
      <description>&lt;P&gt;What about something along the lines of&lt;/P&gt;

&lt;P&gt;eval Severity = if (sourcetype="low", "low", if (sourcetype="med", "med", if (sourcetype="high", "high","No Status"))) &lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2011 16:54:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Splunk-search-EVAL-command/m-p/38173#M8657</guid>
      <dc:creator>Flynt</dc:creator>
      <dc:date>2011-12-20T16:54:39Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Splunk search (EVAL command)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Splunk-search-EVAL-command/m-p/38174#M8658</link>
      <description>&lt;P&gt;I tried that. In fact, here is the actual search string =  sourcetype="McAfee ePo - Med" | eval Severity=if(sourcetype=="McAfee ePo - Med", "Medium") | table Severity &lt;/P&gt;

&lt;P&gt;I am getting the following error message: [EventsViewer module] Error in 'eval' command: The arguments to the 'if' function are invalid.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2011 18:13:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Splunk-search-EVAL-command/m-p/38174#M8658</guid>
      <dc:creator>efelder0</dc:creator>
      <dc:date>2011-12-20T18:13:55Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Splunk search (EVAL command)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Splunk-search-EVAL-command/m-p/38175#M8659</link>
      <description>&lt;P&gt;Take out the double "=" inside of your eval and give it another parameter - sourcetype="McAfee ePo - Med" | eval Severity=if(sourcetype="McAfee ePo - Med", "Medium",null) | table Severity&lt;/P&gt;

&lt;P&gt;The other parameter can be null if you want nothing or another meaningful result as given in the previous example. If you want to evaluate all three Severity types, the example provided before will nest them into one eval.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2011 18:50:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Splunk-search-EVAL-command/m-p/38175#M8659</guid>
      <dc:creator>Flynt</dc:creator>
      <dc:date>2011-12-20T18:50:52Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Splunk search (EVAL command)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Splunk-search-EVAL-command/m-p/38176#M8660</link>
      <description>&lt;P&gt;OK, this works now:&lt;/P&gt;

&lt;P&gt;eval Severity=if(sourcetype=="Low", "Low", null())&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2011 19:38:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Splunk-search-EVAL-command/m-p/38176#M8660</guid>
      <dc:creator>efelder0</dc:creator>
      <dc:date>2011-12-20T19:38:09Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Splunk search (EVAL command)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Splunk-search-EVAL-command/m-p/38177#M8661</link>
      <description>&lt;P&gt;Excellent, please upvote and accept if this answer helped you.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2011 20:35:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Splunk-search-EVAL-command/m-p/38177#M8661</guid>
      <dc:creator>Flynt</dc:creator>
      <dc:date>2011-12-20T20:35:56Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Splunk search (EVAL command)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Splunk-search-EVAL-command/m-p/38178#M8662</link>
      <description>&lt;P&gt;This is a prime time to use the eval case() function:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval Severity = case(sourcetype == "Low", "Low", sourcetype == "Med", "Medium", sourcetype == "High", "High")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Of course, if the value of the "sourcetype" field is always exactly what you want the value of the "Severity" field to be, you could just do:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval Severity = sourcetype
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Dec 2011 19:48:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Splunk-search-EVAL-command/m-p/38178#M8662</guid>
      <dc:creator>rtadams89</dc:creator>
      <dc:date>2011-12-21T19:48:53Z</dc:date>
    </item>
  </channel>
</rss>

