<?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 extract fields from a field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-a-field/m-p/281738#M85023</link>
    <description>&lt;P&gt;Hi Sundareshr,&lt;/P&gt;

&lt;P&gt;You saved my bacon..... again!  Many many thanks!!!&lt;/P&gt;</description>
    <pubDate>Wed, 27 Jul 2016 15:51:31 GMT</pubDate>
    <dc:creator>dbcase</dc:creator>
    <dc:date>2016-07-27T15:51:31Z</dc:date>
    <item>
      <title>How to extract fields from a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-a-field/m-p/281729#M85014</link>
      <description>&lt;P&gt;Hi,  &lt;/P&gt;

&lt;P&gt;I have a field defined as &lt;STRONG&gt;message_text&lt;/STRONG&gt; and it has entries like the below.  It also has other entries that differ substantially from the example below.  I'd like to extract the Remote IP Address, Session Id, and the credentials into other fields.  Is this possible?&lt;/P&gt;

&lt;P&gt;Relevant example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;message_text
    fn.webapp.listener.AuthenticationListener - Authentication event AuthenticationFailureBadCredentialsEvent: shahzadrazi; details: RemoteIpAddress: 111.88.102.145; SessionId: null; exception: Bad credential; nested exception is org.springframework.security.BadCredentialsException: Bad credential
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Non-relevant examples:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;message_text
    fn.ichealthcheck.servlet.ServerStatusServlet - Exiting doGet of ServerStatusServlet: 5 milliseconds

message_text
    org.jivesoftware.util.Log - SENT: &amp;lt;iq uri="/hb" type="result" id="1469534584" to="1003952@xmpp/0876ff2947cb"/
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Jul 2016 00:33:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-a-field/m-p/281729#M85014</guid>
      <dc:creator>dbcase</dc:creator>
      <dc:date>2016-07-27T00:33:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields from a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-a-field/m-p/281730#M85015</link>
      <description>&lt;P&gt;Try like this&lt;/P&gt;

&lt;P&gt;*&lt;STRONG&gt;&lt;EM&gt;UPDATED&lt;/EM&gt;&lt;/STRONG&gt;*&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.... | rex field=message_text "AuthenticationFailureBadCredentialsEvent:\s(?&amp;lt;credentials&amp;gt;[^\;]+)" | rex field=message_text "RemoteIpAddress:\s(?&amp;lt;RemoteIPAddress&amp;gt;[^\;]+)" | rex field=message_text "SessionId:\s(?&amp;lt;SessionId&amp;gt;[^\;]+)" | table credentials RemoteIPAddress SessionId
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Jul 2016 00:43:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-a-field/m-p/281730#M85015</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-07-27T00:43:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields from a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-a-field/m-p/281731#M85016</link>
      <description>&lt;P&gt;The command that you need to do this ad-hoc is &lt;CODE&gt;rex&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.4.2/SearchReference/Rex"&gt;http://docs.splunk.com/Documentation/Splunk/6.4.2/SearchReference/Rex&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;You might use it like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex field=message_text "RemoteIpAddress:\s*(?&amp;lt;RemoteIpAddress&amp;gt;[^\s;]+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Jul 2016 00:46:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-a-field/m-p/281731#M85016</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-07-27T00:46:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields from a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-a-field/m-p/281732#M85017</link>
      <description>&lt;P&gt;Your comment looks like it should work but I'm getting an odd error.....  &lt;/P&gt;

&lt;P&gt;Here is the query&lt;BR /&gt;
index=wls sourcetype=wls_managedserver | rex field=message_text "AuthenticationFailureBadCredentialsEvent:\s(?[^\;]+) | rex field=message_text "RemoteIpAddress:\s(?[^\;]+) | rex field=message_text "SessionId:\s(?[^\;]+) | table credentials RemoteIPAddress SessionId&lt;/P&gt;

&lt;P&gt;The error I'm getting is &lt;BR /&gt;
Error in 'SearchParser': Missing a search command before '^'. Error at position '217' of search query 'search index=wls sourcetype=wls_managedserver bea_...{snipped} {errorcontext = PAddress&amp;gt;[^\;]+) | re}'.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 10:22:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-a-field/m-p/281732#M85017</guid>
      <dc:creator>dbcase</dc:creator>
      <dc:date>2020-09-29T10:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields from a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-a-field/m-p/281733#M85018</link>
      <description>&lt;P&gt;I have a suspicion, you are missing a &lt;CODE&gt;&amp;lt;&lt;/CODE&gt; before IPAddress in the rex command for IPAddress.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; .... | rex field=message_text "AuthenticationFailureBadCredentialsEvent:\s(?&amp;lt;credentials&amp;gt;[^\;]+) | rex field=message_text "RemoteIpAddress:\s(?&amp;lt;RemoteIPAddress&amp;gt;[^\;]+) | rex field=message_text "SessionId:\s(?&amp;lt;SessionId&amp;gt;[^\;]+) | table credentials RemoteIPAddress SessionId
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Jul 2016 02:16:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-a-field/m-p/281733#M85018</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-07-27T02:16:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields from a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-a-field/m-p/281734#M85019</link>
      <description>&lt;P&gt;Hmmm ok, I feel like an idiot &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;   I can't seem to figure out what you are trying to tell me (sorry for the hard-headed-ness).   Here is my current query (well really yours &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;  )&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=wls sourcetype=wls_managedserver | rex field=message_text "AuthenticationFailureBadCredentialsEvent:\s(?[^\;]+) | rex field=message_text "RemoteIpAddress:\s(?[^\;]+) | rex field=message_text "SessionId:\s(?[^\;]+) | table credentials RemoteIPAddress SessionId
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Still getting that error in SearchParser message&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2016 02:41:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-a-field/m-p/281734#M85019</guid>
      <dc:creator>dbcase</dc:creator>
      <dc:date>2016-07-27T02:41:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields from a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-a-field/m-p/281735#M85020</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;index=wls sourcetype=wls_managedserver | rex field=message_text "AuthenticationFailureBadCredentialsEvent:\s(?&amp;lt; credentials &amp;gt;[^\;]+) | rex field=message_text "RemoteIpAddress:\s(?&amp;lt; RemoteIPAddress &amp;gt;[^\;]+) | rex field=message_text "SessionId:\s(?&amp;lt; SessionId &amp;gt;[^\;]+) | table credentials RemoteIPAddress SessionId
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Jul 2016 02:44:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-a-field/m-p/281735#M85020</guid>
      <dc:creator>dbcase</dc:creator>
      <dc:date>2016-07-27T02:44:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields from a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-a-field/m-p/281736#M85021</link>
      <description>&lt;P&gt;I think I know what wrong. Try the updated version&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2016 02:45:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-a-field/m-p/281736#M85021</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-07-27T02:45:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields from a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-a-field/m-p/281737#M85022</link>
      <description>&lt;P&gt;I put spaces around each rex field so it would show up&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2016 02:45:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-a-field/m-p/281737#M85022</guid>
      <dc:creator>dbcase</dc:creator>
      <dc:date>2016-07-27T02:45:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields from a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-a-field/m-p/281738#M85023</link>
      <description>&lt;P&gt;Hi Sundareshr,&lt;/P&gt;

&lt;P&gt;You saved my bacon..... again!  Many many thanks!!!&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2016 15:51:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-a-field/m-p/281738#M85023</guid>
      <dc:creator>dbcase</dc:creator>
      <dc:date>2016-07-27T15:51:31Z</dc:date>
    </item>
  </channel>
</rss>

