<?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 Using regex, how do you extract data when there are special characters? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Using-regex-how-do-you-extract-data-when-there-are-special/m-p/433636#M123788</link>
    <description>&lt;P&gt;I am trying to create a Regular Expression string which could extract several key pieces of data from a syslog event that has been consumed Splunk.  This is how the data appears in Splunk:  &lt;/P&gt;

&lt;P&gt;Note - i have scrubbed some of the data for privacy purposes.  string1, string2  string2 not the actual&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2018-10-12 05:15:19 Local7.Debug    string1 string2 1.3.6.1.4.1.1.3.6.1.4.1.26393.12.1.0.1 1539321310 10.2.104.150 Ver2 1.3.6.1.4.1.26393.99.10.1.1 string3 1.3.6.1.4.1.26393.99.10.1.2 0 1.3.6.1.4.1.26393.99.10.1.3 5 1.3.6.1.4.1.26393.99.10.1.4 &amp;#7;\x83
&amp;#12;&amp;#5;&amp;#15;
&amp;#4; 1.3.6.1.4.1.26393.99.10.1.5 Controller: CTIHost sent a fail hard. 1.3.6.1.4.1.26393.99.10.1.6  1.3.6.1.4.1.26393.99.10.1.7  1.3.6.1.4.1.26393.99.10.1.8  1.3.6.1.4.1.26393.99.10.1.9  1.3.6.1.4.1.26393.99.10.1.10  1.3.6.1.4.1.26393.99.10.1.11 0 1.3.6.1.4.1.26393.99.10.1.12 0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have successfully created two regular expressions in the Splunk 'Extract Fields' tool to build my results, but the data is missing within the actual error message.  In this above example it is "Controller: CTIHost sent a fail hard.".  When i try to add this to my 'Field extraction, i get an error in Splunk telling me the expression contains invalid characters.  I believe the invalid characters is causing my issues (&amp;#5;&amp;#15;).  &lt;/P&gt;

&lt;P&gt;This is what Splunk is showing the Regular Expression as when it is being created:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;^[^\\\n]*\\\w+\d+\s+&amp;#12;&amp;#5;&amp;#15;\s+&amp;#4;\s+\d+\.\d+\.\d+\.\d+\.\d+\.\d+\.(?P\d+\.\d+\.\d+\.\d+\.\d+\s+\w+:\s+\w+\s+\w+\s+\w+\s+\w+\s+\w+\.\s+\d+\.\d+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When putting this in data in notepad++, the different &amp;#5;'s appear as black boxes with character&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/5950i249884C784FF0EC1/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;s:&lt;/P&gt;

&lt;P&gt;I did research the different Unicode and this is the data i was able to identify:&lt;/P&gt;

&lt;P&gt;BEL = u0007&lt;BR /&gt;
FF = U+000C&lt;BR /&gt;
ENQ = U+2405  or U+0005&lt;BR /&gt;
SI = U+000F&lt;BR /&gt;
EOT = U+0004&lt;/P&gt;

&lt;P&gt;How can i do a regular expression and get past this?  &lt;/P&gt;</description>
    <pubDate>Fri, 12 Oct 2018 18:52:31 GMT</pubDate>
    <dc:creator>meinfan</dc:creator>
    <dc:date>2018-10-12T18:52:31Z</dc:date>
    <item>
      <title>Using regex, how do you extract data when there are special characters?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-regex-how-do-you-extract-data-when-there-are-special/m-p/433636#M123788</link>
      <description>&lt;P&gt;I am trying to create a Regular Expression string which could extract several key pieces of data from a syslog event that has been consumed Splunk.  This is how the data appears in Splunk:  &lt;/P&gt;

&lt;P&gt;Note - i have scrubbed some of the data for privacy purposes.  string1, string2  string2 not the actual&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2018-10-12 05:15:19 Local7.Debug    string1 string2 1.3.6.1.4.1.1.3.6.1.4.1.26393.12.1.0.1 1539321310 10.2.104.150 Ver2 1.3.6.1.4.1.26393.99.10.1.1 string3 1.3.6.1.4.1.26393.99.10.1.2 0 1.3.6.1.4.1.26393.99.10.1.3 5 1.3.6.1.4.1.26393.99.10.1.4 &amp;#7;\x83
&amp;#12;&amp;#5;&amp;#15;
&amp;#4; 1.3.6.1.4.1.26393.99.10.1.5 Controller: CTIHost sent a fail hard. 1.3.6.1.4.1.26393.99.10.1.6  1.3.6.1.4.1.26393.99.10.1.7  1.3.6.1.4.1.26393.99.10.1.8  1.3.6.1.4.1.26393.99.10.1.9  1.3.6.1.4.1.26393.99.10.1.10  1.3.6.1.4.1.26393.99.10.1.11 0 1.3.6.1.4.1.26393.99.10.1.12 0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have successfully created two regular expressions in the Splunk 'Extract Fields' tool to build my results, but the data is missing within the actual error message.  In this above example it is "Controller: CTIHost sent a fail hard.".  When i try to add this to my 'Field extraction, i get an error in Splunk telling me the expression contains invalid characters.  I believe the invalid characters is causing my issues (&amp;#5;&amp;#15;).  &lt;/P&gt;

&lt;P&gt;This is what Splunk is showing the Regular Expression as when it is being created:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;^[^\\\n]*\\\w+\d+\s+&amp;#12;&amp;#5;&amp;#15;\s+&amp;#4;\s+\d+\.\d+\.\d+\.\d+\.\d+\.\d+\.(?P\d+\.\d+\.\d+\.\d+\.\d+\s+\w+:\s+\w+\s+\w+\s+\w+\s+\w+\s+\w+\.\s+\d+\.\d+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When putting this in data in notepad++, the different &amp;#5;'s appear as black boxes with character&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/5950i249884C784FF0EC1/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;s:&lt;/P&gt;

&lt;P&gt;I did research the different Unicode and this is the data i was able to identify:&lt;/P&gt;

&lt;P&gt;BEL = u0007&lt;BR /&gt;
FF = U+000C&lt;BR /&gt;
ENQ = U+2405  or U+0005&lt;BR /&gt;
SI = U+000F&lt;BR /&gt;
EOT = U+0004&lt;/P&gt;

&lt;P&gt;How can i do a regular expression and get past this?  &lt;/P&gt;</description>
      <pubDate>Fri, 12 Oct 2018 18:52:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-regex-how-do-you-extract-data-when-there-are-special/m-p/433636#M123788</guid>
      <dc:creator>meinfan</dc:creator>
      <dc:date>2018-10-12T18:52:31Z</dc:date>
    </item>
    <item>
      <title>Re: Using regex, how do you extract data when there are special characters?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-regex-how-do-you-extract-data-when-there-are-special/m-p/433637#M123789</link>
      <description>&lt;P&gt;The field extraction wizard is not particularly smart about how it creates regex strings.  It's not necessary to identify every character from the beginning of the event to the desired field.  One only needs to find a unique starting point.  In your sample event, I used EOT.  Try this regex to see if it works for you.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;\x04[\s\S]+\s(?P&amp;lt;CC_Error&amp;gt;\w+:[^\.]+)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 13 Oct 2018 14:37:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-regex-how-do-you-extract-data-when-there-are-special/m-p/433637#M123789</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2018-10-13T14:37:26Z</dc:date>
    </item>
  </channel>
</rss>

