<?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 see results of a rex command in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/see-results-of-a-rex-command/m-p/436470#M191157</link>
    <description>&lt;P&gt;i have this rex code to extract the string from an event field:&lt;/P&gt;

&lt;P&gt;| rex "(?\d{1,2})\s+hours?\s+ago" &lt;BR /&gt;
 | eval process=case(Time&amp;lt;4, "Process Up", true(), "Process down")&lt;/P&gt;

&lt;P&gt;this is the event field: &lt;BR /&gt;
Event&lt;BR /&gt;
0 minutes ago, vmkid-p4rbdb03.lm.lmig.com, windows 6.3.9600.&lt;BR /&gt;
1 minute  ago, vmpid-h4eip001.lm.lmig.com, windows 6.3.9600.&lt;/P&gt;

&lt;P&gt;What i wanted to do is extract the 1st string w/out the minute(s) ago and use an argument to check if this is less than 4, if it is i want to label it "Process up" and if not, it should be "Process down"&lt;/P&gt;

&lt;P&gt;my code above is not working as it's marking all servers with less than 4 as Process down.  that's why i wanted to see the results for the rex command&lt;/P&gt;

&lt;P&gt;can you help me? &lt;/P&gt;

&lt;P&gt;thank you! &lt;/P&gt;</description>
    <pubDate>Thu, 08 Aug 2019 18:26:12 GMT</pubDate>
    <dc:creator>owie6466</dc:creator>
    <dc:date>2019-08-08T18:26:12Z</dc:date>
    <item>
      <title>see results of a rex command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/see-results-of-a-rex-command/m-p/436470#M191157</link>
      <description>&lt;P&gt;i have this rex code to extract the string from an event field:&lt;/P&gt;

&lt;P&gt;| rex "(?\d{1,2})\s+hours?\s+ago" &lt;BR /&gt;
 | eval process=case(Time&amp;lt;4, "Process Up", true(), "Process down")&lt;/P&gt;

&lt;P&gt;this is the event field: &lt;BR /&gt;
Event&lt;BR /&gt;
0 minutes ago, vmkid-p4rbdb03.lm.lmig.com, windows 6.3.9600.&lt;BR /&gt;
1 minute  ago, vmpid-h4eip001.lm.lmig.com, windows 6.3.9600.&lt;/P&gt;

&lt;P&gt;What i wanted to do is extract the 1st string w/out the minute(s) ago and use an argument to check if this is less than 4, if it is i want to label it "Process up" and if not, it should be "Process down"&lt;/P&gt;

&lt;P&gt;my code above is not working as it's marking all servers with less than 4 as Process down.  that's why i wanted to see the results for the rex command&lt;/P&gt;

&lt;P&gt;can you help me? &lt;/P&gt;

&lt;P&gt;thank you! &lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2019 18:26:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/see-results-of-a-rex-command/m-p/436470#M191157</guid>
      <dc:creator>owie6466</dc:creator>
      <dc:date>2019-08-08T18:26:12Z</dc:date>
    </item>
    <item>
      <title>Re: see results of a rex command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/see-results-of-a-rex-command/m-p/436471#M191158</link>
      <description>&lt;P&gt;Try this run anywhere search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval data="5 minutes ago, vmkid-p4rbdb03.lm.lmig.com, windows 6.3.9600.:1 minute ago, vmpid-h4eip001.lm.lmig.com, windows 6.3.9600." 
| makemv data delim=":" 
| mvexpand data 
| rex field=data "(?&amp;lt;Time&amp;gt;\d{1,2})\s+(minute|hour)s?\s+ago" 
| eval process=if(Time&amp;lt;4,"Process Up","Process Down")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;On your prod data you should try:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.. | rex field=_raw "(?&amp;lt;Time&amp;gt;\d{1,2})\s+(minute|hour)s?\s+ago" 
| eval process=if(Time&amp;lt;4,"Process Up","Process Down")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Aug 2019 18:37:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/see-results-of-a-rex-command/m-p/436471#M191158</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2019-08-08T18:37:24Z</dc:date>
    </item>
    <item>
      <title>Re: see results of a rex command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/see-results-of-a-rex-command/m-p/436472#M191159</link>
      <description>&lt;P&gt;thank you so much!&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2019 18:44:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/see-results-of-a-rex-command/m-p/436472#M191159</guid>
      <dc:creator>owie6466</dc:creator>
      <dc:date>2019-08-08T18:44:54Z</dc:date>
    </item>
    <item>
      <title>Re: see results of a rex command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/see-results-of-a-rex-command/m-p/436473#M191160</link>
      <description>&lt;P&gt;is there a way to make the data generic?  i have multiple search results.  &lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2019 18:46:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/see-results-of-a-rex-command/m-p/436473#M191160</guid>
      <dc:creator>owie6466</dc:creator>
      <dc:date>2019-08-08T18:46:09Z</dc:date>
    </item>
    <item>
      <title>Re: see results of a rex command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/see-results-of-a-rex-command/m-p/436474#M191161</link>
      <description>&lt;P&gt;I didn't get you. could you pls elaborate ?&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2019 18:48:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/see-results-of-a-rex-command/m-p/436474#M191161</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2019-08-08T18:48:03Z</dc:date>
    </item>
  </channel>
</rss>

