<?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 edit my regular expression to extract a field and trim out strings with more than X characters (except space) from the value? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-a-field-and-trim/m-p/216880#M63691</link>
    <description>&lt;P&gt;Thank you @ sundareshr . If I pipe my orignal query with the makeresults , I am getting following error.&lt;BR /&gt;
Error in 'makeresults' command: This command must be the first command of a search.&lt;/P&gt;

&lt;P&gt;Where do i specify the sourcetype and other part of the search criteria ?&lt;/P&gt;</description>
    <pubDate>Tue, 09 Aug 2016 20:26:34 GMT</pubDate>
    <dc:creator>pradjswl</dc:creator>
    <dc:date>2016-08-09T20:26:34Z</dc:date>
    <item>
      <title>How to edit my regular expression to extract a field and trim out strings with more than X characters (except space) from the value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-a-field-and-trim/m-p/216878#M63689</link>
      <description>&lt;P&gt;I have the following events.&lt;/P&gt;

&lt;P&gt;event 1)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[08-09-2016_08:00:40.567_PDT] [ERROR] - [ePdv0XVRu2] [xxx@yyy.com] [] [auth] [ResourceAuthenticationFilter] - TATS_SS_TOKEN_ID TOKEN IN SESSION GVtghrUaE%2FIU5H8Lpa%2FcfAhIZvdT7Q1Q%2F4UL3zgnngrOrL97eUYn5e0j8sXk5eN6%2FSQEsVAz066qk%2F1KanQjxreAL%2F4qAbPs5C6K9ZVKWAPENBF%2BC3k0nSDcXFTYw4Ep%2BvAt9HwFbCN9eg1Xj8qG9KfLa0Is%2B9YeGmEiYAH4MQoBmH6Zx6Y%2FStxOMNwsvySruKmdlnMpXeFLrPWbd6iVrCmCvOzIZZaNtyq9trGUAxHaTGbQxTkE8clMWcvUhenkhWxijr2%2F%2FnASvxU9rIrfgkV%2Bnirw2kLKZWf%2BW1e5nNpZ6OE9aZsaSXTYSaIno4RHG8qzwNMtvdykNJLIFCGFAj6Fdt7k8A3%2BSTYY5aircTcONh0u8GOPNuVWCFFc3WUQ DID NOT MATCH WITH COOKIE GVtghrUaE%2FIU5H8Lpa%2FcfAhIZvdT7Q1Q%2F4UL3zgnngrOrL97eUYn5e0j8sXk5eN6%2FSQEsVAz066qk%2F1KanQjxreAL%2F4qAbPs5C6K9ZVKWAPENBF%2BC3k0nSDcXFTYw4Ep%2BvAt9HwFbCN9eg1Xj8qG9KfLa0Is%2B9YeGmEiYAH4MQoBmH6Zx6Y%2FStxOMNwsvySruKmdlnMpXeFLrPWbd6iVrCmCvOzIZZaNtyq9trGUAxHaTGbQxTkE8clMWcvUhenkhWxijr2%2F%2FnASvxU9rIrfgkV%2Bnirw2kLKZWf%2BW1e5nNrTdaX1vVAhzrXBszldYtE5cEm9yffwuivWl6DpoobEqpZnTtfrVa3CEJ7uHqPv%2B1aj9K%2BaJz%2B%2Bc376kG5%2FJcNn PRESEN
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;event 2)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[08-09-2016_08:00:41.451_PDT] [ERROR] - [ePdv0XVRu2] [xxx@yyy.com [] [unauth] [ResourceReqValidationFilter] - Not Authorized TO Access this URI https:zzz.com
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am using this regular expression, and extracted the Error description.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?:\].*?){7}\s-\s(?P.*) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The field &lt;STRONG&gt;a_xf_ErrorDescription&lt;/STRONG&gt; returns a very large value for  the1st event as you can see that it has cookie related information. In reality, there can't be readable format of English words continuing to more than 10-15 character(except space). &lt;/P&gt;

&lt;P&gt;As per current regular expression&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;a_xf_ErrorDescription=TATS_SS_TOKEN_ID TOKEN IN SESSION GVtghrUaE%2FIU5H8Lpa%2FcfAhIZvdT7Q1Q%2F4UL3zgnngrOrL97eUYn5e0j8sXk5eN6%2FSQEsVAz066qk%2F1KanQjxreAL%2F4qAbPs5C6K9ZVKWAPENBF%2BC3k0nSDcXFTYw4Ep%2BvAt9HwFbCN9eg1Xj8qG9KfLa0Is%2B9YeGmEiYAH4MQoBmH6Zx6Y%2FStxOMNwsvySruKmdlnMpXeFLrPWbd6iVrCmCvOzIZZaNtyq9trGUAxHaTGbQxTkE8clMWcvUhenkhWxijr2%2F%2FnASvxU9rIrfgkV%2Bnirw2kLKZWf%2BW1e5nNpZ6OE9aZsaSXTYSaIno4RHG8qzwNMtvdykNJLIFCGFAj6Fdt7k8A3%2BSTYY5aircTcONh0u8GOPNuVWCFFc3WUQ DID NOT MATCH WITH COOKIE GVtghrUaE%2FIU5H8Lpa%2FcfAhIZvdT7Q1Q%2F4UL3zgnngrOrL97eUYn5e0j8sXk5eN6%2FSQEsVAz066qk%2F1KanQjxreAL%2F4qAbPs5C6K9ZVKWAPENBF%2BC3k0nSDcXFTYw4Ep%2BvAt9HwFbCN9eg1Xj8qG9KfLa0Is%2B9YeGmEiYAH4MQoBmH6Zx6Y%2FStxOMNwsvySruKmdlnMpXeFLrPWbd6iVrCmCvOzIZZaNtyq9trGUAxHaTGbQxTkE8clMWcvUhenkhWxijr2%2F%2FnASvxU9rIrfgkV%2Bnirw2kLKZWf%2BW1e5nNrTdaX1vVAhzrXBszldYtE5cEm9yffwuivWl6DpoobEqpZnTtfrVa3CEJ7uHqPv%2B1aj9K%2BaJz%2B%2Bc376kG5%2FJcNn PRESEN
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Question 1) Is there a way for a field extraction to STOP &amp;amp; IGNORE a word which has more than 15 (or 20) characters ? So that the extracted field for event 1 would just have the value as:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;a_xf_ErrorDescription=TATS_SS_TOKEN_ID TOKEN IN SESSION
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Question 2) Is there a way for the field extraction to CONTINUE &amp;amp; IGNORE the word which has more than 15 (or 20) characters so that the extracted field for event 1 would have the value as:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;a_xf_ErrorDescription=TATS_SS_TOKEN_ID TOKEN IN SESSION DID NOT MATCH WITH COOKIE PRESEN
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The reason I want to Trim the extracted field to meaningful name so that it's easier to create a timechart with the field having common error.&lt;/P&gt;

&lt;P&gt;Thanks for your feedback.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 10:33:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-a-field-and-trim/m-p/216878#M63689</guid>
      <dc:creator>pradjswl</dc:creator>
      <dc:date>2020-09-29T10:33:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my regular expression to extract a field and trim out strings with more than X characters (except space) from the value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-a-field-and-trim/m-p/216879#M63690</link>
      <description>&lt;P&gt;Try this run anywhere example&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval a_xf_ErrorDescription="TATS_SS_TOKEN_ID TOKEN IN SESSION GVtghrUaE%2FIU5H8Lpa%2FcfAhIZvdT7Q1Q%2F4UL3zgnngrOrL97eUYn5e0j8sXk5eN6%2FSQEsVAz066qk%2F1KanQjxreAL%2F4qAbPs5C6K9ZVKWAPENBF%2BC3k0nSDcXFTYw4Ep%2BvAt9HwFbCN9eg1Xj8qG9KfLa0Is%2B9YeGmEiYAH4MQoBmH6Zx6Y%2FStxOMNwsvySruKmdlnMpXeFLrPWbd6iVrCmCvOzIZZaNtyq9trGUAxHaTGbQxTkE8clMWcvUhenkhWxijr2%2F%2FnASvxU9rIrfgkV%2Bnirw2kLKZWf%2BW1e5nNpZ6OE9aZsaSXTYSaIno4RHG8qzwNMtvdykNJLIFCGFAj6Fdt7k8A3%2BSTYY5aircTcONh0u8GOPNuVWCFFc3WUQ DID NOT MATCH WITH COOKIE GVtghrUaE%2FIU5H8Lpa%2FcfAhIZvdT7Q1Q%2F4UL3zgnngrOrL97eUYn5e0j8sXk5eN6%2FSQEsVAz066qk%2F1KanQjxreAL%2F4qAbPs5C6K9ZVKWAPENBF%2BC3k0nSDcXFTYw4Ep%2BvAt9HwFbCN9eg1Xj8qG9KfLa0Is%2B9YeGmEiYAH4MQoBmH6Zx6Y%2FStxOMNwsvySruKmdlnMpXeFLrPWbd6iVrCmCvOzIZZaNtyq9trGUAxHaTGbQxTkE8clMWcvUhenkhWxijr2%2F%2FnASvxU9rIrfgkV%2Bnirw2kLKZWf%2BW1e5nNrTdaX1vVAhzrXBszldYtE5cEm9yffwuivWl6DpoobEqpZnTtfrVa3CEJ7uHqPv%2B1aj9K%2BaJz%2B%2Bc376kG5%2FJcNn PRESEN" | rex field=a_xf_ErrorDescription max_match=0 "\s(?&amp;lt;words&amp;gt;\w{1,10})\s?" | table words | nomv words
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Aug 2016 20:14:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-a-field-and-trim/m-p/216879#M63690</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-08-09T20:14:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my regular expression to extract a field and trim out strings with more than X characters (except space) from the value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-a-field-and-trim/m-p/216880#M63691</link>
      <description>&lt;P&gt;Thank you @ sundareshr . If I pipe my orignal query with the makeresults , I am getting following error.&lt;BR /&gt;
Error in 'makeresults' command: This command must be the first command of a search.&lt;/P&gt;

&lt;P&gt;Where do i specify the sourcetype and other part of the search criteria ?&lt;/P&gt;</description>
      <pubDate>Tue, 09 Aug 2016 20:26:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-a-field-and-trim/m-p/216880#M63691</guid>
      <dc:creator>pradjswl</dc:creator>
      <dc:date>2016-08-09T20:26:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my regular expression to extract a field and trim out strings with more than X characters (except space) from the value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-a-field-and-trim/m-p/216881#M63692</link>
      <description>&lt;P&gt;Remove everything before  &lt;CODE&gt;| rex field=a...&lt;/CODE&gt; and replace it with your original query&lt;/P&gt;</description>
      <pubDate>Tue, 09 Aug 2016 20:42:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-a-field-and-trim/m-p/216881#M63692</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-08-09T20:42:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my regular expression to extract a field and trim out strings with more than X characters (except space) from the value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-a-field-and-trim/m-p/216882#M63693</link>
      <description>&lt;P&gt;Like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | rex field=a_xf_ErrorDescription max_match=0 "\s(?&amp;lt;words&amp;gt;\w{1,10})\s?" | table words | nomv words
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Aug 2016 20:46:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-a-field-and-trim/m-p/216882#M63693</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-08-09T20:46:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my regular expression to extract a field and trim out strings with more than X characters (except space) from the value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-a-field-and-trim/m-p/216883#M63694</link>
      <description>&lt;P&gt;great ty @somesoni2 &amp;amp; @sundareshr &lt;/P&gt;</description>
      <pubDate>Tue, 09 Aug 2016 21:30:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-a-field-and-trim/m-p/216883#M63694</guid>
      <dc:creator>pradjswl</dc:creator>
      <dc:date>2016-08-09T21:30:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my regular expression to extract a field and trim out strings with more than X characters (except space) from the value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-a-field-and-trim/m-p/216884#M63695</link>
      <description>&lt;P&gt;what does &lt;CODE&gt;\w{1,10}&lt;/CODE&gt; do? Does it ignore any word of minimum 1 to maximum 10 characters?&lt;/P&gt;</description>
      <pubDate>Tue, 09 Aug 2016 21:33:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-a-field-and-trim/m-p/216884#M63695</guid>
      <dc:creator>pradjswl</dc:creator>
      <dc:date>2016-08-09T21:33:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my regular expression to extract a field and trim out strings with more than X characters (except space) from the value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-a-field-and-trim/m-p/216885#M63696</link>
      <description>&lt;P&gt;It captures between 1 &amp;amp; 10 characters. I assume the longest word will be 10 characters and cookie wil be greater than that. You can increase/reduce the 10. Keep the 1&lt;/P&gt;

&lt;P&gt;@pradjswl if this works, please accept the answer to close it out.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Aug 2016 21:38:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-a-field-and-trim/m-p/216885#M63696</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-08-09T21:38:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my regular expression to extract a field and trim out strings with more than X characters (except space) from the value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-a-field-and-trim/m-p/216886#M63697</link>
      <description>&lt;P&gt;@sundareshr  - Done. Sorry I didnt knew about Answer accepting. Just being new to site &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2016 13:43:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-a-field-and-trim/m-p/216886#M63697</guid>
      <dc:creator>pradjswl</dc:creator>
      <dc:date>2016-08-10T13:43:35Z</dc:date>
    </item>
  </channel>
</rss>

