<?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: regexp in Splunk in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/regexp-in-Splunk/m-p/565283#M100595</link>
    <description>&lt;P&gt;Thank you for the response but the expression returns URL not&amp;nbsp; baseurl&lt;/P&gt;&lt;P&gt;As I said, I trayed to obtain the baseurl from an url&lt;/P&gt;</description>
    <pubDate>Tue, 31 Aug 2021 07:27:56 GMT</pubDate>
    <dc:creator>laurentiugrama</dc:creator>
    <dc:date>2021-08-31T07:27:56Z</dc:date>
    <item>
      <title>regexp in Splunk</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/regexp-in-Splunk/m-p/565279#M100593</link>
      <description>&lt;P&gt;I tried to find a solution in order to parse some URL to obtain the base but it seems that I cannot succeed.&lt;/P&gt;&lt;P&gt;For the between GET/POST and HTTP I want to return the baseurl&amp;nbsp;&lt;SPAN class="Y2IQFc"&gt;as in the examples below&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;GET /gw/api/aaa/v1/ HTTP - to return /gw/api/aaa/v1&lt;BR /&gt;GET /gw/api/abc/v3 HTTP - to return /gw/api/abc/v3&lt;BR /&gt;POST /gw/api/cba/ HTTP - to return /gw/api/cba&lt;BR /&gt;POST /gw/transactions/swaggers/v2 HTTP - to return /gw/transactions/swaggers/v2&lt;BR /&gt;POST /gw/api/swaggers/v1/asd?dssa HTTP - to return /gw/api/swaggers/v1/asd&lt;BR /&gt;POST /api/swaggers/ HTTP - to return /api/swaggers&lt;BR /&gt;GET /api/cashAccountOpenings/v3/sadsa-123312-1312 HTTP - to return /api/cashAccountOpenings/v3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I added this examples to regex101.com to be easier to find a solution.&lt;/P&gt;&lt;P&gt;&lt;A href="https://regex101.com/r/oLXtw8/1/" target="_blank"&gt;https://regex101.com/r/oLXtw8/1/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Aug 2021 07:04:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/regexp-in-Splunk/m-p/565279#M100593</guid>
      <dc:creator>laurentiugrama</dc:creator>
      <dc:date>2021-08-31T07:04:28Z</dc:date>
    </item>
    <item>
      <title>Re: regexp in Splunk</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/regexp-in-Splunk/m-p/565281#M100594</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/237768"&gt;@laurentiugrama&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;sorry, what's the question?&lt;/P&gt;&lt;P&gt;the regex seems to be correct, even if I'd use an easier regex:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[GET|POST]\s(?&amp;lt;URL&amp;gt;.+)\s+(HTTP)&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 31 Aug 2021 07:21:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/regexp-in-Splunk/m-p/565281#M100594</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2021-08-31T07:21:19Z</dc:date>
    </item>
    <item>
      <title>Re: regexp in Splunk</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/regexp-in-Splunk/m-p/565283#M100595</link>
      <description>&lt;P&gt;Thank you for the response but the expression returns URL not&amp;nbsp; baseurl&lt;/P&gt;&lt;P&gt;As I said, I trayed to obtain the baseurl from an url&lt;/P&gt;</description>
      <pubDate>Tue, 31 Aug 2021 07:27:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/regexp-in-Splunk/m-p/565283#M100595</guid>
      <dc:creator>laurentiugrama</dc:creator>
      <dc:date>2021-08-31T07:27:56Z</dc:date>
    </item>
    <item>
      <title>Re: regexp in Splunk</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/regexp-in-Splunk/m-p/565285#M100596</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/237768"&gt;@laurentiugrama&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;sorry but I don't understand: what do you mean with baseurl?&lt;/P&gt;&lt;P&gt;the name of the field or a part of the URL?&lt;/P&gt;&lt;P&gt;If you want the name of the field you can modify the regex:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "[GET|POST]\s(?&amp;lt;baseurl&amp;gt;.+)\s+(HTTP)"&lt;/LI-CODE&gt;&lt;P&gt;if instead you want a part of the URL, e.g. the first two sections, you could use something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "[GET|POST]\s(?&amp;lt;baseurl&amp;gt;\/\w+\/\w+\/)\s+(HTTP)"&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 31 Aug 2021 07:34:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/regexp-in-Splunk/m-p/565285#M100596</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2021-08-31T07:34:15Z</dc:date>
    </item>
    <item>
      <title>Re: regexp in Splunk</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/regexp-in-Splunk/m-p/565286#M100597</link>
      <description>&lt;P&gt;In the first post I explained what is the URL and what I want to obtain from regext&lt;/P&gt;&lt;P&gt;for first line the url is&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;/gw/api/aaa/v1/&lt;/STRONG&gt; and the baseurl is&amp;nbsp;&lt;STRONG&gt;/gw/api/aaa/v1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;GET &lt;STRONG&gt;/gw/api/aaa/v1/&lt;/STRONG&gt; HTTP - to return &lt;STRONG&gt;/gw/api/aaa/v1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;GET &lt;STRONG&gt;/gw/api/abc/v3&lt;/STRONG&gt; HTTP - to return &lt;STRONG&gt;/gw/api/abc/v3&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;POST /&lt;STRONG&gt;gw/api/cba/&lt;/STRONG&gt; HTTP - to return &lt;STRONG&gt;/gw/api/cba&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;POST &lt;STRONG&gt;/gw/transactions/swaggers/v2&lt;/STRONG&gt; HTTP - to return &lt;STRONG&gt;/gw/transactions/swaggers/v2&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;POST &lt;STRONG&gt;/gw/api/swaggers/v1/asd?dssa&lt;/STRONG&gt; HTTP - to return &lt;STRONG&gt;/gw/api/swaggers/v1/asd&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;POST &lt;STRONG&gt;/api/swaggers/&lt;/STRONG&gt; HTTP - to return &lt;STRONG&gt;/api/swaggers&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;GET &lt;STRONG&gt;/api/cashAccountOpenings/v3/sadsa-123312-1312&lt;/STRONG&gt; HTTP - to return &lt;STRONG&gt;/api/cashAccountOpenings/v3&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Aug 2021 07:48:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/regexp-in-Splunk/m-p/565286#M100597</guid>
      <dc:creator>laurentiugrama</dc:creator>
      <dc:date>2021-08-31T07:48:15Z</dc:date>
    </item>
    <item>
      <title>Re: regexp in Splunk</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/regexp-in-Splunk/m-p/565289#M100598</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/237768"&gt;@laurentiugrama&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;ok, sorry for the misunderstanding!&lt;/P&gt;&lt;P&gt;Please try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=your_index
| rex field=URL "[GET|POST]\s(?&amp;lt;baseurl&amp;gt;.+)\s+(HTTP)"
| rex field=baseurl "(?&amp;lt;baseurl1&amp;gt;.+)\/$"
| rex field=baseurl "(?&amp;lt;baseurl2&amp;gt;.+)((\?\w+$)|(\/sadsa.*))"
| eval baseurl=coalesce(baseurl2,baseurl1,baseurl)
| table URL baseurl&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 31 Aug 2021 08:07:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/regexp-in-Splunk/m-p/565289#M100598</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2021-08-31T08:07:40Z</dc:date>
    </item>
    <item>
      <title>Re: regexp in Splunk</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/regexp-in-Splunk/m-p/565425#M100611</link>
      <description>&lt;P&gt;Your solution it works well.&lt;/P&gt;&lt;P&gt;Do you think that it's possible to have a solution based on only one regexp iteration ?&lt;/P&gt;</description>
      <pubDate>Wed, 01 Sep 2021 07:55:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/regexp-in-Splunk/m-p/565425#M100611</guid>
      <dc:creator>laurentiugrama</dc:creator>
      <dc:date>2021-09-01T07:55:13Z</dc:date>
    </item>
    <item>
      <title>Re: regexp in Splunk</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/regexp-in-Splunk/m-p/565435#M100612</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/237768"&gt;@laurentiugrama&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;probably it's possible, I'll try tomorrow (today I'm out!).&lt;/P&gt;&lt;P&gt;Ciao and happy splunking.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 01 Sep 2021 08:44:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/regexp-in-Splunk/m-p/565435#M100612</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2021-09-01T08:44:09Z</dc:date>
    </item>
    <item>
      <title>Re: regexp in Splunk</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/regexp-in-Splunk/m-p/565549#M100619</link>
      <description>&lt;P&gt;(?&amp;lt;method&amp;gt;\S+)\s(?&amp;lt;path&amp;gt;/[^?]*)(\?(?&amp;lt;query&amp;gt;\S*))?&lt;/P&gt;&lt;P&gt;Typing on my phone, didn't verify it &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Sep 2021 19:33:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/regexp-in-Splunk/m-p/565549#M100619</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-09-01T19:33:23Z</dc:date>
    </item>
  </channel>
</rss>

