<?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 / rex a field and change its output in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/eval-rex-a-field-and-change-its-output/m-p/460365#M129891</link>
    <description>&lt;P&gt;Awesome thanks!..You answered my question perfectly, and will accept accordingly.  However, I now realize that it probably makes more sense for me to "replace" the intervals with a cron schedule with 86400 rather than create a new field called output ( for the sake of writing it to a lookup)...Do you have a way to do that...I can ask it in other question form if you prefer...Thanks again!&lt;/P&gt;</description>
    <pubDate>Wed, 11 Dec 2019 13:58:08 GMT</pubDate>
    <dc:creator>spluzer</dc:creator>
    <dc:date>2019-12-11T13:58:08Z</dc:date>
    <item>
      <title>eval / rex a field and change its output</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-rex-a-field-and-change-its-output/m-p/460363#M129889</link>
      <description>&lt;P&gt;hello all,&lt;/P&gt;

&lt;P&gt;I have a lookup with two fields sourcetype and interval ( like below) ..some of the intervals are in seconds (which is great) -  However some are in cron like (14 01 * * *) --I need to change the ones in cron to 86400 ...Any ideas &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype          interval


blah                  300

blah2               15 01 * * * *

blah3               3600

blah4                18 02 * * *
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here is my comically bad regex I've been working with, but cant seem to make it work&lt;/P&gt;

&lt;P&gt;| rest splunk_server=local /services/data/inputs/script&lt;BR /&gt;
| search (disabled = 0 AND interval=*)&lt;BR /&gt;
| dedup sourcetype&lt;BR /&gt;
| eval output=if(match(interval="(\d+)(\d+).(\d).(*).(*).(*)")),"86400","interval")&lt;/P&gt;

&lt;P&gt;| table sourcetype interval output&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2019 13:23:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-rex-a-field-and-change-its-output/m-p/460363#M129889</guid>
      <dc:creator>spluzer</dc:creator>
      <dc:date>2019-12-11T13:23:45Z</dc:date>
    </item>
    <item>
      <title>Re: eval / rex a field and change its output</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-rex-a-field-and-change-its-output/m-p/460364#M129890</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| rest splunk_server=local /services/data/inputs/script
| search (disabled = 0 AND interval=*)
| eval output=if(match(interval,"^-?\d+$"),"interval","86400")
| stats values(interval) as interval values(output) as output by sourcetype
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hi, @spluzer&lt;BR /&gt;
How about this?&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2019 13:46:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-rex-a-field-and-change-its-output/m-p/460364#M129890</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2019-12-11T13:46:18Z</dc:date>
    </item>
    <item>
      <title>Re: eval / rex a field and change its output</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-rex-a-field-and-change-its-output/m-p/460365#M129891</link>
      <description>&lt;P&gt;Awesome thanks!..You answered my question perfectly, and will accept accordingly.  However, I now realize that it probably makes more sense for me to "replace" the intervals with a cron schedule with 86400 rather than create a new field called output ( for the sake of writing it to a lookup)...Do you have a way to do that...I can ask it in other question form if you prefer...Thanks again!&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2019 13:58:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-rex-a-field-and-change-its-output/m-p/460365#M129891</guid>
      <dc:creator>spluzer</dc:creator>
      <dc:date>2019-12-11T13:58:08Z</dc:date>
    </item>
    <item>
      <title>Re: eval / rex a field and change its output</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-rex-a-field-and-change-its-output/m-p/460366#M129892</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;Check this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rest splunk_server=local /services/data/inputs/script 
| search (disabled = 0 AND interval=*) 
| eval interval=if(match(interval,"^-?\d+$"),'interval',"86400") 
| stats values(interval) as interval by sourcetype
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 11 Dec 2019 14:30:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-rex-a-field-and-change-its-output/m-p/460366#M129892</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2019-12-11T14:30:49Z</dc:date>
    </item>
    <item>
      <title>Re: eval / rex a field and change its output</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-rex-a-field-and-change-its-output/m-p/460367#M129893</link>
      <description>&lt;P&gt;Yep, that does it. I'm an idiot ..lol...Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2019 14:39:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-rex-a-field-and-change-its-output/m-p/460367#M129893</guid>
      <dc:creator>spluzer</dc:creator>
      <dc:date>2019-12-11T14:39:19Z</dc:date>
    </item>
  </channel>
</rss>

