<?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: How can I get a text value in my search result to be considered as a numeric value? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-a-text-value-in-my-search-result-to-be-considered/m-p/265453#M79785</link>
    <description>&lt;P&gt;This should work with JSON format results, just ensure that correct field name is used (see the field sidebar on left for field names available).&lt;/P&gt;

&lt;P&gt;Just add your rangemap command after any of the above command.&lt;BR /&gt;
e.g. (updated the ranges)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | eval result=if(result="SUCCESS",1,2) | rangemap field=result low=1-1 severe=2-3
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 19 Jul 2016 15:41:30 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2016-07-19T15:41:30Z</dc:date>
    <item>
      <title>How can I get a text value in my search result to be considered as a numeric value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-a-text-value-in-my-search-result-to-be-considered/m-p/265449#M79781</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have a search result of a JSON file.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"
 { [-]
   number: 58
   result: SUCCESS
} "
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How can I consider the "result" as number. for example:&lt;BR /&gt;
SUCCESS = 1&lt;BR /&gt;
Failure = 2&lt;/P&gt;

&lt;P&gt;Thanks !&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2016 14:58:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-a-text-value-in-my-search-result-to-be-considered/m-p/265449#M79781</guid>
      <dc:creator>abovebeyond</dc:creator>
      <dc:date>2016-07-19T14:58:22Z</dc:date>
    </item>
    <item>
      <title>Re: How can I get a text value in my search result to be considered as a numeric value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-a-text-value-in-my-search-result-to-be-considered/m-p/265450#M79782</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval result_number = case(result="SUCCESS", 1, result="Failure", 2, true(), -1)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or, if you need it automatic, you can convert this into a &lt;CODE&gt;calculated field&lt;/CODE&gt; or a &lt;CODE&gt;lookup file&lt;/CODE&gt; and then create an &lt;CODE&gt;automatic lookup&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2016 15:07:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-a-text-value-in-my-search-result-to-be-considered/m-p/265450#M79782</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-07-19T15:07:01Z</dc:date>
    </item>
    <item>
      <title>Re: How can I get a text value in my search result to be considered as a numeric value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-a-text-value-in-my-search-result-to-be-considered/m-p/265451#M79783</link>
      <description>&lt;P&gt;YOu could use eval-if OR eval-case to do that. Another alternative is to use replace&lt;/P&gt;

&lt;P&gt;If there are only two possible values&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | eval result=if(result="SUCCESS",1,2)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If there are more than two possible values&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | eval result=case(result="SUCCESS",1,result="Failure",2,...other cases,1=1,0)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Alternative using replace method&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | replace "SUCCESS" with 1 "Failure" with 2 in result
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 Jul 2016 15:09:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-a-text-value-in-my-search-result-to-be-considered/m-p/265451#M79783</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-07-19T15:09:39Z</dc:date>
    </item>
    <item>
      <title>Re: How can I get a text value in my search result to be considered as a numeric value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-a-text-value-in-my-search-result-to-be-considered/m-p/265452#M79784</link>
      <description>&lt;P&gt;Thanks , it will work with JSON format results? &lt;/P&gt;

&lt;P&gt;how can i use the "replace" number in rangemap ? &lt;/P&gt;

&lt;P&gt;i want to use rangemap as following:&lt;BR /&gt;
 rangemap field=result  low=1-2  severe=2-3&lt;/P&gt;

&lt;P&gt;Appreciate your help !&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2016 15:18:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-a-text-value-in-my-search-result-to-be-considered/m-p/265452#M79784</guid>
      <dc:creator>abovebeyond</dc:creator>
      <dc:date>2016-07-19T15:18:11Z</dc:date>
    </item>
    <item>
      <title>Re: How can I get a text value in my search result to be considered as a numeric value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-a-text-value-in-my-search-result-to-be-considered/m-p/265453#M79785</link>
      <description>&lt;P&gt;This should work with JSON format results, just ensure that correct field name is used (see the field sidebar on left for field names available).&lt;/P&gt;

&lt;P&gt;Just add your rangemap command after any of the above command.&lt;BR /&gt;
e.g. (updated the ranges)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | eval result=if(result="SUCCESS",1,2) | rangemap field=result low=1-1 severe=2-3
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 Jul 2016 15:41:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-a-text-value-in-my-search-result-to-be-considered/m-p/265453#M79785</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-07-19T15:41:30Z</dc:date>
    </item>
  </channel>
</rss>

