<?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 How to replace \\ with \? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-replace-with/m-p/646869#M110004</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to use a lookup to whitelist/exclude some values from search results such as process_name.&lt;/P&gt;
&lt;P&gt;But whenever I run a search with just the lookup to verify the possible exclusion, every instance of backlash shows as double backlash.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Like this:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Search to verify whitelist/exclusion:&lt;/P&gt;
&lt;P&gt;| inputlookup whitelist&lt;BR /&gt;| fields&amp;nbsp; whitelisted_process_name&amp;nbsp;&lt;BR /&gt;| rename whitelisted_process_name as process_name&lt;BR /&gt;| format&lt;BR /&gt;&lt;BR /&gt;Search results: (process_name= C:\\...\\...\\...\\...\\...&lt;/P&gt;
&lt;P&gt;What is actually on the lookup:&amp;nbsp;process_name= C:\...\...\...\...\...&lt;BR /&gt;&lt;BR /&gt;I have tried replacing the double backlash with a single one using&amp;nbsp; the following command and several other variations. But does not seen to be working.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;```| eval process_name=replace(process_name,"\\\\(.)","\")```&lt;BR /&gt;```| eval process_name=replace(process_name,"\\\\(.)","\1")```&lt;BR /&gt;```| eval process_name=replace (process_name,"(\\\\)","\")```&lt;BR /&gt;``` | replace "*\\\\*" WITH "\" IN process_name&amp;nbsp; ```&lt;/P&gt;
&lt;P&gt;Any help will be much appreciated.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 15 Jun 2023 17:38:11 GMT</pubDate>
    <dc:creator>adespino</dc:creator>
    <dc:date>2023-06-15T17:38:11Z</dc:date>
    <item>
      <title>How to replace \\ with \?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-replace-with/m-p/646869#M110004</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to use a lookup to whitelist/exclude some values from search results such as process_name.&lt;/P&gt;
&lt;P&gt;But whenever I run a search with just the lookup to verify the possible exclusion, every instance of backlash shows as double backlash.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Like this:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Search to verify whitelist/exclusion:&lt;/P&gt;
&lt;P&gt;| inputlookup whitelist&lt;BR /&gt;| fields&amp;nbsp; whitelisted_process_name&amp;nbsp;&lt;BR /&gt;| rename whitelisted_process_name as process_name&lt;BR /&gt;| format&lt;BR /&gt;&lt;BR /&gt;Search results: (process_name= C:\\...\\...\\...\\...\\...&lt;/P&gt;
&lt;P&gt;What is actually on the lookup:&amp;nbsp;process_name= C:\...\...\...\...\...&lt;BR /&gt;&lt;BR /&gt;I have tried replacing the double backlash with a single one using&amp;nbsp; the following command and several other variations. But does not seen to be working.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;```| eval process_name=replace(process_name,"\\\\(.)","\")```&lt;BR /&gt;```| eval process_name=replace(process_name,"\\\\(.)","\1")```&lt;BR /&gt;```| eval process_name=replace (process_name,"(\\\\)","\")```&lt;BR /&gt;``` | replace "*\\\\*" WITH "\" IN process_name&amp;nbsp; ```&lt;/P&gt;
&lt;P&gt;Any help will be much appreciated.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2023 17:38:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-replace-with/m-p/646869#M110004</guid>
      <dc:creator>adespino</dc:creator>
      <dc:date>2023-06-15T17:38:11Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing \\ with \</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-replace-with/m-p/646900#M110009</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/255930"&gt;@adespino&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I'm not exactly sure what you are trying to do, but it's the format command that is adding the double backslashes to the search field.&amp;nbsp; Generally you'd use this command if you required a subsearch in your base search to filter the result set (include or exclude).&amp;nbsp; If that was the use case, the escaped backslashes are needed and make sense.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/9.0.5/SearchReference/Format" target="_blank" rel="noopener"&gt;https://docs.splunk.com/Documentation/Splunk/9.0.5/SearchReference/Format&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Maybe providing the whole query will help clarify what you want to achieve.&lt;BR /&gt;&lt;BR /&gt;As a final note, if you still want to make the double backslashes single again, you could use a sed command like in this example...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval whitelisted_process_name="c:\some\folder\here"
| fields  whitelisted_process_name 
| rename whitelisted_process_name as process_name
| format
| rex mode=sed field=search "s/\\\\\\\/\\\/g"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Hope that helps&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2023 03:37:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-replace-with/m-p/646900#M110009</guid>
      <dc:creator>yeahnah</dc:creator>
      <dc:date>2023-06-14T03:37:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace \\ with \?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-replace-with/m-p/647651#M110135</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/158935"&gt;@yeahnah&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Basically, I have a SPL that detects several files modification within short time as part as possible ransomware infection.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Unfortunately, I cannot share the whole search since due to security reasons.&lt;BR /&gt;&lt;BR /&gt;What I can tell you is that the search uses a couple of data models to first provide information such as process name and object name, then identifies several files or folder modification.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;We have identified this search produces several False Positive from regular business activities so we were trying to whitelist those using a lookup that contains some relevant fields to later be exclude/whitelist.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I run this specific portion of the search by itself it looks appropriately without adding the double back slash&amp;nbsp;&lt;/P&gt;&lt;P&gt;| inputlookup whitelist&lt;BR /&gt;| fields&amp;nbsp; whitelisted_process_name&amp;nbsp;&lt;BR /&gt;| rename whitelisted_process_name as process_name&lt;BR /&gt;| format&lt;BR /&gt;| rex mode=sed field=search "s/\\\\\\\/\\\/g"&lt;BR /&gt;&lt;BR /&gt;Result: (process_name="C:/Program Files/Computer/)&lt;BR /&gt;&lt;BR /&gt;But whenever I implement this portion of the search to the rest of the search to verify actual real results it adds again the double back lash.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Result seeing in job inspector: (process_name="C://Program Files//Computer//)&lt;/P&gt;&lt;P class=""&gt;Search estructure example&lt;BR /&gt;&lt;BR /&gt;1. Datamodel=File_or_Folder_Modification calling important files.&lt;BR /&gt;&lt;BR /&gt;2.Some field manipulation&lt;/P&gt;&lt;P class=""&gt;3.Another data model to verify process id or other file values modification&lt;BR /&gt;&lt;BR /&gt;4.Lookup related commands to attempt whitelisting.&lt;BR /&gt;&lt;BR /&gt;5. Stats&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The issue in here is that if someone goes into the lookup and enters a value to be whitelist with a single backlash it will not be match because the actual lookup is looking for double backlash&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much for the help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2023 16:39:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-replace-with/m-p/647651#M110135</guid>
      <dc:creator>adespino</dc:creator>
      <dc:date>2023-06-20T16:39:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace \\ with \?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-replace-with/m-p/647656#M110136</link>
      <description>&lt;P&gt;Does this help?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval process_name="C:\\\\...\\\\...\\\\...\\\\...\\\\..."
| eval original_process_name=process_name
| rex mode=sed field=process_name "s/\\\\\\\\/\\\\/g"&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 20 Jun 2023 17:04:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-replace-with/m-p/647656#M110136</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-06-20T17:04:23Z</dc:date>
    </item>
  </channel>
</rss>

