<?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: RegEx Extract value after string in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/RegEx-Extract-value-after-string/m-p/442868#M168974</link>
    <description>&lt;P&gt;@arrowecssupport, based on the sample data you can use the following rex command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "Uptime:\s(?&amp;lt;uptime&amp;gt;.*)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please find below the tun anywhere search, which extracts the uptime value and also uses &lt;CODE&gt;convert&lt;/CODE&gt; command function &lt;CODE&gt;dur2sec()&lt;/CODE&gt; to convert &lt;CODE&gt;D+HH:MM:SS&lt;/CODE&gt; to seconds.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval data=".1.3.6.1.4.1.789 Enterprise Specific Trap (87) Uptime: 0:27:51.35;.1.3.6.1.3.94 Enterprise Specific Trap (4) Uptime: 195 days, 7:01:04.00"
| makemv data delim=";"
| mvexpand data
| rename data as _raw
| rex "Uptime:\s(?&amp;lt;uptime&amp;gt;.*)"
| eval uptime_seconds=replace(replace(uptime,"\sdays,\s","+"),"\..+","")
| convert dur2sec(uptime_seconds)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 11 Jun 2018 11:30:40 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2018-06-11T11:30:40Z</dc:date>
    <item>
      <title>RegEx Extract value after string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/RegEx-Extract-value-after-string/m-p/442867#M168973</link>
      <description>&lt;P&gt;I'm trying to build an extraction to find the uptime from this data (example below)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.1.3.6.1.4.1.789 Enterprise Specific Trap (87) Uptime: 0:27:51.35
.1.3.6.1.3.94 Enterprise Specific Trap (4) Uptime: 195 days, 7:01:04.00
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Can anyone help with the RegEx?&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 10:56:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/RegEx-Extract-value-after-string/m-p/442867#M168973</guid>
      <dc:creator>arrowecssupport</dc:creator>
      <dc:date>2018-06-11T10:56:32Z</dc:date>
    </item>
    <item>
      <title>Re: RegEx Extract value after string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/RegEx-Extract-value-after-string/m-p/442868#M168974</link>
      <description>&lt;P&gt;@arrowecssupport, based on the sample data you can use the following rex command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "Uptime:\s(?&amp;lt;uptime&amp;gt;.*)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please find below the tun anywhere search, which extracts the uptime value and also uses &lt;CODE&gt;convert&lt;/CODE&gt; command function &lt;CODE&gt;dur2sec()&lt;/CODE&gt; to convert &lt;CODE&gt;D+HH:MM:SS&lt;/CODE&gt; to seconds.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval data=".1.3.6.1.4.1.789 Enterprise Specific Trap (87) Uptime: 0:27:51.35;.1.3.6.1.3.94 Enterprise Specific Trap (4) Uptime: 195 days, 7:01:04.00"
| makemv data delim=";"
| mvexpand data
| rename data as _raw
| rex "Uptime:\s(?&amp;lt;uptime&amp;gt;.*)"
| eval uptime_seconds=replace(replace(uptime,"\sdays,\s","+"),"\..+","")
| convert dur2sec(uptime_seconds)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Jun 2018 11:30:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/RegEx-Extract-value-after-string/m-p/442868#M168974</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-06-11T11:30:40Z</dc:date>
    </item>
  </channel>
</rss>

