<?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: Help with field extraction in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-with-field-extraction/m-p/339361#M100625</link>
    <description>&lt;P&gt;As you said result is optional, so your some events are ending with pipe? If yes then above and  @harsmarvania57 will work for both kind of events. But if it is not ending with pipe then I suggest you to extract &lt;CODE&gt;result&lt;/CODE&gt; seperately.&lt;/P&gt;

&lt;P&gt;you can try &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=_raw  "(?&amp;lt;DateTime&amp;gt;\w{3}\s\d{2}\s\d{2}:\d{2}:\d{2})\s(?&amp;lt;src_ip&amp;gt;\d+\.\d+\.\d+\.\d+)\s(?&amp;lt;src_user&amp;gt;[^\(]+)\s\((?&amp;lt;src_userupn&amp;gt;[^\)]+)\)\|(?&amp;lt;message&amp;gt;[^\)]*\)')"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And for result &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=_raw ".*\|(?&amp;lt;Result&amp;gt;.*)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;let me know if this helps!&lt;/P&gt;</description>
    <pubDate>Tue, 30 Jan 2018 16:51:20 GMT</pubDate>
    <dc:creator>mayurr98</dc:creator>
    <dc:date>2018-01-30T16:51:20Z</dc:date>
    <item>
      <title>Help with field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-field-extraction/m-p/339357#M100621</link>
      <description>&lt;P&gt;I'm failing miserably at this. I'm hoping someone can help me out so I can build my knowledge for future extractions&lt;/P&gt;

&lt;P&gt;I'm getting the following record from an application, via syslog and need to perform field extractions:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;Jan 30 08:50:14 8.8.8.8 Smith, Jim (Jim.Smith@Domain.com)|Run PowerShell script 'Add Record to DB' for 'Smith, Jim (Domain.local\Users )'|Success&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Where:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Jan 30 08:50:14 (DateTime)
8.8.8.8 (src_ip)
Smith, Jim (src_user)
Jim.Smith@Domain.com (src_userupn)
Run PowerShell script 'Add Record to DB' for 'Smith, Jim (Canada.CompassGroup.Corp\Users - Compass)' (message)
Success (Result)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Result is optional and may not be in each record, depending on what the message is.&lt;/P&gt;

&lt;P&gt;Any regex gurus out there that can help me out?&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2018 14:21:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-field-extraction/m-p/339357#M100621</guid>
      <dc:creator>mcollins42</dc:creator>
      <dc:date>2018-01-30T14:21:17Z</dc:date>
    </item>
    <item>
      <title>Re: Help with field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-field-extraction/m-p/339358#M100622</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/67061"&gt;@mcollins42&lt;/a&gt;&lt;/P&gt;

&lt;P&gt;please try below &lt;/P&gt;

&lt;P&gt;your base search | rex field=_raw "(?P&amp;lt;DateTime&amp;gt;\S+\s+\d+\s+\d+:\d+:\d+)\s+(?P&amp;lt;src_ip&amp;gt;\d+.\d+.\d+.\d+)\s+(?P&amp;lt;src_user&amp;gt;[^(]+)((?P&amp;lt;src_userupn&amp;gt;\S+))|(?P&amp;lt;message&amp;gt;[^|]+)(?P&amp;lt;Result&amp;gt;(|\S+|))"&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:52:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-field-extraction/m-p/339358#M100622</guid>
      <dc:creator>sbbadri</dc:creator>
      <dc:date>2020-09-29T17:52:20Z</dc:date>
    </item>
    <item>
      <title>Re: Help with field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-field-extraction/m-p/339359#M100623</link>
      <description>&lt;P&gt;Hi @mcollins42,&lt;/P&gt;

&lt;P&gt;Can you please try this ?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;yourBasesearch&amp;gt; | rex "(?&amp;lt;DateTime&amp;gt;.*)\s(?&amp;lt;src_ip&amp;gt;\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\s(?&amp;lt;src_user&amp;gt;[^\(]*)\s\((?&amp;lt;userupn&amp;gt;[^\)]*)\)\|(?&amp;lt;message&amp;gt;[^\|]*)\|(?&amp;lt;Result&amp;gt;.*)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Jan 2018 16:11:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-field-extraction/m-p/339359#M100623</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2018-01-30T16:11:41Z</dc:date>
    </item>
    <item>
      <title>Re: Help with field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-field-extraction/m-p/339360#M100624</link>
      <description>&lt;P&gt;Hey @mcollins42&lt;/P&gt;

&lt;P&gt;Try this run anywhere search &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval _raw="Jan 30 08:50:14 8.8.8.8 Smith, Jim (Jim.Smith@Domain.com)|Run PowerShell script 'Add Record to DB' for 'Smith, Jim (Domain.local\Users )'|Success" | rex field=_raw "(?&amp;lt;DateTime&amp;gt;\w{3}\s\d{2}\s\d{2}:\d{2}:\d{2})\s(?&amp;lt;src_ip&amp;gt;\d+\.\d+\.\d+\.\d+)\s(?&amp;lt;src_user&amp;gt;[^\(]+)\s\((?&amp;lt;src_userupn&amp;gt;[^\)]+)\)\|(?&amp;lt;message&amp;gt;[^\)]*\)')\|(?&amp;lt;Result&amp;gt;.*)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;let me know if this helps!&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2018 16:46:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-field-extraction/m-p/339360#M100624</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-01-30T16:46:04Z</dc:date>
    </item>
    <item>
      <title>Re: Help with field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-field-extraction/m-p/339361#M100625</link>
      <description>&lt;P&gt;As you said result is optional, so your some events are ending with pipe? If yes then above and  @harsmarvania57 will work for both kind of events. But if it is not ending with pipe then I suggest you to extract &lt;CODE&gt;result&lt;/CODE&gt; seperately.&lt;/P&gt;

&lt;P&gt;you can try &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=_raw  "(?&amp;lt;DateTime&amp;gt;\w{3}\s\d{2}\s\d{2}:\d{2}:\d{2})\s(?&amp;lt;src_ip&amp;gt;\d+\.\d+\.\d+\.\d+)\s(?&amp;lt;src_user&amp;gt;[^\(]+)\s\((?&amp;lt;src_userupn&amp;gt;[^\)]+)\)\|(?&amp;lt;message&amp;gt;[^\)]*\)')"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And for result &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=_raw ".*\|(?&amp;lt;Result&amp;gt;.*)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;let me know if this helps!&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2018 16:51:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-field-extraction/m-p/339361#M100625</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-01-30T16:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: Help with field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-field-extraction/m-p/339362#M100626</link>
      <description>&lt;P&gt;Great example!  Separating "Result" into another extraction was a great idea.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2018 13:52:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-field-extraction/m-p/339362#M100626</guid>
      <dc:creator>mcollins42</dc:creator>
      <dc:date>2018-01-31T13:52:10Z</dc:date>
    </item>
    <item>
      <title>Re: Help with field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-field-extraction/m-p/339363#M100627</link>
      <description>&lt;P&gt;No need to write 2 rex you can achieve same in single rex only, you will not get any output in &lt;CODE&gt;Result&lt;/CODE&gt; field but field will be created with no data.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;yourBasesearch&amp;gt; 
| rex "(?&amp;lt;DateTime&amp;gt;.*)\s(?&amp;lt;src_ip&amp;gt;\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\s(?&amp;lt;src_user&amp;gt;[^\(]*)\s\((?&amp;lt;userupn&amp;gt;[^\)]*)\)\|(?&amp;lt;message&amp;gt;[^\|]*)\|?(?&amp;lt;Result&amp;gt;.*)?"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 31 Jan 2018 14:10:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-field-extraction/m-p/339363#M100627</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2018-01-31T14:10:40Z</dc:date>
    </item>
  </channel>
</rss>

