<?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 extract API name from below URL field in Splunk, in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-API-name-from-below-URL-field-in-Splunk/m-p/464446#M130885</link>
    <description>&lt;P&gt;I updated it based on your clarification that U is the field name rather than U= being part of the value&lt;/P&gt;</description>
    <pubDate>Thu, 12 Dec 2019 06:13:49 GMT</pubDate>
    <dc:creator>gf13579</dc:creator>
    <dc:date>2019-12-12T06:13:49Z</dc:date>
    <item>
      <title>How to extract API name from below URL field in Splunk,</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-API-name-from-below-URL-field-in-Splunk/m-p/464440#M130879</link>
      <description>&lt;P&gt;U="/my-web/services/v1/2/cartMetadata"&lt;BR /&gt;
U="/my-web/services/v1/2/cartMetadata/delivery"&lt;BR /&gt;
U="/my-web/services/v1/cps/getContent/8efa90da34cb4046ae0c65b2935ff5bc"&lt;/P&gt;

&lt;P&gt;Trying using : ^(?:[^/\n]*/){5}(?P\w+) but getting result as-&lt;/P&gt;

&lt;P&gt;cartMetadata&lt;BR /&gt;
getContent&lt;/P&gt;

&lt;P&gt;But I want this-&lt;BR /&gt;
cartMetadata&lt;BR /&gt;
delivery&lt;BR /&gt;
getContent&lt;/P&gt;

&lt;P&gt;Please help.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2019 06:37:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-API-name-from-below-URL-field-in-Splunk/m-p/464440#M130879</guid>
      <dc:creator>ravimishrabglr</dc:creator>
      <dc:date>2019-12-11T06:37:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract API name from below URL field in Splunk,</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-API-name-from-below-URL-field-in-Splunk/m-p/464441#M130880</link>
      <description>&lt;P&gt;What are the rules for deciding where the API name is?  Your regex extracts the fifth element of the URL, but your desired results call for either the 5th or 6th.  What is the determining factor?&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2019 13:05:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-API-name-from-below-URL-field-in-Splunk/m-p/464441#M130880</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-12-11T13:05:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract API name from below URL field in Splunk,</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-API-name-from-below-URL-field-in-Splunk/m-p/464442#M130881</link>
      <description>&lt;P&gt;This feels hacky and wrong, but it works with your sample data and required outcome:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;\/(?&amp;lt;api_name&amp;gt;[^\/]+)(\/([a-z0-9]{32})|$)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It works on the basis that you &lt;EM&gt;might&lt;/EM&gt; have a 32 character hex string at the end, or might not - but you don't care what it is.&lt;/P&gt;

&lt;P&gt;As per comments from @richgalloway above, it's unclear what the rules should be for determining the value you're after.&lt;/P&gt;

&lt;P&gt;Here's that regex in action:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval U = "/my-web/services/v1/2/cartMetadata /my-web/services/v1/2/cartMetadata/delivery /my-web/services/v1/cps/getContent/8efa90da34cb4046ae0c65b2935ff5bc"
| makemv delim=" " U | mvexpand U
| rex field=U "\/(?[^\/]+)(\/([a-z0-9]{32})|$)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 11 Dec 2019 22:00:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-API-name-from-below-URL-field-in-Splunk/m-p/464442#M130881</guid>
      <dc:creator>gf13579</dc:creator>
      <dc:date>2019-12-11T22:00:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract API name from below URL field in Splunk,</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-API-name-from-below-URL-field-in-Splunk/m-p/464443#M130882</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt; I want last part of the url, if it has 32 digit id in the last then ignore it and get second last part.&lt;BR /&gt;
I tried regex as per &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/57569"&gt;@gf13579&lt;/a&gt; in my below query but it is returning getContent ONLY. please help me if my query is right. U is the field here and i am trying to create a board to show latency of all APIs.&lt;/P&gt;

&lt;P&gt;index="myIndex" host="&lt;EM&gt;myApp&lt;/EM&gt;" source="mySource" sourcetype="mySourceType" (MTHD="POST" OR MTHD="GET") | rex field=U "\/(?[^\/]+)(\/([a-z0-9]{32})|\"$)" | &lt;BR /&gt;
dedup CR,RE | stats count as TotalReq, min(D) as Min, max(D) as Max, avg(D) as Avg, perc95(D) as P95, perc98(D) as P98, perc99(D) as P99 by ApiName, MTHD | addinfo | &lt;BR /&gt;
eval range = info_max_time - info_min_time | eval TPS=round(TotalReq/range,2) | eval Avg=round(Avg,2) | &lt;BR /&gt;
fields ApiName, MTHD, TotalReq, TPS, Min, Max, Avg, P95, P98, P99 &lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:22:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-API-name-from-below-URL-field-in-Splunk/m-p/464443#M130882</guid>
      <dc:creator>ravimishrabglr</dc:creator>
      <dc:date>2020-09-30T03:22:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract API name from below URL field in Splunk,</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-API-name-from-below-URL-field-in-Splunk/m-p/464444#M130883</link>
      <description>&lt;P&gt;@gf13579  Thanks for the answer! I feel it is very close, could you please have a look in my comment in the question for more detail.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2019 06:11:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-API-name-from-below-URL-field-in-Splunk/m-p/464444#M130883</guid>
      <dc:creator>ravimishrabglr</dc:creator>
      <dc:date>2019-12-12T06:11:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract API name from below URL field in Splunk,</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-API-name-from-below-URL-field-in-Splunk/m-p/464445#M130884</link>
      <description>&lt;P&gt;| makeresults &lt;BR /&gt;
 | eval U = "/my-web/services/v1/2/cartMetadata /my-web/services/v1/2/cartMetadata/delivery /my-web/services/v1/cps/getContent/8efa90da34cb4046ae0c65b2935ff5bc" &lt;BR /&gt;
 | makemv delim=" " U | mvexpand U &lt;BR /&gt;
 | rex field=U "\/(?[^\/]+)(\/([a-z0-9]{32})|$)"&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2019 06:13:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-API-name-from-below-URL-field-in-Splunk/m-p/464445#M130884</guid>
      <dc:creator>gf13579</dc:creator>
      <dc:date>2019-12-12T06:13:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract API name from below URL field in Splunk,</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-API-name-from-below-URL-field-in-Splunk/m-p/464446#M130885</link>
      <description>&lt;P&gt;I updated it based on your clarification that U is the field name rather than U= being part of the value&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2019 06:13:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-API-name-from-below-URL-field-in-Splunk/m-p/464446#M130885</guid>
      <dc:creator>gf13579</dc:creator>
      <dc:date>2019-12-12T06:13:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract API name from below URL field in Splunk,</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-API-name-from-below-URL-field-in-Splunk/m-p/464447#M130886</link>
      <description>&lt;P&gt;&lt;IMG src="https://i.imgur.com/E9q86hE.png" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2019 06:15:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-API-name-from-below-URL-field-in-Splunk/m-p/464447#M130886</guid>
      <dc:creator>gf13579</dc:creator>
      <dc:date>2019-12-12T06:15:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract API name from below URL field in Splunk,</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-API-name-from-below-URL-field-in-Splunk/m-p/464448#M130887</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;Give a try, based on length 32 i ignored last part&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval U = "/my-web/services/v1/2/cartMetadata /my-web/services/v1/2/cartMetadata/delivery /my-web/services/v1/cps/getContent/8efa90da34cb4046ae0c65b2935ff5bc" 
| makemv delim=" " U 
| mvexpand U 
| makemv delim="/" U 
| eval API  = if(len(mvindex(U,mvcount(U)-1))==32,mvindex(U,mvcount(U)-2),mvindex(U,mvcount(U)-1))
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Dec 2019 07:02:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-API-name-from-below-URL-field-in-Splunk/m-p/464448#M130887</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2019-12-12T07:02:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract API name from below URL field in Splunk,</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-API-name-from-below-URL-field-in-Splunk/m-p/464449#M130888</link>
      <description>&lt;P&gt;Thank you @gf13579 it worked!!! I will Accept the answer.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2019 10:18:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-API-name-from-below-URL-field-in-Splunk/m-p/464449#M130888</guid>
      <dc:creator>ravimishrabglr</dc:creator>
      <dc:date>2019-12-12T10:18:21Z</dc:date>
    </item>
  </channel>
</rss>

