<?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 to extract null/empty field as it has values in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/REGEX-to-extract-null-empty-field-as-it-has-values/m-p/255143#M189435</link>
    <description>&lt;P&gt;Are those fixed length fields ?&lt;/P&gt;

&lt;P&gt;Take a look at this,&lt;/P&gt;

&lt;P&gt;&lt;IMG src="http://s21.postimg.org/d9ai4tngn/parsing.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;Edit: regex added&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;main search | rex field=_raw "\d{2}\/\d{2}\/\d{2}\s\d{2}:\d{2}:\d{2}\s(?&amp;lt;A_TEMP&amp;gt;.*?)\sOK" | rex field=A_TEMP "(?&amp;lt;a_group1&amp;gt;.{4})\s(?&amp;lt;a_group2&amp;gt;.{8})\s(?&amp;lt;a_group3&amp;gt;.{7})\s+(?&amp;lt;a_group4&amp;gt;.{3})\s+(?&amp;lt;a_group5&amp;gt;.*?)\s+(?&amp;lt;a_group6&amp;gt;.*)" | table _time a_group1 a_group2 a_group3 a_group4 a_group5 a_group6
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 18 Mar 2016 20:54:29 GMT</pubDate>
    <dc:creator>alemarzu</dc:creator>
    <dc:date>2016-03-18T20:54:29Z</dc:date>
    <item>
      <title>REGEX to extract null/empty field as it has values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/REGEX-to-extract-null-empty-field-as-it-has-values/m-p/255140#M189432</link>
      <description>&lt;P&gt;Hello folks,&lt;/P&gt;

&lt;P&gt;I was wondering if you could help me with an issue regarding to the field extraction technique.&lt;BR /&gt;
I have this multiline log (below).  My problem is that when I trying to extract the empty fields at the same time as the valued ones.&lt;/P&gt;

&lt;P&gt;This is my LOG:&lt;/P&gt;

&lt;P&gt;14/03/16 06:02:03 VSED CRPDRETR RETRANS  B F    XCOMJOB                      OK+A      P $IJDPRT                      02014&lt;BR /&gt;
 14/03/16 06:02:03 VSED CRPDRETR RETRANS  B F    XCOMJOB                      OK+A      P ISTMMCHS                     02014&lt;BR /&gt;
 14/03/16 06:02:03 VSED CRPDRETR RETRANS  B F    XCOMJOB  &lt;STRONG&gt;WRITE    ALL&lt;/STRONG&gt;        OK+A      D OPE294 VCIP3.SORTWK1.F4      02014&lt;BR /&gt;
 14/03/16 06:02:03 VSED CRPDRETR RETRANS  B F    XCOMJOB  &lt;STRONG&gt;READ&lt;/STRONG&gt;                OK+A      ? PRD2.XCOM310.C230FI02.CONFI  02014&lt;BR /&gt;
 14/03/16 06:02:03 VSED CRPDRETR RETRANS  B F    XCOMJOB  READ                OK+A      ? PRD2.XCOM310.C230FI02.CONFI  02014&lt;BR /&gt;
 14/03/16 06:02:03 VSED CRPDRETR RETRANS  B F    XCOMJOB  READ                OK+A      ? PRD2.XCOM310.DESTMODE.CONFI  02014&lt;BR /&gt;
 14/03/16 06:02:03 VSED CRPDRETR RETRANS  B F    XCOMJOB  READ                OK+A      ? PRD2.XCOM310.DESTMODE.CONFI  02014&lt;BR /&gt;
 14/03/16 06:02:03 VSED CRPDRETR RETRANS  B F    XCOMJOB                      OK+A      P IJDANCHX                     02014&lt;BR /&gt;
 14/03/16 06:02:03 VSED CRPDRETR RETRANS  B F    $JOBACCT                     OK+A      P IESWAIT                      02014&lt;BR /&gt;
 14/03/16 06:04:03 VSED CRPDRETR RETRANS  B F    $JOBACCT                     OK+A  TRM                                02014&lt;BR /&gt;
 14/03/16 08:17:04 VSED CRPDRETR DUMMY    B F    $JOBACCT READ                OK+A      q SUBMIT.VCIP3.RETRANS.CRPDRE  43327&lt;BR /&gt;
 14/03/16 08:17:04 VSED CRPDRETR RETRANS  B F    $JOBACCT                     OK+A      T VMRDR00C                     43327 VMRDR00C&lt;BR /&gt;
 14/03/16 08:17:04 VSED CRPDRETR RETRANS  B F    $JOBACCT READ                OK+A      e VMRDR00C                     43327 VMRDR00C&lt;BR /&gt;
 14/03/16 08:17:04 VSED CRPDRETR RETRANS  B F    $JOBACCT                     OK+A  VFX                                43327 VMRDR00C&lt;BR /&gt;
 14/03/16 08:17:04 VSED CRPDRETR RETRANS  B F    $JOBACCT                     OK+A      , VSED                         43327&lt;BR /&gt;
 14/03/16 08:17:04 VSED CRPDRETR RETRANS  B F    $JOBACCT                     OK+A      U CPU.VSED                     43327&lt;BR /&gt;
 14/03/16 08:17:04 VSED CRPDRETR RETRANS  B F    $JOBACCT                     OK+A      ? F3                           43327&lt;BR /&gt;
 14/03/16 08:17:04 VSED CRPDRETR RETRANS  B F    $JOBACCT                     OK+A      U VSEPART.                     43327&lt;BR /&gt;
 14/03/16 08:17:04 VSED CRPDRETR RETRANS  B F    $JOBACCT READ                OK+A      e VMRDR00C                     43327&lt;BR /&gt;
 14/03/16 08:17:04 VSED CRPDRETR RETRANS  B F    $JOBACCT                     OK+A  INI   NAME=TRANSM/USO COMUN        43327&lt;BR /&gt;
 14/03/16 08:17:04 VSED CRPDRETR RETRANS  B F    $JOBACCT READ                OK+A      ? PRD2.CONFIG.SETXCOM.PROC     43327&lt;/P&gt;

&lt;P&gt;What I'm trying to do is to extract, for example, in the first row Column1=&lt;STRONG&gt;WRITE&lt;/STRONG&gt; and Column2=&lt;STRONG&gt;ALL&lt;/STRONG&gt; and so on.... With empty values or not.&lt;/P&gt;

&lt;P&gt;Here's my current REGEX:&lt;BR /&gt;
(\d+\/\d+\/\d+\s\d+:\d+:\d+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+\s+[^\s]+)\s+([^\s]+)&lt;STRONG&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="\s+"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/1155i8D3966EE6FE946C0/image-size/large?v=v2&amp;amp;px=999" role="button" title="\s+" alt="\s+" /&gt;&lt;/span&gt;&lt;/STRONG&gt;([^\s]+)&lt;/P&gt;

&lt;P&gt;As you can see in the image attached when is use the final \s+ the matches for 'spaces' breaks my entire formula. (See image)&lt;BR /&gt;
I'm using regex101 site to test this.&lt;/P&gt;

&lt;P&gt;Any help is welcome!&lt;BR /&gt;
Best regards,&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2016 19:35:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/REGEX-to-extract-null-empty-field-as-it-has-values/m-p/255140#M189432</guid>
      <dc:creator>larmesto</dc:creator>
      <dc:date>2016-03-18T19:35:52Z</dc:date>
    </item>
    <item>
      <title>Re: REGEX to extract null/empty field as it has values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/REGEX-to-extract-null-empty-field-as-it-has-values/m-p/255141#M189433</link>
      <description>&lt;P&gt;In your screenshot, that file looks to be tab delimited? would matching based on individual tab characters instead of any number of whitespace characters help?&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2016 20:22:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/REGEX-to-extract-null-empty-field-as-it-has-values/m-p/255141#M189433</guid>
      <dc:creator>acharlieh</dc:creator>
      <dc:date>2016-03-18T20:22:35Z</dc:date>
    </item>
    <item>
      <title>Re: REGEX to extract null/empty field as it has values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/REGEX-to-extract-null-empty-field-as-it-has-values/m-p/255142#M189434</link>
      <description>&lt;P&gt;Thanks acharlieh&lt;BR /&gt;
I've tryed this, but is not tab delimited.  I believe the only option is to parse with static positions...&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2016 20:49:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/REGEX-to-extract-null-empty-field-as-it-has-values/m-p/255142#M189434</guid>
      <dc:creator>larmesto</dc:creator>
      <dc:date>2016-03-18T20:49:11Z</dc:date>
    </item>
    <item>
      <title>Re: REGEX to extract null/empty field as it has values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/REGEX-to-extract-null-empty-field-as-it-has-values/m-p/255143#M189435</link>
      <description>&lt;P&gt;Are those fixed length fields ?&lt;/P&gt;

&lt;P&gt;Take a look at this,&lt;/P&gt;

&lt;P&gt;&lt;IMG src="http://s21.postimg.org/d9ai4tngn/parsing.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;Edit: regex added&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;main search | rex field=_raw "\d{2}\/\d{2}\/\d{2}\s\d{2}:\d{2}:\d{2}\s(?&amp;lt;A_TEMP&amp;gt;.*?)\sOK" | rex field=A_TEMP "(?&amp;lt;a_group1&amp;gt;.{4})\s(?&amp;lt;a_group2&amp;gt;.{8})\s(?&amp;lt;a_group3&amp;gt;.{7})\s+(?&amp;lt;a_group4&amp;gt;.{3})\s+(?&amp;lt;a_group5&amp;gt;.*?)\s+(?&amp;lt;a_group6&amp;gt;.*)" | table _time a_group1 a_group2 a_group3 a_group4 a_group5 a_group6
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Mar 2016 20:54:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/REGEX-to-extract-null-empty-field-as-it-has-values/m-p/255143#M189435</guid>
      <dc:creator>alemarzu</dc:creator>
      <dc:date>2016-03-18T20:54:29Z</dc:date>
    </item>
    <item>
      <title>Re: REGEX to extract null/empty field as it has values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/REGEX-to-extract-null-empty-field-as-it-has-values/m-p/255144#M189436</link>
      <description>&lt;P&gt;Give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(\d+\/\d+\/\d+\s\d+:\d+:\d+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+\s+[^\s]+)\s+([^\s]+)\s+(.*)\s*OK\+A\s+([^\s]+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Updated&lt;/STRONG&gt; &lt;BR /&gt;
Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(\d+\/\d+\/\d+\s\d+:\d+:\d+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+\s+[^\s]+)\s+([^\s]+)\s+(.*)\s*(OK\S*)\s+(\S+)\s+(.+\s+)+(\S+)$
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Mar 2016 21:11:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/REGEX-to-extract-null-empty-field-as-it-has-values/m-p/255144#M189436</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-03-18T21:11:12Z</dc:date>
    </item>
    <item>
      <title>Re: REGEX to extract null/empty field as it has values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/REGEX-to-extract-null-empty-field-as-it-has-values/m-p/255145#M189437</link>
      <description>&lt;P&gt;Thanks for your reply.  The problem is that I need to use only plain regex for extraction because I'm using the props.conf file to achive this, before any use of search &amp;amp; reporting app.&lt;/P&gt;

&lt;P&gt;regards,&lt;/P&gt;</description>
      <pubDate>Mon, 21 Mar 2016 15:25:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/REGEX-to-extract-null-empty-field-as-it-has-values/m-p/255145#M189437</guid>
      <dc:creator>larmesto</dc:creator>
      <dc:date>2016-03-21T15:25:32Z</dc:date>
    </item>
    <item>
      <title>Re: REGEX to extract null/empty field as it has values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/REGEX-to-extract-null-empty-field-as-it-has-values/m-p/255146#M189438</link>
      <description>&lt;P&gt;Hi somesoni2,&lt;BR /&gt;
Thanks for your reply. I've give that regex a try but It only works for some lines.&lt;BR /&gt;
&lt;IMG src="http://3.1m.yt/BI-U909.jpg" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;Regards, &lt;/P&gt;</description>
      <pubDate>Mon, 21 Mar 2016 15:32:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/REGEX-to-extract-null-empty-field-as-it-has-values/m-p/255146#M189438</guid>
      <dc:creator>larmesto</dc:creator>
      <dc:date>2016-03-21T15:32:03Z</dc:date>
    </item>
    <item>
      <title>Re: REGEX to extract null/empty field as it has values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/REGEX-to-extract-null-empty-field-as-it-has-values/m-p/255147#M189439</link>
      <description>&lt;P&gt;Somesoni's regex should work, the problem was your data sample, all the records ended with "OK+A" but it looks like not after all.&lt;/P&gt;

&lt;P&gt;So, you have to change/remove &lt;CODE&gt;\+A\s+&lt;/CODE&gt;after the OK from the regular expresion.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Mar 2016 16:49:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/REGEX-to-extract-null-empty-field-as-it-has-values/m-p/255147#M189439</guid>
      <dc:creator>alemarzu</dc:creator>
      <dc:date>2016-03-21T16:49:25Z</dc:date>
    </item>
  </channel>
</rss>

