<?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: Regex &amp; File Directory Path in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-File-Directory-Path/m-p/127467#M34588</link>
    <description>&lt;P&gt;In order to anonymize the source field you need to change index-time settings in props.conf and transforms.conf. Here's the relevant doc: &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Data/Overridedefaulthostassignments"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Data/Overridedefaulthostassignments&lt;/A&gt; (Note: This works with the host field, but the approach is the same.&lt;/P&gt;

&lt;P&gt;As for the specifics, you'll likely need a custom REGEX and FORMAT like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;REGEX = ^source::(.*)/\d{9}(.*)$
FORMAT = source::$1$2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I didn't test these expressions.&lt;/P&gt;</description>
    <pubDate>Mon, 04 Nov 2013 14:45:55 GMT</pubDate>
    <dc:creator>martin_mueller</dc:creator>
    <dc:date>2013-11-04T14:45:55Z</dc:date>
    <item>
      <title>Regex &amp; File Directory Path</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-File-Directory-Path/m-p/127460#M34581</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;

&lt;P&gt;Need a little help with regexing out a portion of a directory path. The examples below are the current structure of paths that I have (the user account is always 9 digits long):&lt;/P&gt;

&lt;P&gt;c:\users\123456789\desktop\&lt;/P&gt;

&lt;P&gt;c:\users\123456789\documents\&lt;/P&gt;

&lt;P&gt;c:\users\123456789\desktop\files&lt;/P&gt;

&lt;P&gt;c:\users\987654321\pictures\&lt;/P&gt;

&lt;P&gt;the goal is to remove the section "123456789" section from the directory. &lt;/P&gt;

&lt;P&gt;Any help or guidance would be greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2013 13:44:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-File-Directory-Path/m-p/127460#M34581</guid>
      <dc:creator>behymejt2012</dc:creator>
      <dc:date>2013-11-04T13:44:53Z</dc:date>
    </item>
    <item>
      <title>Re: Regex &amp; File Directory Path</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-File-Directory-Path/m-p/127461#M34582</link>
      <description>&lt;P&gt;Looks like the submission took out all the \&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2013 13:45:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-File-Directory-Path/m-p/127461#M34582</guid>
      <dc:creator>behymejt2012</dc:creator>
      <dc:date>2013-11-04T13:45:47Z</dc:date>
    </item>
    <item>
      <title>Re: Regex &amp; File Directory Path</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-File-Directory-Path/m-p/127462#M34583</link>
      <description>&lt;P&gt;Not sure what you want to do with the section of numbers.But maybe something like this:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;your_search  |rex field=_raw "C:\\users\\(?&amp;lt;user_id&amp;gt;\d{9})\\" | stats count by user_id&lt;/CODE&gt; &lt;/P&gt;

&lt;P&gt;Does that help?&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2013 13:59:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-File-Directory-Path/m-p/127462#M34583</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2013-11-04T13:59:10Z</dc:date>
    </item>
    <item>
      <title>Re: Regex &amp; File Directory Path</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-File-Directory-Path/m-p/127463#M34584</link>
      <description>&lt;P&gt;Is this the source field, and you want to anonymize the user id?&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2013 14:21:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-File-Directory-Path/m-p/127463#M34584</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2013-11-04T14:21:43Z</dc:date>
    </item>
    <item>
      <title>Re: Regex &amp; File Directory Path</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-File-Directory-Path/m-p/127464#M34585</link>
      <description>&lt;P&gt;Not exactly. ideally it would be best to only have everything after user/123456789.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2013 14:31:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-File-Directory-Path/m-p/127464#M34585</guid>
      <dc:creator>behymejt2012</dc:creator>
      <dc:date>2013-11-04T14:31:28Z</dc:date>
    </item>
    <item>
      <title>Re: Regex &amp; File Directory Path</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-File-Directory-Path/m-p/127465#M34586</link>
      <description>&lt;P&gt;@martin_muller that would work as well. The goal is to hide/anonymize the users id&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2013 14:38:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-File-Directory-Path/m-p/127465#M34586</guid>
      <dc:creator>behymejt2012</dc:creator>
      <dc:date>2013-11-04T14:38:52Z</dc:date>
    </item>
    <item>
      <title>Re: Regex &amp; File Directory Path</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-File-Directory-Path/m-p/127466#M34587</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;

&lt;P&gt;Try this regex:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;\w\:\\users\\\d+(?&amp;lt;yourfield&amp;gt;\\[^\r]*)$
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Maybe you need to substitute the \r of the end of the rex by \n or \R&lt;/P&gt;

&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2013 14:39:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-File-Directory-Path/m-p/127466#M34587</guid>
      <dc:creator>gfuente</dc:creator>
      <dc:date>2013-11-04T14:39:09Z</dc:date>
    </item>
    <item>
      <title>Re: Regex &amp; File Directory Path</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-File-Directory-Path/m-p/127467#M34588</link>
      <description>&lt;P&gt;In order to anonymize the source field you need to change index-time settings in props.conf and transforms.conf. Here's the relevant doc: &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Data/Overridedefaulthostassignments"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Data/Overridedefaulthostassignments&lt;/A&gt; (Note: This works with the host field, but the approach is the same.&lt;/P&gt;

&lt;P&gt;As for the specifics, you'll likely need a custom REGEX and FORMAT like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;REGEX = ^source::(.*)/\d{9}(.*)$
FORMAT = source::$1$2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I didn't test these expressions.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2013 14:45:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-File-Directory-Path/m-p/127467#M34588</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2013-11-04T14:45:55Z</dc:date>
    </item>
    <item>
      <title>Re: Regex &amp; File Directory Path</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-File-Directory-Path/m-p/127468#M34589</link>
      <description>&lt;P&gt;So to remove data do this in props and transforms, requires restart.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;props.conf&lt;BR /&gt;
[source::C:\\users\\*]&lt;BR /&gt;
TRANSFORMS-hide = hide_users_path&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;transforms.conf&lt;BR /&gt;
[hide_users_path]&lt;BR /&gt;
REGEX = source::C:\\users\\\d+\\(.*)&lt;BR /&gt;
FORMAT = source::$1&lt;BR /&gt;
SOURCE_KEY = Metadata:Source&lt;BR /&gt;
DEST_KEY = Metadata:Source&lt;BR /&gt;
WRITE_META = TRUE&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2013 15:06:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-File-Directory-Path/m-p/127468#M34589</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2013-11-04T15:06:04Z</dc:date>
    </item>
  </channel>
</rss>

