<?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 parse out a single line following a static line in a java stack trace? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-out-a-single-line-following-a-static-line-in-a-java/m-p/410795#M72748</link>
    <description>&lt;P&gt;@enkidu999,&lt;/P&gt;

&lt;P&gt;Try  &lt;CODE&gt;| rex field=_raw "ca\.shaw\.billing\.integration\.core\.BrmGateway\.executeOpCodeForXml\(BrmGateway\.java:39\)(?&amp;lt;stack_trace_line&amp;gt;[^)]+\))"&lt;/CODE&gt; command to extract that line. This will extract the line you want in field  &lt;CODE&gt;stack_trace_line&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Hope this helps!!!&lt;/P&gt;</description>
    <pubDate>Sat, 08 Jun 2019 04:41:45 GMT</pubDate>
    <dc:creator>VatsalJagani</dc:creator>
    <dc:date>2019-06-08T04:41:45Z</dc:date>
    <item>
      <title>How to parse out a single line following a static line in a java stack trace?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-out-a-single-line-following-a-static-line-in-a-java/m-p/410793#M72746</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I am new to Splunk and attempting to parse and display a single line of text from a java stack trace captured in a single event.&lt;/P&gt;

&lt;P&gt;Here is a sample of the stack trace:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;com.sun.proxy.$Proxy90.executeOpCodeForXml(Unknown Source)
ca.shaw.billing.integration.core.BrmGateway.buildConnection(BrmGateway.java:61)
ca.shaw.billing.integration.core.BrmGateway.executeOpCodeForXml(BrmGateway.java:39)
ca.shaw.billing.tasks.account.overview.AccountOverviewTask.getAgingBucketsResponseFlist(AccountOverviewTask.java:93)
ca.shaw.billing.tasks.account.overview.AccountOverviewTask.getAccountOverviewInfo(AccountOverviewTask.java:64)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have built a "top" display for all the events which find this stack trace over a given period of time using the following query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=brm source=/opt/brm/weblogic/Oracle/Middleware/user_projects/domains/billing_service_domain/servers/* "[STUCK] ExecuteThread" "socketRead0" | rex field=_raw "X_SHAW_TRANSACTION_ID:(?.*)" 
| eval myTime=strftime(_time,"%Y-%m-%dT%H:%M:%S.%Q")
| dedup theTransaction 
|  top 0 myTime,theTransaction
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What I am having trouble with is parsing out the line that follows a static line which is in all stack traces:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;ca.shaw.billing.integration.core.BrmGateway.executeOpCodeForXml(BrmGateway.java:39)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;...then add this result to the display as well.&lt;/P&gt;

&lt;P&gt;From above, the line I would want is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;ca.shaw.billing.tasks.account.overview.AccountOverviewTask.getAgingBucketsResponseFlist(AccountOverviewTask.java:93)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Any help would be appreciated!&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2019 22:51:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-out-a-single-line-following-a-static-line-in-a-java/m-p/410793#M72746</guid>
      <dc:creator>enkidu999</dc:creator>
      <dc:date>2019-06-07T22:51:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse out a single line following a static line in a java stack trace?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-out-a-single-line-following-a-static-line-in-a-java/m-p/410794#M72747</link>
      <description>&lt;P&gt;Hello enkidu999,&lt;/P&gt;

&lt;P&gt;If you want to parse out the line following a line in an event, here is how you would do it.  Let's take your sample data:&lt;BR /&gt;
&lt;PRE&gt;&lt;BR /&gt;
com.sun.proxy.$Proxy90.executeOpCodeForXml(Unknown Source)&lt;BR /&gt;
ca.shaw.billing.integration.core.BrmGateway.buildConnection(BrmGateway.java:61)&lt;BR /&gt;
ca.shaw.billing.integration.core.BrmGateway.executeOpCodeForXml(BrmGateway.java:39)&lt;BR /&gt;
ca.shaw.billing.tasks.account.overview.AccountOverviewTask.getAgingBucketsResponseFlist(AccountOverviewTask.java:93)&lt;BR /&gt;
ca.shaw.billing.tasks.account.overview.AccountOverviewTask.getAccountOverviewInfo(AccountOverviewTask.java:64)&lt;BR /&gt;
&lt;/PRE&gt;&lt;/P&gt;

&lt;P&gt;To get the line following &lt;CODE&gt;ca.shaw.billing.integration.core.BrmGateway.executeOpCodeForXml(BrmGateway.java:39)&lt;/CODE&gt; you would do something like this:&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE&gt;| rex "ca\.shaw\.billing\.integration\.core\.BrmGateway\.executeOpCodeForXml\(BrmGateway\.java:39\)[\r\n]+(?&amp;lt;LineIWant&amp;gt;[^\r\n]+)"&lt;/CODE&gt;&lt;/PRE&gt;&lt;/P&gt;

&lt;P&gt;(When using rex you have to escape special characters in regex, like the period . or parenthesis () with a backslash character \ as seen above)&lt;BR /&gt;
How does this look?&lt;BR /&gt;
In the following image I create a "dummy" event using your 5 lines of data.  Then I apply the &lt;CODE&gt;| rex&lt;/CODE&gt; command after the dummy event is created. Next I print a table with the _raw field and the captured field (&lt;STRONG&gt;LineIWant&lt;/STRONG&gt; in this case, but you can change that to whatever you want it to be in the &lt;CODE&gt;rex&lt;/CODE&gt; command)&lt;BR /&gt;
&lt;STRONG&gt;Screen Capture:&lt;/STRONG&gt;&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/7168i3646CFB794D7811C/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Jun 2019 03:38:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-out-a-single-line-following-a-static-line-in-a-java/m-p/410794#M72747</guid>
      <dc:creator>jnudell_2</dc:creator>
      <dc:date>2019-06-08T03:38:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse out a single line following a static line in a java stack trace?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-out-a-single-line-following-a-static-line-in-a-java/m-p/410795#M72748</link>
      <description>&lt;P&gt;@enkidu999,&lt;/P&gt;

&lt;P&gt;Try  &lt;CODE&gt;| rex field=_raw "ca\.shaw\.billing\.integration\.core\.BrmGateway\.executeOpCodeForXml\(BrmGateway\.java:39\)(?&amp;lt;stack_trace_line&amp;gt;[^)]+\))"&lt;/CODE&gt; command to extract that line. This will extract the line you want in field  &lt;CODE&gt;stack_trace_line&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Hope this helps!!!&lt;/P&gt;</description>
      <pubDate>Sat, 08 Jun 2019 04:41:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-out-a-single-line-following-a-static-line-in-a-java/m-p/410795#M72748</guid>
      <dc:creator>VatsalJagani</dc:creator>
      <dc:date>2019-06-08T04:41:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse out a single line following a static line in a java stack trace?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-out-a-single-line-following-a-static-line-in-a-java/m-p/410796#M72749</link>
      <description>&lt;P&gt;Hello VatsalJagani,&lt;/P&gt;

&lt;P&gt;Your rex worked great!&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 18:02:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-out-a-single-line-following-a-static-line-in-a-java/m-p/410796#M72749</guid>
      <dc:creator>enkidu999</dc:creator>
      <dc:date>2019-06-10T18:02:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse out a single line following a static line in a java stack trace?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-out-a-single-line-following-a-static-line-in-a-java/m-p/410797#M72750</link>
      <description>&lt;P&gt;Hello jnudell_2,&lt;BR /&gt;
Thanks for showing me a sample of how you would set it up, you saved me hours of searching forums and trial+error, being new to Splunk.&lt;BR /&gt;
Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 18:03:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-out-a-single-line-following-a-static-line-in-a-java/m-p/410797#M72750</guid>
      <dc:creator>enkidu999</dc:creator>
      <dc:date>2019-06-10T18:03:49Z</dc:date>
    </item>
  </channel>
</rss>

