<?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 edit my current rex search to extract path names? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-current-rex-search-to-extract-path-names/m-p/190944#M54951</link>
    <description>&lt;P&gt;thank you : ) &lt;/P&gt;</description>
    <pubDate>Tue, 11 Aug 2015 08:13:34 GMT</pubDate>
    <dc:creator>Federica_92</dc:creator>
    <dc:date>2015-08-11T08:13:34Z</dc:date>
    <item>
      <title>How to edit my current rex search to extract path names?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-current-rex-search-to-extract-path-names/m-p/190938#M54945</link>
      <description>&lt;P&gt;Hi everyone, &lt;/P&gt;

&lt;P&gt;I have a problem building an SPL query with the regular expression:&lt;/P&gt;

&lt;P&gt;This is an example of my data:&lt;BR /&gt;
These are all pathname&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; root/home/1/2/3/4/5/6/
 root/home/1/2/3/4
 root/home/0/9/11
 root/home/0/9/22
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and so on...&lt;/P&gt;

&lt;P&gt;I would like edit my data in the base of one specific folder, so for example, if the folder is 2, I would like to obtain:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; root/home/1/*
 root/home/1/*
 root/home/0/9/11
 root/home/0/9/22
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If the folder was home my data are:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;root/*
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Actually, all my pathname are raw data, so to extract them I use this search, that's work fine:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  index=main | rex "\\s\\-\\s\\[(?&amp;lt;path_d&amp;gt;.+)\]" | fields path_d
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How can I create a new search, using the results of this previous search, that do what I have ask before?&lt;/P&gt;

&lt;P&gt;Please, let me know. &lt;/P&gt;</description>
      <pubDate>Fri, 20 Mar 2015 17:22:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-current-rex-search-to-extract-path-names/m-p/190938#M54945</guid>
      <dc:creator>Federica_92</dc:creator>
      <dc:date>2015-03-20T17:22:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my current rex search to extract path names?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-current-rex-search-to-extract-path-names/m-p/190939#M54946</link>
      <description>&lt;P&gt;I'd like to confirm what it is that you want to do by asking some questions:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Question 1:&lt;/STRONG&gt;&lt;BR /&gt;
Do your events only contain the path that you want, or are you getting the path as you describe in the first code box from the extracted values from your &lt;STRONG&gt;rex&lt;/STRONG&gt; command (in the &lt;CODE&gt;path_d&lt;/CODE&gt; result)?&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Question 2:&lt;/STRONG&gt;&lt;BR /&gt;
Would you like the final output of the search from the events in the first box to look exactly like the results in the second box (specifically that you also have 4 entries)?&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Question 3:&lt;/STRONG&gt;&lt;BR /&gt;
Do you only want one result as you show in the third box (only one event), or would you want four evants all the same (your results seem to be inconsistent if not)?&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Question 4:&lt;/STRONG&gt;&lt;BR /&gt;
Do you want the results that don't match your criteria (e.g. &lt;CODE&gt;2&lt;/CODE&gt; or &lt;CODE&gt;home&lt;/CODE&gt; subdirectories) to be unchanged?&lt;/P&gt;</description>
      <pubDate>Fri, 20 Mar 2015 21:21:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-current-rex-search-to-extract-path-names/m-p/190939#M54946</guid>
      <dc:creator>cpetterborg</dc:creator>
      <dc:date>2015-03-20T21:21:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my current rex search to extract path names?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-current-rex-search-to-extract-path-names/m-p/190940#M54947</link>
      <description>&lt;P&gt;Question1 :&lt;BR /&gt;
To get the path, I'm using the rex command, and they are: path_d results.&lt;/P&gt;

&lt;P&gt;Question2 :&lt;BR /&gt;
I can have infinite entry, like 10000 of events, in base of the parameters of the user, I would like wildcard a specific parameter. And I would like have the results of only the second box. In this case the parameter was 2&lt;/P&gt;

&lt;P&gt;Question 3:&lt;BR /&gt;
Yes, I would like only one results, so dedup the copy, to have consistent data. &lt;BR /&gt;
I have written 2 equals pathname in this example, to make understand at the other people&lt;/P&gt;

&lt;P&gt;Question4:&lt;BR /&gt;
Yes, if they don't match my criteria(parameter) they have to stay unchange&lt;/P&gt;

&lt;P&gt;Thank you so much &lt;/P&gt;</description>
      <pubDate>Mon, 23 Mar 2015 09:25:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-current-rex-search-to-extract-path-names/m-p/190940#M54947</guid>
      <dc:creator>Federica_92</dc:creator>
      <dc:date>2015-03-23T09:25:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my current rex search to extract path names?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-current-rex-search-to-extract-path-names/m-p/190941#M54948</link>
      <description>&lt;P&gt;For now, I have created 2 queries, one that write all the results that are not changing, and another one that write the results that are changing:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  search: mvc.tokenSafe("index=main File:read | rex \"\\s\\-\\s\\[(?&amp;lt;path_dd&amp;gt;.+)\ $mytoken2$\" | dedup path_dd | eval path=path_dd+\"*\" | sort by path| table path | outputlookup output.csv append=True")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 23 Mar 2015 12:34:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-current-rex-search-to-extract-path-names/m-p/190941#M54948</guid>
      <dc:creator>Federica_92</dc:creator>
      <dc:date>2015-03-23T12:34:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my current rex search to extract path names?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-current-rex-search-to-extract-path-names/m-p/190942#M54949</link>
      <description>&lt;P&gt;you can explaint your lab correctly?&lt;/P&gt;</description>
      <pubDate>Tue, 24 Mar 2015 13:14:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-current-rex-search-to-extract-path-names/m-p/190942#M54949</guid>
      <dc:creator>fdi01</dc:creator>
      <dc:date>2015-03-24T13:14:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my current rex search to extract path names?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-current-rex-search-to-extract-path-names/m-p/190943#M54950</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;H4&gt;for "2":&lt;/H4&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main | rex "\\s\\-\\s\\[(?&amp;lt;path_d&amp;gt;.+)\]" | eval new_path=path_d | rex field=new_path mode=sed "s%/2/.*%/*%" | stats values(new_path)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;H4&gt;for "home":&lt;/H4&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main | rex "\\s\\-\\s\\[(?&amp;lt;path_d&amp;gt;.+)\]" | eval new_path=path_d | rex field=new_path mode=sed "s%/home/.*%/*%" | stats values(new_path)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Aug 2015 16:50:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-current-rex-search-to-extract-path-names/m-p/190943#M54950</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-08-10T16:50:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my current rex search to extract path names?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-current-rex-search-to-extract-path-names/m-p/190944#M54951</link>
      <description>&lt;P&gt;thank you : ) &lt;/P&gt;</description>
      <pubDate>Tue, 11 Aug 2015 08:13:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-current-rex-search-to-extract-path-names/m-p/190944#M54951</guid>
      <dc:creator>Federica_92</dc:creator>
      <dc:date>2015-08-11T08:13:34Z</dc:date>
    </item>
  </channel>
</rss>

