<?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 trim URL after the last &amp;quot;/&amp;quot; in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-trim-URL-after-the-last-quot-quot/m-p/408546#M117939</link>
    <description>&lt;P&gt;Try this!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults |eval url="FQDN/A/B/C/file.png"
| eval object=mvindex(split(url,"/"),mvcount(split(url,"/"))-1)
| eval url=rtrim(url,"/"+object)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 28 Jul 2019 02:53:17 GMT</pubDate>
    <dc:creator>HiroshiSatoh</dc:creator>
    <dc:date>2019-07-28T02:53:17Z</dc:date>
    <item>
      <title>How to trim URL after the last "/"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-trim-URL-after-the-last-quot-quot/m-p/408544#M117937</link>
      <description>&lt;P&gt;I'm trying to trim the URL's for a particular search, where it removes everything after the last "/".&lt;BR /&gt;
In other words:&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;From:&lt;BR /&gt;
fqdn/A/B/C/file.png&lt;BR /&gt;
To Return:&lt;BR /&gt;
fqdn/A/B/C&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;I tried using rtrim, but did not work for me. &lt;BR /&gt;
Any help with this will be greatly appreciated!&lt;/P&gt;</description>
      <pubDate>Sat, 27 Jul 2019 18:46:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-trim-URL-after-the-last-quot-quot/m-p/408544#M117937</guid>
      <dc:creator>RaymondN80</dc:creator>
      <dc:date>2019-07-27T18:46:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to trim URL after the last "/"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-trim-URL-after-the-last-quot-quot/m-p/408545#M117938</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;Try this rex&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval url="fqdn/A/B/C/file.png" 
| rex field=url "^(?P&amp;lt;test&amp;gt;.*[\/])" 
| eval result = replace(test,"\/$","")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 28 Jul 2019 02:45:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-trim-URL-after-the-last-quot-quot/m-p/408545#M117938</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2019-07-28T02:45:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to trim URL after the last "/"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-trim-URL-after-the-last-quot-quot/m-p/408546#M117939</link>
      <description>&lt;P&gt;Try this!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults |eval url="FQDN/A/B/C/file.png"
| eval object=mvindex(split(url,"/"),mvcount(split(url,"/"))-1)
| eval url=rtrim(url,"/"+object)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 28 Jul 2019 02:53:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-trim-URL-after-the-last-quot-quot/m-p/408546#M117939</guid>
      <dc:creator>HiroshiSatoh</dc:creator>
      <dc:date>2019-07-28T02:53:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to trim URL after the last "/"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-trim-URL-after-the-last-quot-quot/m-p/408547#M117940</link>
      <description>&lt;P&gt;The &lt;CODE&gt;trim&lt;/CODE&gt; function doesn't do what you think it does, although it would be nice if it did.&lt;/P&gt;

&lt;P&gt;There are other ways to accomplish the task.  The URL Toolkit app will parse the URL for you and let you choose any part(s) you like.&lt;BR /&gt;
The &lt;CODE&gt;rex&lt;/CODE&gt; command can do it, too.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex field=url "(?&amp;lt;url&amp;gt;.*)\/"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 28 Jul 2019 03:09:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-trim-URL-after-the-last-quot-quot/m-p/408547#M117940</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-07-28T03:09:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to trim URL after the last "/"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-trim-URL-after-the-last-quot-quot/m-p/408548#M117941</link>
      <description>&lt;P&gt;There are many ways to do this, including:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex field=url mode=sed "s/\/[^\/]+$//"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 28 Jul 2019 12:23:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-trim-URL-after-the-last-quot-quot/m-p/408548#M117941</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-07-28T12:23:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to trim URL after the last "/"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-trim-URL-after-the-last-quot-quot/m-p/408549#M117942</link>
      <description>&lt;P&gt;Thanks so much! This worked!&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2019 20:22:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-trim-URL-after-the-last-quot-quot/m-p/408549#M117942</guid>
      <dc:creator>RaymondN80</dc:creator>
      <dc:date>2019-07-29T20:22:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to trim URL after the last "/"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-trim-URL-after-the-last-quot-quot/m-p/408550#M117943</link>
      <description>&lt;P&gt;Thanks a lot... this worked as well. Would mark it as "Accept", but I can only accept "one" answer. Appreciate it!&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2019 20:25:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-trim-URL-after-the-last-quot-quot/m-p/408550#M117943</guid>
      <dc:creator>RaymondN80</dc:creator>
      <dc:date>2019-07-29T20:25:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to trim URL after the last "/"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-trim-URL-after-the-last-quot-quot/m-p/408551#M117944</link>
      <description>&lt;P&gt;Thanks a lot... this worked as well. Would mark it as "Accept", but I can only accept "one" answer. Appreciate it!&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2019 20:26:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-trim-URL-after-the-last-quot-quot/m-p/408551#M117944</guid>
      <dc:creator>RaymondN80</dc:creator>
      <dc:date>2019-07-29T20:26:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to trim URL after the last "/"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-trim-URL-after-the-last-quot-quot/m-p/408552#M117945</link>
      <description>&lt;P&gt;Thanks a lot... this worked as well. Would mark it as "Accept", but I can only accept "one" answer. Appreciate it!&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2019 20:27:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-trim-URL-after-the-last-quot-quot/m-p/408552#M117945</guid>
      <dc:creator>RaymondN80</dc:creator>
      <dc:date>2019-07-29T20:27:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to trim URL after the last "/"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-trim-URL-after-the-last-quot-quot/m-p/408553#M117946</link>
      <description>&lt;P&gt;Slightly simplified version:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval url="fqdn/A/B/C/file.png" 
| rex field=url "^(?P&amp;lt;result&amp;gt;.*)/[^/]+$"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Jul 2019 20:28:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-trim-URL-after-the-last-quot-quot/m-p/408553#M117946</guid>
      <dc:creator>jacobpevans</dc:creator>
      <dc:date>2019-07-29T20:28:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to trim URL after the last "/"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-trim-URL-after-the-last-quot-quot/m-p/408554#M117947</link>
      <description>&lt;P&gt;You can &lt;CODE&gt;UpVote&lt;/CODE&gt; as many answers or comments as you like, especially those that taught you something new and worked.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2019 21:00:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-trim-URL-after-the-last-quot-quot/m-p/408554#M117947</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-07-29T21:00:24Z</dc:date>
    </item>
  </channel>
</rss>

