<?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 do I edit my &amp;quot;eval field=substr...&amp;quot; syntax to remove part of a stacktrace after a certain string? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-quot-eval-field-substr-quot-syntax-to-remove/m-p/202449#M58735</link>
    <description>&lt;P&gt;Did you remove the 'mode=sed'?  Can you share a stacktrace so I can make sure the regex is correct?&lt;/P&gt;</description>
    <pubDate>Wed, 30 Dec 2015 14:15:04 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2015-12-30T14:15:04Z</dc:date>
    <item>
      <title>How do I edit my "eval field=substr..." syntax to remove part of a stacktrace after a certain string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-quot-eval-field-substr-quot-syntax-to-remove/m-p/202442#M58728</link>
      <description>&lt;P&gt;Hi &lt;/P&gt;

&lt;P&gt;I'm trying to create a dashboard where I count stacktraces in the logging. (the long term goal is to get rid off all stacktraces but we need to prioritize &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; )&lt;/P&gt;

&lt;P&gt;To do this, I need to cut off the low level part of the stacktrace, the part that doesn't come from our code, but from the libraries that are packed with the distribution of the OS. &lt;/P&gt;

&lt;P&gt;The cut-off point is easily recognized because it starts with &lt;CODE&gt;at android.os&lt;/CODE&gt;, so I need to do something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eval action=substr(action,0,&amp;lt;xxx&amp;gt;) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;where &amp;lt;xxx&amp;gt; is the position in the string that starts with "at android.os" &lt;/P&gt;

&lt;P&gt;Any ideas on how to do this? &lt;/P&gt;</description>
      <pubDate>Tue, 29 Dec 2015 16:23:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-quot-eval-field-substr-quot-syntax-to-remove/m-p/202442#M58728</guid>
      <dc:creator>sickyb</dc:creator>
      <dc:date>2015-12-29T16:23:21Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my "eval field=substr..." syntax to remove part of a stacktrace after a certain string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-quot-eval-field-substr-quot-syntax-to-remove/m-p/202443#M58729</link>
      <description>&lt;P&gt;Are you married to using substr?  If not, rex can do the job.  Try &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex field=action "(?&amp;lt;action&amp;gt;.*) at android\.os" | ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Dec 2015 17:21:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-quot-eval-field-substr-quot-syntax-to-remove/m-p/202443#M58729</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-12-29T17:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my "eval field=substr..." syntax to remove part of a stacktrace after a certain string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-quot-eval-field-substr-quot-syntax-to-remove/m-p/202444#M58730</link>
      <description>&lt;P&gt;Nope not married to substr but your regex leaves me with an error &lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;PRE&gt;&lt;CODE&gt;Regex: unrecognized character after (? or (?-
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;So I added the fieldname after the ? leaving me with &lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;PRE&gt;&lt;CODE&gt;rex field=action "(?/.*) at android\.os"
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;Which left me with the entire stacktrace once again. This led me to believe that the regex indeed matches the right string but then doesn't cut the rest of it. Beacause the stacktrace is sent from a mobile device it is compacted in a single line, no endlines there.  So when I added mode=sed to the expression I got &lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;PRE&gt;&lt;CODE&gt;Failed to initialize sed. cannot find sed command: (
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Wed, 30 Dec 2015 09:04:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-quot-eval-field-substr-quot-syntax-to-remove/m-p/202444#M58730</guid>
      <dc:creator>sickyb</dc:creator>
      <dc:date>2015-12-30T09:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my "eval field=substr..." syntax to remove part of a stacktrace after a certain string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-quot-eval-field-substr-quot-syntax-to-remove/m-p/202445#M58731</link>
      <description>&lt;P&gt;The board dropped a key piece from my answer, which I have corrected.  Try again.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Dec 2015 13:08:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-quot-eval-field-substr-quot-syntax-to-remove/m-p/202445#M58731</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-12-30T13:08:03Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my "eval field=substr..." syntax to remove part of a stacktrace after a certain string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-quot-eval-field-substr-quot-syntax-to-remove/m-p/202446#M58732</link>
      <description>&lt;P&gt;That is precisely what i did. but like i said that leaves me with the entire stacktrace instead of just the part before the "at android.os" &lt;/P&gt;

&lt;P&gt;the editor for this q&amp;amp;a forum probably does some input sanitation throwing away the part with the triangular brackets &lt;BR /&gt;
&amp;lt; &amp;gt;&lt;BR /&gt;
    &lt;ACTION&gt;&lt;/ACTION&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Dec 2015 13:33:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-quot-eval-field-substr-quot-syntax-to-remove/m-p/202446#M58732</guid>
      <dc:creator>sickyb</dc:creator>
      <dc:date>2015-12-30T13:33:18Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my "eval field=substr..." syntax to remove part of a stacktrace after a certain string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-quot-eval-field-substr-quot-syntax-to-remove/m-p/202447#M58733</link>
      <description>&lt;P&gt;Hmm...  I wonder if rex needs separate field names.  Try &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex field=action "(?&amp;lt;newAction&amp;gt;.*) at android\.os"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Dec 2015 13:36:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-quot-eval-field-substr-quot-syntax-to-remove/m-p/202447#M58733</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-12-30T13:36:40Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my "eval field=substr..." syntax to remove part of a stacktrace after a certain string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-quot-eval-field-substr-quot-syntax-to-remove/m-p/202448#M58734</link>
      <description>&lt;P&gt;Nope still the same. &lt;/P&gt;</description>
      <pubDate>Wed, 30 Dec 2015 14:09:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-quot-eval-field-substr-quot-syntax-to-remove/m-p/202448#M58734</guid>
      <dc:creator>sickyb</dc:creator>
      <dc:date>2015-12-30T14:09:25Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my "eval field=substr..." syntax to remove part of a stacktrace after a certain string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-quot-eval-field-substr-quot-syntax-to-remove/m-p/202449#M58735</link>
      <description>&lt;P&gt;Did you remove the 'mode=sed'?  Can you share a stacktrace so I can make sure the regex is correct?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Dec 2015 14:15:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-quot-eval-field-substr-quot-syntax-to-remove/m-p/202449#M58735</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-12-30T14:15:04Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my "eval field=substr..." syntax to remove part of a stacktrace after a certain string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-quot-eval-field-substr-quot-syntax-to-remove/m-p/202450#M58736</link>
      <description>&lt;P&gt;java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.SharedPreferences android.content.Context.getSharedPreferences(java.lang.String, int)' on a null object reference at rd.random.mized.a.a(SourceFile:26)   at rd.random.mized.connectivity.statusapp.d.b(SourceFile:89)    at rd.random.mized.connectivity.statusapp.d.a(SourceFile:50)    at rd.random.mized.c.a.a(SourceFile:99) at rd.random.mized.c.a.a(SourceFile:49) at rd.random.mized.connectivity.statusapp.c.a(SourceFile:47)    at rd.random.mized.connectivity.statusapp.c.a(SourceFile:28)    at rd.random.mized.connectivity.ConnectionHandler$1.run(SourceFile:101) at android.os.Handler.handleCallback(Handler.java:739)  at android.os.Handler.dispatchMessage(Handler.java:95)  at android.os.Looper.loop(Looper.java:145)  at android.app.ActivityThread.main(ActivityThread.java:5832)    at java.lang.reflect.Method.invoke(Native Method)   at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)&lt;/P&gt;</description>
      <pubDate>Wed, 30 Dec 2015 14:37:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-quot-eval-field-substr-quot-syntax-to-remove/m-p/202450#M58736</guid>
      <dc:creator>sickyb</dc:creator>
      <dc:date>2015-12-30T14:37:30Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my "eval field=substr..." syntax to remove part of a stacktrace after a certain string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-quot-eval-field-substr-quot-syntax-to-remove/m-p/202451#M58737</link>
      <description>&lt;P&gt;Thanks for the example event.  This rex command works with that data.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex field=action "(?&amp;lt;newAction&amp;gt;.*?) at android\.os"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 31 Dec 2015 14:35:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-quot-eval-field-substr-quot-syntax-to-remove/m-p/202451#M58737</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-12-31T14:35:45Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my "eval field=substr..." syntax to remove part of a stacktrace after a certain string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-quot-eval-field-substr-quot-syntax-to-remove/m-p/202452#M58738</link>
      <description>&lt;P&gt;In the end creating a new field using this regex for the extraction worked.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;^.*native-shell\;(?P&amp;lt;native_android_stacktrace&amp;gt;.*)\tat\ android.os.Handler  
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The native-shell part is added because the field extraction is done on the RAW data instead of the action field.&lt;BR /&gt;
Learning something new every day &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Let's continue doing that in 2016, Happy new year&lt;BR /&gt;
and Thanks for the help.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jan 2016 08:28:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-quot-eval-field-substr-quot-syntax-to-remove/m-p/202452#M58738</guid>
      <dc:creator>sickyb</dc:creator>
      <dc:date>2016-01-05T08:28:28Z</dc:date>
    </item>
  </channel>
</rss>

