<?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 escape special character through regex in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-escape-special-character-through-regex/m-p/496574#M138380</link>
    <description>&lt;P&gt;Please note that if you are saving field extractions to happen automatically and NOT using them with &lt;CODE&gt;rex&lt;/CODE&gt; inside of search &lt;CODE&gt;SPL&lt;/CODE&gt;, you will have to reduce the number of &lt;CODE&gt;\&lt;/CODE&gt; characters by half(ish).  Are you saving this as automatic field extractions?&lt;/P&gt;</description>
    <pubDate>Thu, 02 Jan 2020 02:33:25 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2020-01-02T02:33:25Z</dc:date>
    <item>
      <title>How to escape special character through regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-escape-special-character-through-regex/m-p/496569#M138375</link>
      <description>&lt;P&gt;Hi experts, I wanted to escape the backslash  "\" from the below logs, and capture the status code.&lt;BR /&gt;
The output should be like this  &lt;CODE&gt;statusCode=200&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Please help me on this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"log":"{\"logType\":\"RESPONSE\",\"logLevel\":\"DEBUG\",\"logTimestamp\":\"2019-12-03T20:08:58.691Z\",\"logger\":\"Response\",\"label\":\"Response\",\"transaction\":{\"transactionId\":\"AjscCsiRestful46@N/A258ecf8b-106b-475d-9ba6-784e1205cce4\",\"conversationId\":\"m10582@sapmp.att.com~CNG-CSI~0cb3c333-15ee-45cf-9a45-fc2fe3d21783\",\"consumer\":\"m10582@sapmp.att.com\",\"protocol\":\"HTTP\",\"callingEntityIP\":\"10.233.64.0\",\"receivedTimestamp\":\"2019-12-03T20:08:58.675Z\",\"timeToLive\":0,\"timeout\":\"2019-12-03T20:08:58.675Z\"},\"runtime\":{\"hostName\":\"zlp25883\",\"ip\":\"10.233.77.162\",\"instance\":\"subscribernotificationprocess-3-0-2-default-6dcdffcc5f-vccqx\",\"clusterName\":\"PROD-ALPSGACT-SAPMP-0001\",\"namespace\":\"com-att-sapmp-prod\",\"image\":\"dockercentral.it.att.com:5100/com.att.sapmp/subscribernotificationprocess:3.0.2\",\"platformIdentifier\":\"AJSC7_RESTLET\",\"environment\":\"PROD\"},\"application\":{\"deploymentUnitName\":\"com.att.sapmp.SubscriberNotificationProcess\",\"motsApplicationAcronym\":\"26018\"},\"response\":{\"processedEndTimestamp\":\"2019-12-03T20:08:58.689Z\",\"responseSize\":0,\"responseMessage\":\"\",\"status\":\"COMPLETE\",\"statusCode\":\"200\",\"headers\":{\"X-ATT-UniqueTransactionId\":\"AjscCsiRestful46@N/A258ecf8b-106b-475d-9ba6-784e1205cce4\",\"X-ATT-ConversationId\":\"m10582@sapmp.att.com~CNG-CSI~0cb3c333-15ee-45cf-9a45-fc2fe3d21783\",\"X-Application-Context\":\"application:subscriber:8080\",\"Date\":\"Tue, 03 Dec 2019 20:08:58 GMT\",\"Server\":\"Restlet-Framework/2.3.12\"}}}\n","stream":"stdout","time":"2019-12-03T20:08:58.691596727Z"}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Dec 2019 20:29:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-escape-special-character-through-regex/m-p/496569#M138375</guid>
      <dc:creator>mrmanishsharma</dc:creator>
      <dc:date>2019-12-03T20:29:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to escape special character through regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-escape-special-character-through-regex/m-p/496570#M138376</link>
      <description>&lt;P&gt;How about something like this?  The "extra" backslashes are there because of additional escaping needed in SPL.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex "statusCode\\\\\":\\\\\"(?&amp;lt;statusCode&amp;gt;\d+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Dec 2019 21:57:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-escape-special-character-through-regex/m-p/496570#M138376</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-12-03T21:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to escape special character through regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-escape-special-character-through-regex/m-p/496571#M138377</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;Try this, temp is the field that contains entire log&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval temp="statusCode\":\"200\"," 
| rex field=temp "statusCode\":\"(?P&amp;lt;statusCode&amp;gt;[^\",]+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Dec 2019 02:39:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-escape-special-character-through-regex/m-p/496571#M138377</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2019-12-04T02:39:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to escape special character through regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-escape-special-character-through-regex/m-p/496572#M138378</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults
| eval _raw="\"log\":\"{\\\"logType\\\":\\\"RESPONSE\\\",\\\"logLevel\\\":\\\"DEBUG\\\",\\\"logTimestamp\\\":\\\"2019-12-03T20:08:58.691Z\\\",\\\"logger\\\":\\\"Response\\\",\\\"label\\\":\\\"Response\\\",\\\"transaction\\\":{\\\"transactionId\\\":\\\"AjscCsiRestful46@N/A258ecf8b-106b-475d-9ba6-784e1205cce4\\\",\\\"conversationId\\\":\\\"m10582@sapmp.att.com~CNG-CSI~0cb3c333-15ee-45cf-9a45-fc2fe3d21783\\\",\\\"consumer\\\":\\\"m10582@sapmp.att.com\\\",\\\"protocol\\\":\\\"HTTP\\\",\\\"callingEntityIP\\\":\\\"10.233.64.0\\\",\\\"receivedTimestamp\\\":\\\"2019-12-03T20:08:58.675Z\\\",\\\"timeToLive\\\":0,\\\"timeout\\\":\\\"2019-12-03T20:08:58.675Z\\\"},\\\"runtime\\\":{\\\"hostName\\\":\\\"zlp25883\\\",\\\"ip\\\":\\\"10.233.77.162\\\",\\\"instance\\\":\\\"subscribernotificationprocess-3-0-2-default-6dcdffcc5f-vccqx\\\",\\\"clusterName\\\":\\\"PROD-ALPSGACT-SAPMP-0001\\\",\\\"namespace\\\":\\\"com-att-sapmp-prod\\\",\\\"image\\\":\\\"dockercentral.it.att.com:5100/com.att.sapmp/subscribernotificationprocess:3.0.2\\\",\\\"platformIdentifier\\\":\\\"AJSC7_RESTLET\\\",\\\"environment\\\":\\\"PROD\\\"},\\\"application\\\":{\\\"deploymentUnitName\\\":\\\"com.att.sapmp.SubscriberNotificationProcess\\\",\\\"motsApplicationAcronym\\\":\\\"26018\\\"},\\\"response\\\":{\\\"processedEndTimestamp\\\":\\\"2019-12-03T20:08:58.689Z\\\",\\\"responseSize\\\":0,\\\"responseMessage\\\":\\\"\\\",\\\"status\\\":\\\"COMPLETE\\\",\\\"statusCode\\\":\\\"200\\\",\\\"headers\\\":{\\\"X-ATT-UniqueTransactionId\\\":\\\"AjscCsiRestful46@N/A258ecf8b-106b-475d-9ba6-784e1205cce4\\\",\\\"X-ATT-ConversationId\\\":\\\"m10582@sapmp.att.com~CNG-CSI~0cb3c333-15ee-45cf-9a45-fc2fe3d21783\\\",\\\"X-Application-Context\\\":\\\"application:subscriber:8080\\\",\\\"Date\\\":\\\"Tue, 03 Dec 2019 20:08:58 GMT\\\",\\\"Server\\\":\\\"Restlet-Framework/2.3.12\\\"}}}\n\",\"stream\":\"stdout\",\"time\":\"2019-12-03T20:08:58.691596727Z\"}"
| rex "statusCode\\\\\":\\\\\"(?&amp;lt;statusCode&amp;gt;\d+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Dec 2019 06:01:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-escape-special-character-through-regex/m-p/496572#M138378</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-12-04T06:01:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to escape special character through regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-escape-special-character-through-regex/m-p/496573#M138379</link>
      <description>&lt;P&gt;Thanks all for your efforts.&lt;BR /&gt;
but what is the wired thing happening, when i used the code from answers so far and execute with my search string. it works.&lt;BR /&gt;
issue comes, when i creates the field and it shows successfully saved. but created field do not populated and missing in the left created field list. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2019 19:00:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-escape-special-character-through-regex/m-p/496573#M138379</guid>
      <dc:creator>mrmanishsharma</dc:creator>
      <dc:date>2019-12-04T19:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to escape special character through regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-escape-special-character-through-regex/m-p/496574#M138380</link>
      <description>&lt;P&gt;Please note that if you are saving field extractions to happen automatically and NOT using them with &lt;CODE&gt;rex&lt;/CODE&gt; inside of search &lt;CODE&gt;SPL&lt;/CODE&gt;, you will have to reduce the number of &lt;CODE&gt;\&lt;/CODE&gt; characters by half(ish).  Are you saving this as automatic field extractions?&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jan 2020 02:33:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-escape-special-character-through-regex/m-p/496574#M138380</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2020-01-02T02:33:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to escape special character through regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-escape-special-character-through-regex/m-p/592011#M206079</link>
      <description>&lt;P&gt;I had to use 4 backslashes to escape the URL's single backslash.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2022 19:24:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-escape-special-character-through-regex/m-p/592011#M206079</guid>
      <dc:creator>computermathguy</dc:creator>
      <dc:date>2022-04-01T19:24:38Z</dc:date>
    </item>
  </channel>
</rss>

