<?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: Unable to get substring from the splunk log in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Unable-to-get-substring-from-the-splunk-log/m-p/499057#M139011</link>
    <description>&lt;P&gt;@gcusello Same only.&lt;/P&gt;</description>
    <pubDate>Mon, 23 Mar 2020 14:37:51 GMT</pubDate>
    <dc:creator>karthi25</dc:creator>
    <dc:date>2020-03-23T14:37:51Z</dc:date>
    <item>
      <title>Unable to get substring from the splunk log</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Unable-to-get-substring-from-the-splunk-log/m-p/499053#M139007</link>
      <description>&lt;P&gt;I have an requirement to get only the exception related substring from the splunk log,&lt;BR /&gt;
My log will be in the following format:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;fetching records from AAA table
creating event to send to sqs
Publishing to SQS
Large-payload support enabled.
Exception occurred while processing rules for Feed name AAA. Skipping Exception
com.amazonaws.services.sqs.model.QueueDoesNotExistException: The specified queue does not exist for this wsdl version. (Service: AmazonSQS; Status Code: 400; Error Code: AWS.SimpleQueueService.NonExistentQueue; Request ID: xxxx)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleErrorResponse(AmazonHttpClient.java:1640)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1304)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1058)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:743)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:717)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:699)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:667)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:649)
    .....
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now I want to get only the part of exception from above log like&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Exception occurred while processing rules for Feed name AAA. Skipping Exception com.amazonaws.services.sqs.model.QueueDoesNotExistException
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have tried the below query : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=***  source=*** *Exception* | rex field=_raw "\(Exception occurred while processing rules for Feed name (?&amp;lt;myField&amp;gt;[^\)]:*)\)\("
 | table myField
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But it returns empty result. Can anyone please suggest me the right solution for it.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Mar 2020 13:32:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Unable-to-get-substring-from-the-splunk-log/m-p/499053#M139007</guid>
      <dc:creator>karthi25</dc:creator>
      <dc:date>2020-03-23T13:32:32Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to get substring from the splunk log</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Unable-to-get-substring-from-the-splunk-log/m-p/499054#M139008</link>
      <description>&lt;P&gt;Hi @karthi25,&lt;BR /&gt;
if you want all the message:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Exception occurred while processing rules for Feed name AAA. Skipping Exception com.amazonaws.services.sqs.model.QueueDoesNotExistException
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;try this regex&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; (?ms)(?&amp;lt;my_field&amp;gt;Exception occurred while processing rules for [^:]+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;that you can test at &lt;A href="https://regex101.com/r/qotuBa/1"&gt;https://regex101.com/r/qotuBa/1&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;If instead, you fon't want the first part of the message, you have to move the part that you don't want in my_field before the parenthesis&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?ms)Exception occurred while processing rules for (?&amp;lt;my_field&amp;gt;[^:]+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 23 Mar 2020 13:53:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Unable-to-get-substring-from-the-splunk-log/m-p/499054#M139008</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-03-23T13:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to get substring from the splunk log</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Unable-to-get-substring-from-the-splunk-log/m-p/499055#M139009</link>
      <description>&lt;P&gt;@gcusello Thanks for your reply. I have tried yours , it's throwing me error as below&lt;BR /&gt;
Error in 'SearchParser': Missing a search command before '('. Error at position '58' of search query 'search index=*** source=*** &lt;EM&gt;Exce...{snipped} {errorcontext = ception&lt;/EM&gt; |(?ms)(?&lt;/P&gt;</description>
      <pubDate>Mon, 23 Mar 2020 14:00:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Unable-to-get-substring-from-the-splunk-log/m-p/499055#M139009</guid>
      <dc:creator>karthi25</dc:creator>
      <dc:date>2020-03-23T14:00:09Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to get substring from the splunk log</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Unable-to-get-substring-from-the-splunk-log/m-p/499056#M139010</link>
      <description>&lt;P&gt;Hi @karthi25,&lt;BR /&gt;
what'ss the search you used?&lt;/P&gt;

&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=***  source=*** *Exception* 
| rex field=_raw "(?ms)(?&amp;lt;my_field&amp;gt;Exception occurred while processing rules for [^:]+)"
| table myField
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 23 Mar 2020 14:16:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Unable-to-get-substring-from-the-splunk-log/m-p/499056#M139010</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-03-23T14:16:34Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to get substring from the splunk log</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Unable-to-get-substring-from-the-splunk-log/m-p/499057#M139011</link>
      <description>&lt;P&gt;@gcusello Same only.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Mar 2020 14:37:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Unable-to-get-substring-from-the-splunk-log/m-p/499057#M139011</guid>
      <dc:creator>karthi25</dc:creator>
      <dc:date>2020-03-23T14:37:51Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to get substring from the splunk log</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Unable-to-get-substring-from-the-splunk-log/m-p/499058#M139012</link>
      <description>&lt;P&gt;Hi @karthi25,&lt;BR /&gt;
where are you using this search: in Search form or in a dashboard?&lt;BR /&gt;
try it in the Search form.&lt;/P&gt;

&lt;P&gt;If you want to use it in a dashboard you have to modify the &lt;CODE&gt;&amp;lt;&amp;gt;&lt;/CODE&gt; chars in:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"&amp;lt;" becames "&amp;amp;lt;"
"&amp;gt;" becames "&amp;amp;gt;"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 23 Mar 2020 14:57:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Unable-to-get-substring-from-the-splunk-log/m-p/499058#M139012</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-03-23T14:57:05Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to get substring from the splunk log</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Unable-to-get-substring-from-the-splunk-log/m-p/499059#M139013</link>
      <description>&lt;P&gt;@gcusello Am using in search for creating alert.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Mar 2020 15:54:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Unable-to-get-substring-from-the-splunk-log/m-p/499059#M139013</guid>
      <dc:creator>karthi25</dc:creator>
      <dc:date>2020-03-23T15:54:50Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to get substring from the splunk log</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Unable-to-get-substring-from-the-splunk-log/m-p/499060#M139014</link>
      <description>&lt;P&gt;Hi @karthi25,&lt;BR /&gt;
it seems the you didn't used the rex command&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=*  source=* Exception 
| rex "(?ms)(?&amp;lt;my_field&amp;gt;Exception occurred while processing rules for [^:]+)"
| table my_field
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please try again.&lt;/P&gt;

&lt;P&gt;And, please, to display code (as regexes or searches) please use the Code Sample button (the one with 101010).&lt;/P&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 23 Mar 2020 16:09:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Unable-to-get-substring-from-the-splunk-log/m-p/499060#M139014</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-03-23T16:09:08Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to get substring from the splunk log</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Unable-to-get-substring-from-the-splunk-log/m-p/499061#M139015</link>
      <description>&lt;P&gt;REGEX:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?ims)(?&amp;lt;exception&amp;gt;(exception).*\2)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But your original REGEX&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; "\(Exception occurred while processing rules for Feed name (?&amp;lt;myField&amp;gt;[^\)]:*)\)\("
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;what's &lt;CODE&gt;\(&lt;/CODE&gt;?&lt;/P&gt;

&lt;P&gt;your provided log is not with &lt;CODE&gt;(Exception occurred ...&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Mar 2020 18:59:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Unable-to-get-substring-from-the-splunk-log/m-p/499061#M139015</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-03-23T18:59:00Z</dc:date>
    </item>
  </channel>
</rss>

