<?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 to create a regex that extracts date and time from the description field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-that-extracts-date-and-time-from-the/m-p/431172#M123255</link>
    <description>&lt;P&gt;Hi Prabhakar,&lt;BR /&gt;
My events are different ,I have named them as a,b,c for example purpose :&lt;BR /&gt;
event         description&lt;BR /&gt;
2.  a                 Message: Job failed at  Aug 4 2019 8:01AM with exit code 3 and has been set to success &lt;BR /&gt;
3.  b                 Message: Job failed at Aug 1 2019 8:01AM with exit code 7 and has been set to success&lt;BR /&gt;
4.  c                  Message: Job failed at Aug  2019 8:01AM with exit code 2 and has been set to success &lt;BR /&gt;
5. And so on, many entries...&lt;/P&gt;</description>
    <pubDate>Thu, 08 Aug 2019 20:13:24 GMT</pubDate>
    <dc:creator>mayank101</dc:creator>
    <dc:date>2019-08-08T20:13:24Z</dc:date>
    <item>
      <title>How to create a regex that extracts date and time from the description field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-that-extracts-date-and-time-from-the/m-p/431166#M123249</link>
      <description>&lt;P&gt;I have 1000 of text entities under the description field, and I want to write a regex for it and put to a different entity which I will call time&lt;BR /&gt;
or eg :                &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; event         description
 a                 Message: Job failed at  Aug 4 2019 8:01AM with exit code 3 and has been set to success 
 b                 Message: Job failed at Aug 1 2019 8:01AM with exit code 7 and has been set to success
 c                  Message: Job failed at Aug  2019 8:01AM with exit code 2 and has been set to success 
And so on, many entries...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So I want regex that extracts date and time from the description field(eg  Aug 4 2019 8:01AM ) and put it to a separate field called time. &lt;BR /&gt;
Can anyone please help?&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2019 18:08:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-that-extracts-date-and-time-from-the/m-p/431166#M123249</guid>
      <dc:creator>mayank101</dc:creator>
      <dc:date>2019-08-07T18:08:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a regex that extracts date and time from the description field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-that-extracts-date-and-time-from-the/m-p/431167#M123250</link>
      <description>&lt;P&gt;There probably are many ways to do this.  Here's one you can use at search time.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex "at\s+(?&amp;lt;time&amp;gt;.*)\swith" | ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Aug 2019 18:18:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-that-extracts-date-and-time-from-the/m-p/431167#M123250</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-08-07T18:18:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a regex that extracts date and time from the description field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-that-extracts-date-and-time-from-the/m-p/431168#M123251</link>
      <description>&lt;P&gt;I'd do it a little more like this personally:  &lt;CODE&gt;rex field=_raw "(?:.+at\s+)(?&amp;lt;time&amp;gt;.*(AM|PM))"&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2019 19:33:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-that-extracts-date-and-time-from-the/m-p/431168#M123251</guid>
      <dc:creator>michael_schmidt</dc:creator>
      <dc:date>2019-08-07T19:33:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a regex that extracts date and time from the description field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-that-extracts-date-and-time-from-the/m-p/431169#M123252</link>
      <description>&lt;P&gt;Try this if you want to have deep analysis based on year,month,date,time etc,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=_raw "at\s+(?&amp;lt;time&amp;gt;(?&amp;lt;month&amp;gt;\w+)\s(?&amp;lt;date&amp;gt;\d+)\s(?&amp;lt;year&amp;gt;\d+)\s(?&amp;lt;hour&amp;gt;\d+)\S(?&amp;lt;minutes&amp;gt;\d*)(?&amp;lt;clock_set&amp;gt;\w\w))\swith"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It will create time ,month,date,year,hour,minutes,clock_set fields&lt;/P&gt;

&lt;P&gt;time as Aug 1 2019 8:01AM , month as Aug, date as 1 , year as 2019 and so on.. Thought this search is costly as it produces more fields, it can be used for analysis/reports etc.. &lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2019 21:22:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-that-extracts-date-and-time-from-the/m-p/431169#M123252</guid>
      <dc:creator>prabhakar_ps</dc:creator>
      <dc:date>2019-08-07T21:22:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a regex that extracts date and time from the description field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-that-extracts-date-and-time-from-the/m-p/431170#M123253</link>
      <description>&lt;P&gt;I am getting error while running the regex:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;       index="xxxxxx" 
        publisher="xxxx" entity="**boot*" 
| rex field=_raw "at\s+(?&amp;lt;time&amp;gt;(?&amp;lt;month&amp;gt;\w+)\s(?&amp;lt;date&amp;gt;\d+)\s(?&amp;lt;year&amp;gt;\d+)\s(?&amp;lt;hour&amp;gt;\d+)\S(?  &amp;lt;minutes&amp;gt;\d*)(?&amp;lt;clock_set&amp;gt;\w\w))\swith"
        event="FAIL-ALERT" 
        state="*"
        |search resource="*"
        |search entity="***"

       |table  state entity resource event description
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Aug 2019 16:02:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-that-extracts-date-and-time-from-the/m-p/431170#M123253</guid>
      <dc:creator>mayank101</dc:creator>
      <dc:date>2019-08-08T16:02:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a regex that extracts date and time from the description field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-that-extracts-date-and-time-from-the/m-p/431171#M123254</link>
      <description>&lt;P&gt;You do have space before minutes,remove those extra spaces.. it should work if your events are same..&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2019 20:07:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-that-extracts-date-and-time-from-the/m-p/431171#M123254</guid>
      <dc:creator>prabhakar_ps</dc:creator>
      <dc:date>2019-08-08T20:07:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a regex that extracts date and time from the description field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-that-extracts-date-and-time-from-the/m-p/431172#M123255</link>
      <description>&lt;P&gt;Hi Prabhakar,&lt;BR /&gt;
My events are different ,I have named them as a,b,c for example purpose :&lt;BR /&gt;
event         description&lt;BR /&gt;
2.  a                 Message: Job failed at  Aug 4 2019 8:01AM with exit code 3 and has been set to success &lt;BR /&gt;
3.  b                 Message: Job failed at Aug 1 2019 8:01AM with exit code 7 and has been set to success&lt;BR /&gt;
4.  c                  Message: Job failed at Aug  2019 8:01AM with exit code 2 and has been set to success &lt;BR /&gt;
5. And so on, many entries...&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2019 20:13:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-that-extracts-date-and-time-from-the/m-p/431172#M123255</guid>
      <dc:creator>mayank101</dc:creator>
      <dc:date>2019-08-08T20:13:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a regex that extracts date and time from the description field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-that-extracts-date-and-time-from-the/m-p/431173#M123256</link>
      <description>&lt;P&gt;Please do add "pipe and search" after rex command, like  below&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;|search event="Fail-Alert" state="**"|table state entity resource event description minutes year month &lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;you have started searching for event="Fail Alert" without any pipe and also it is good to have all search before first pipe itself .. &lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2019 20:34:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-that-extracts-date-and-time-from-the/m-p/431173#M123256</guid>
      <dc:creator>prabhakar_ps</dc:creator>
      <dc:date>2019-08-08T20:34:16Z</dc:date>
    </item>
  </channel>
</rss>

