<?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: Rex field extraction in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Rex-field-extraction/m-p/417969#M168564</link>
    <description>&lt;P&gt;@zacksoft this should work with the sample data you have provided. Following is a run anywhere search based on the data provided:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval data="2018-07-02 08:51:44,648 https-nsse-nio-8663-exec-18 LRQ9923 531x698404x16 1kvc79 99.103.154.114,30.128.209.1 /best/madget/1.0/login The user 'LRQ9923' has PASSED authentication.;2018-07-02 09:18:44,761 https-nsse-nio-8663-exec-90 anonymous 558x723020x25 5lqwk7 88.128.203.123,30.118.254.78 /best/madget/1.0/login The user 'JRA3620' has FAILED authentication. Failure count equals 3;2018-07-02 09:18:44,761 https-nsse-nio-8663-exec-90 anonymous 558x723020x25 5lqwk7 88.128.203.123,30.118.254.78 /best/madget/1.0/login The user 'JRA3620' has FAILED authentication. Failure count equals 4"
| makemv data delim=";"
| mvexpand data
| rename data as _raw
| rex  "user\s+'?(?&amp;lt;user&amp;gt;[^\s']+)'?\shas\s(?&amp;lt;outcome&amp;gt;\S+)\sauthentication.(?:\s+Failure count equals\s+(?&amp;lt;failure_count&amp;gt;\d))?"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 02 Jul 2018 14:41:46 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2018-07-02T14:41:46Z</dc:date>
    <item>
      <title>Rex field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-field-extraction/m-p/417963#M168558</link>
      <description>&lt;OL&gt;
&lt;LI&gt;&lt;P&gt;Could someone help me extract the two bold words from the following sample &lt;BR /&gt;
SAMPLE EVENT 1&lt;BR /&gt;
2018-07-02 08:51:44,648 https-nsse-nio-8663-exec-18 LRQ9923 531x698404x16 1kvc79 99.103.154.114,30.128.209.1 /best/madget/1.0/login The user '&lt;STRONG&gt;LRQ9923&lt;/STRONG&gt;' has &lt;STRONG&gt;PASSED&lt;/STRONG&gt; authentication.&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Could someone help me extract the three bold words from the following sample &lt;BR /&gt;
SAMPLE EVENT 2&lt;BR /&gt;
2018-07-02 09:18:44,761 https-nsse-nio-8663-exec-90 anonymous 558x723020x25 5lqwk7 88.128.203.123,30.118.254.78 /best/madget/1.0/login The user '&lt;STRONG&gt;JRA3620&lt;/STRONG&gt;' has &lt;STRONG&gt;FAILED&lt;/STRONG&gt; authentication.  Failure count equals &lt;STRONG&gt;3&lt;/STRONG&gt;&lt;/P&gt;&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Mon, 02 Jul 2018 13:23:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-field-extraction/m-p/417963#M168558</guid>
      <dc:creator>zacksoft</dc:creator>
      <dc:date>2018-07-02T13:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: Rex field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-field-extraction/m-p/417964#M168559</link>
      <description>&lt;P&gt;Hi @zacksoft,&lt;BR /&gt;
try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|rex "user\s\'(?&amp;lt;User&amp;gt;[^']+)'\shas\s(?&amp;lt;Result&amp;gt;\w+)\sauthentication.*(count\sequals\s(?&amp;lt;Count&amp;gt;\d+))?"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;try it in regex101: &lt;A href="https://regex101.com/r/vtbCOg/1"&gt;https://regex101.com/r/vtbCOg/1&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jul 2018 13:34:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-field-extraction/m-p/417964#M168559</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-07-02T13:34:00Z</dc:date>
    </item>
    <item>
      <title>Re: Rex field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-field-extraction/m-p/417965#M168560</link>
      <description>&lt;P&gt;@493669&lt;BR /&gt;
For the event of following type.&lt;BR /&gt;
It won't give me the 'Failure Count'&lt;/P&gt;

&lt;P&gt;2018-07-02 09:18:44,761 https-nsse-nio-8663-exec-90 anonymous 558x723020x25 5lqwk7 88.128.203.123,30.118.254.78 /best/madget/1.0/login The user 'JRA3620' has FAILED authentication. Failure count equals &lt;STRONG&gt;4&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jul 2018 14:02:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-field-extraction/m-p/417965#M168560</guid>
      <dc:creator>zacksoft</dc:creator>
      <dc:date>2018-07-02T14:02:29Z</dc:date>
    </item>
    <item>
      <title>Re: Rex field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-field-extraction/m-p/417966#M168561</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;user\s+'?(?&amp;lt;user&amp;gt;[^\s']+)'?\shas\s(?&amp;lt;outcome&amp;gt;\S+)\sauthentication.(?:\s+Failure count equals\s+(?&amp;lt;failure_count&amp;gt;\d+))?
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Jul 2018 14:06:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-field-extraction/m-p/417966#M168561</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-07-02T14:06:31Z</dc:date>
    </item>
    <item>
      <title>Re: Rex field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-field-extraction/m-p/417967#M168562</link>
      <description>&lt;P&gt;In the events like the following , it won't give me the Failure Count&lt;/P&gt;

&lt;P&gt;2018-07-02 09:18:44,761 https-nsse-nio-8663-exec-90 anonymous 558x723020x25 5lqwk7 88.128.203.123,30.118.254.78 /best/madget/1.0/login The user 'JRA3620' has FAILED authentication. &lt;STRONG&gt;Failure count equals 4&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jul 2018 14:14:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-field-extraction/m-p/417967#M168562</guid>
      <dc:creator>zacksoft</dc:creator>
      <dc:date>2018-07-02T14:14:40Z</dc:date>
    </item>
    <item>
      <title>Re: Rex field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-field-extraction/m-p/417968#M168563</link>
      <description>&lt;P&gt;Quite correct, I updated my answer.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jul 2018 14:26:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-field-extraction/m-p/417968#M168563</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-07-02T14:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: Rex field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-field-extraction/m-p/417969#M168564</link>
      <description>&lt;P&gt;@zacksoft this should work with the sample data you have provided. Following is a run anywhere search based on the data provided:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval data="2018-07-02 08:51:44,648 https-nsse-nio-8663-exec-18 LRQ9923 531x698404x16 1kvc79 99.103.154.114,30.128.209.1 /best/madget/1.0/login The user 'LRQ9923' has PASSED authentication.;2018-07-02 09:18:44,761 https-nsse-nio-8663-exec-90 anonymous 558x723020x25 5lqwk7 88.128.203.123,30.118.254.78 /best/madget/1.0/login The user 'JRA3620' has FAILED authentication. Failure count equals 3;2018-07-02 09:18:44,761 https-nsse-nio-8663-exec-90 anonymous 558x723020x25 5lqwk7 88.128.203.123,30.118.254.78 /best/madget/1.0/login The user 'JRA3620' has FAILED authentication. Failure count equals 4"
| makemv data delim=";"
| mvexpand data
| rename data as _raw
| rex  "user\s+'?(?&amp;lt;user&amp;gt;[^\s']+)'?\shas\s(?&amp;lt;outcome&amp;gt;\S+)\sauthentication.(?:\s+Failure count equals\s+(?&amp;lt;failure_count&amp;gt;\d))?"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Jul 2018 14:41:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-field-extraction/m-p/417969#M168564</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-07-02T14:41:46Z</dc:date>
    </item>
    <item>
      <title>Re: Rex field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-field-extraction/m-p/417970#M168565</link>
      <description>&lt;P&gt;Thank you @woodcock&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jul 2018 07:56:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-field-extraction/m-p/417970#M168565</guid>
      <dc:creator>zacksoft</dc:creator>
      <dc:date>2018-07-03T07:56:53Z</dc:date>
    </item>
    <item>
      <title>Re: Rex field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-field-extraction/m-p/417971#M168566</link>
      <description>&lt;P&gt;Make sure to change that last &lt;CODE&gt;\d&lt;/CODE&gt; to a &lt;CODE&gt;\d+&lt;/CODE&gt; if the failure count can be higher than 9.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jul 2018 08:03:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-field-extraction/m-p/417971#M168566</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2018-07-03T08:03:38Z</dc:date>
    </item>
    <item>
      <title>Re: Rex field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-field-extraction/m-p/417972#M168567</link>
      <description>&lt;P&gt;Sure @FrankVI&lt;/P&gt;

&lt;P&gt;Would you happen to know any way to automatically generate Splunk rex extraction commands by selecting what fields we want to fetch from the event?&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jul 2018 08:06:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-field-extraction/m-p/417972#M168567</guid>
      <dc:creator>zacksoft</dc:creator>
      <dc:date>2018-07-03T08:06:37Z</dc:date>
    </item>
    <item>
      <title>Re: Rex field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-field-extraction/m-p/417973#M168568</link>
      <description>&lt;P&gt;When you unfold an event in Splunk, there is a button called "Event Actions", which has an action "Extract Fields".&lt;/P&gt;

&lt;P&gt;This brings you to Splunk's Field Extractor GUI, and that does allow you to mark fields in the event and let Splunk generate the regex. You can then either store that as an automatic field extraction, or copy paste the resulting regex into a search query.&lt;/P&gt;

&lt;P&gt;But generally this doesn't really result in the best quality regexes. It is really worthwhile investing a little bit of time in learning how regular expressions work and then writing them yourself, with the help of tools like regex101.com. That way you keep it in your control and don't rely on magic you don't fully understand.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jul 2018 09:19:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-field-extraction/m-p/417973#M168568</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2018-07-03T09:19:17Z</dc:date>
    </item>
    <item>
      <title>Re: Rex field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-field-extraction/m-p/417974#M168569</link>
      <description>&lt;P&gt;Updated again&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jul 2018 12:40:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-field-extraction/m-p/417974#M168569</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-07-03T12:40:40Z</dc:date>
    </item>
  </channel>
</rss>

