<?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: Field Extraction With Backslash in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-With-Backslash/m-p/330927#M98503</link>
    <description>&lt;P&gt;I am providing sourcetype.&lt;/P&gt;</description>
    <pubDate>Thu, 07 Dec 2017 16:10:48 GMT</pubDate>
    <dc:creator>michaeldeck</dc:creator>
    <dc:date>2017-12-07T16:10:48Z</dc:date>
    <item>
      <title>Field Extraction With Backslash</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-With-Backslash/m-p/330921#M98497</link>
      <description>&lt;P&gt;I am attempting to extract a user field from a log file using the following regex:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?=[^v]*(?:virtual address: |v.*virtual address: ))user:\s+DOMAIN\\(?P&amp;lt;user&amp;gt;[^,]+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here is a sample event:&lt;BR /&gt;
"Dec  7 07:44:31 net.domain.com Dec 07 07:44:31 name02 servic.exe[1124]: Proxy: Client XG RPC session indication, user: DOMAIN\username, virtual address: 127.0.0.1, IMP handle: 0x000000003a5d3a1f, client version: 1.04, build: 1111"&lt;/P&gt;

&lt;P&gt;This regex works correctly in regex101 and returns only the username as desired "username". This doesn't find a match in Splunk and I can only seem to get the extraction to work if I omit the backslash and extract the user field as "DOMAIN\username". What is the correct syntax in Splunk to escape a backslash?&lt;/P&gt;</description>
      <pubDate>Thu, 07 Dec 2017 15:37:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-With-Backslash/m-p/330921#M98497</guid>
      <dc:creator>michaeldeck</dc:creator>
      <dc:date>2017-12-07T15:37:51Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction With Backslash</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-With-Backslash/m-p/330922#M98498</link>
      <description>&lt;P&gt;Try  three back-slash&lt;/P&gt;

&lt;P&gt;This one is working perfectly fine.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="Dec 7 07:44:31 net.domain.com Dec 07 07:44:31 name02 servic.exe[1124]: Proxy: Client XG RPC session indication, user: DOMAIN\username, virtual address: 127.0.0.1, IMP handle: 0x000000003a5d3a1f, client version: 1.04, build: 1111"
| rex "(?=[^v]*(?:virtual address: |v.*virtual address: ))user:\s+DOMAIN\\\(?P&amp;lt;user&amp;gt;[^,]+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Dec 2017 15:43:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-With-Backslash/m-p/330922#M98498</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2017-12-07T15:43:47Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction With Backslash</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-With-Backslash/m-p/330923#M98499</link>
      <description>&lt;P&gt;Just use 3 backslash, like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?=[^v]*(?:virtual address: |v.*virtual address: ))user:\s+DOMAIN\\\(?P&amp;lt;user&amp;gt;[^,]+)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Dec 2017 15:44:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-With-Backslash/m-p/330923#M98499</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-12-07T15:44:38Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction With Backslash</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-With-Backslash/m-p/330924#M98500</link>
      <description>&lt;P&gt;3 backslashes in the field extraction give me the following error:&lt;/P&gt;

&lt;P&gt;Error in 'rex' command: Encountered the following error while compiling the regex '(?ms)(?=[^v]*(?:virtual address: |v.*virtual address: ))user:\s+DOMAIN\\(?P[^,]+)': Regex: unmatched closing parenthesis&lt;/P&gt;

&lt;P&gt;In the error, it also seems to add more backslashes even though I only have 3 in my original regex.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:10:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-With-Backslash/m-p/330924#M98500</guid>
      <dc:creator>michaeldeck</dc:creator>
      <dc:date>2020-09-29T17:10:00Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction With Backslash</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-With-Backslash/m-p/330925#M98501</link>
      <description>&lt;P&gt;Your suggestion works in regular search, but I receive the following error within the field extraction:&lt;/P&gt;

&lt;P&gt;Error in 'rex' command: Encountered the following error while compiling the regex '(?ms)(?=[^v]*(?:virtual address: |v.*virtual address: ))user:\s+DOMAIN\\(?P[^,]+)': Regex: unmatched closing parenthesis&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:10:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-With-Backslash/m-p/330925#M98501</guid>
      <dc:creator>michaeldeck</dc:creator>
      <dc:date>2020-09-29T17:10:05Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction With Backslash</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-With-Backslash/m-p/330926#M98502</link>
      <description>&lt;P&gt;When I tried in my splunk instance with you regex &lt;CODE&gt;(?=[^v]*(?:virtual address: |v.*virtual address: ))user:\s+DOMAIN\\(?P&amp;lt;user&amp;gt;[^,]+)&lt;/CODE&gt;, it's working perfectly fine and I have indexed sample data which you have provided and it is extracting &lt;CODE&gt;user&lt;/CODE&gt; field.&lt;/P&gt;

&lt;P&gt;Are you providing &lt;CODE&gt;sourcetype&lt;/CODE&gt; OR &lt;CODE&gt;source&lt;/CODE&gt; with correct value while creating field extraction?&lt;/P&gt;</description>
      <pubDate>Thu, 07 Dec 2017 16:07:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-With-Backslash/m-p/330926#M98502</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2017-12-07T16:07:12Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction With Backslash</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-With-Backslash/m-p/330927#M98503</link>
      <description>&lt;P&gt;I am providing sourcetype.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Dec 2017 16:10:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-With-Backslash/m-p/330927#M98503</guid>
      <dc:creator>michaeldeck</dc:creator>
      <dc:date>2017-12-07T16:10:48Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction With Backslash</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-With-Backslash/m-p/330928#M98504</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/41431"&gt;@michaeldeck&lt;/a&gt;&lt;/P&gt;

&lt;P&gt;please try this,&lt;/P&gt;

&lt;P&gt;| makeresults | eval test="Dec 7 07:44:31 net.domain.com Dec 07 07:44:31 name02 servic.exe[1124]: Proxy: Client XG RPC session indication, user: DOMAIN\username, virtual address: 127.0.0.1, IMP handle: 0x000000003a5d3a1f, client version: 1.04, build: 1111" | rex field=test "(?=[^v]*(?:virtual address: |v.*virtual address: ))user:\s+\w+.(?P&amp;lt;user&amp;gt;[^,]+)"&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:10:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-With-Backslash/m-p/330928#M98504</guid>
      <dc:creator>sbbadri</dc:creator>
      <dc:date>2020-09-29T17:10:11Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction With Backslash</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-With-Backslash/m-p/330929#M98505</link>
      <description>&lt;P&gt;Actually try with 4 backslash only.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?=[^v]*(?:virtual address: |v.*virtual address: ))user:\s+DOMAIN\\\\(?P&amp;lt;user&amp;gt;[^,]+)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Dec 2017 16:30:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-With-Backslash/m-p/330929#M98505</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-12-07T16:30:30Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction With Backslash</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-With-Backslash/m-p/330930#M98506</link>
      <description>&lt;P&gt;Try using \x5c:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;user:\s+DOMAIN\x5c(?P&amp;lt;user&amp;gt;[^\,]+)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Dec 2017 16:35:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-With-Backslash/m-p/330930#M98506</guid>
      <dc:creator>wenthold</dc:creator>
      <dc:date>2017-12-07T16:35:24Z</dc:date>
    </item>
  </channel>
</rss>

