<?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: Creating a new field from a default field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Creating-a-new-field-from-a-default-field/m-p/324878#M96898</link>
    <description>&lt;P&gt;Hi olbinado11,&lt;BR /&gt;
try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Caused by:(?&amp;lt;your_field&amp;gt;.*)\sat\scom.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can test it at &lt;A href="https://regex101.com/r/8BdlXU/1"&gt;https://regex101.com/r/8BdlXU/1&lt;/A&gt;&lt;BR /&gt;
Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
    <pubDate>Tue, 25 Jul 2017 08:34:39 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2017-07-25T08:34:39Z</dc:date>
    <item>
      <title>Creating a new field from a default field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-a-new-field-from-a-default-field/m-p/324877#M96897</link>
      <description>&lt;P&gt;MessageText=&lt;BR /&gt;
[2017-07-25T16:29:01.694+10:00]...XXXXXXXXXXXXXXXXXXXXXXXXXX  at com.ofss.fc.app.Interaction.analyzeAndThrowException(Interaction.java:1349) &lt;STRONG&gt;Caused by: com.ofss.fc.framework.exception.BusinessException: No address linkage is maintained for Account ID: 74XX15&lt;/STRONG&gt;140985.** at com.ofss.fc.domain.account.service.action.accountaddresslinkage.AccountAddressLinkageService.fetchAccountAddressLinkage(AccountAddressLinkageService.java:233) ]]&lt;/P&gt;

&lt;P&gt;My goal is to create a new field, "rootcause" where it starts after the string "Caused by: " and ends before the string "at com." I figured rex command will do the trick? I tried field extractor but my searches returns to "no results found". &lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2017 08:30:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-a-new-field-from-a-default-field/m-p/324877#M96897</guid>
      <dc:creator>olbinado11</dc:creator>
      <dc:date>2017-07-25T08:30:34Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new field from a default field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-a-new-field-from-a-default-field/m-p/324878#M96898</link>
      <description>&lt;P&gt;Hi olbinado11,&lt;BR /&gt;
try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Caused by:(?&amp;lt;your_field&amp;gt;.*)\sat\scom.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can test it at &lt;A href="https://regex101.com/r/8BdlXU/1"&gt;https://regex101.com/r/8BdlXU/1&lt;/A&gt;&lt;BR /&gt;
Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2017 08:34:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-a-new-field-from-a-default-field/m-p/324878#M96898</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-07-25T08:34:39Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new field from a default field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-a-new-field-from-a-default-field/m-p/324879#M96899</link>
      <description>&lt;P&gt;|rex field=MessageText "\Caused by:(?.*)\sat\scom."&lt;/P&gt;

&lt;P&gt;Unfortunately not working.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jul 2017 01:25:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-a-new-field-from-a-default-field/m-p/324879#M96899</guid>
      <dc:creator>olbinado11</dc:creator>
      <dc:date>2017-07-26T01:25:35Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new field from a default field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-a-new-field-from-a-default-field/m-p/324880#M96900</link>
      <description>&lt;P&gt;@olbinado11, post your data and current rex command using the code button so that special characters do not escape/get omitted in the post.&lt;/P&gt;

&lt;P&gt;In case your event has new line character after each line you will have to &lt;STRONG&gt;use (?s) in the rex command so that DOT (.) matches newline characters as well&lt;/STRONG&gt; i.e. &lt;CODE&gt;| rex field=Message "(?s)Caused by:(?&amp;lt;myField&amp;gt;.*)\sat\s"&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval Message="[2017-07-25T16:29:01.694+10:00]...XXXXXXXXXXXXXXXXXXXXXXXXXX at com.ofss.fc.app.Interaction.analyzeAndThrowException(Interaction.java:1349) **Caused by: com.ofss.fc.framework.exception.BusinessException: No address linkage is maintained for Account ID: 74XX15*140985.* at com.ofss.fc.domain.account.service.action.accountaddresslinkage.AccountAddressLinkageService.fetchAccountAddressLinkage(AccountAddressLinkageService.java:233) ]]"
| rex field=Message "Caused by:(?&amp;lt;myField&amp;gt;.*)\sat\s"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Also, have you extracted Message field already and ensured that the sample data is being reflected when you use &lt;CODE&gt;| table Message&lt;/CODE&gt; command? If not change rex to process on &lt;STRONG&gt;_raw&lt;/STRONG&gt; instead of &lt;STRONG&gt;Message&lt;/STRONG&gt; field i.e.  &lt;CODE&gt;| rex field=_raw "Caused by:(?&amp;lt;myField&amp;gt;.*)\sat\s"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;PS: Rex should only be used for testing. You should ideally be creating Field Extractions (better using Splunk's Interactive Field Extraction IFX : &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/ExtractfieldsinteractivelywithIFX"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/ExtractfieldsinteractivelywithIFX&lt;/A&gt;)&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jul 2017 04:34:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-a-new-field-from-a-default-field/m-p/324880#M96900</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-07-26T04:34:52Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new field from a default field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-a-new-field-from-a-default-field/m-p/324881#M96901</link>
      <description>&lt;P&gt;strange, in regex101 is working! &lt;BR /&gt;
&lt;A href="https://regex101.com/r/8BdlXU/3"&gt;https://regex101.com/r/8BdlXU/3&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;did you tried?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your_search
| rex "(?s)Caused by:(?&amp;lt;rootcause&amp;gt;.*)\sat\scom."
| ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jul 2017 07:40:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-a-new-field-from-a-default-field/m-p/324881#M96901</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-07-26T07:40:39Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new field from a default field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-a-new-field-from-a-default-field/m-p/324882#M96902</link>
      <description>&lt;P&gt;@niketnilay, &lt;/P&gt;

&lt;P&gt;| rex field=_raw "Caused by:(?.*)\sat\s" still  does not give me the result i need..&lt;/P&gt;

&lt;P&gt;however after playing around with what you have shared.. i come up with this...&lt;/P&gt;

&lt;P&gt;|rex field=MessageText "\Caused by:(?.*)\s..."&lt;/P&gt;

&lt;P&gt;i feel that the above \ before Caused and the ... after \s did the charm.. but no idea how.&lt;/P&gt;

&lt;P&gt;I am sorry for asking this but can you explain how it worked?&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jul 2017 08:17:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-a-new-field-from-a-default-field/m-p/324882#M96902</guid>
      <dc:creator>olbinado11</dc:creator>
      <dc:date>2017-07-26T08:17:07Z</dc:date>
    </item>
  </channel>
</rss>

