<?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: Interesting regex in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Interesting-regex/m-p/434912#M124045</link>
    <description>&lt;P&gt;I started with:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "/rest(Operation)?/([^/]+/){4}(?P&amp;lt;thefieldname&amp;gt;[^/? ]+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But I don't have enough info on what your trying to match here, I mean if icontrol is always there then:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "/rest(Operation)?/icontrol/([^/ ]+/)+(?P&amp;lt;thefieldname&amp;gt;[^/? ]+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Either way I think you need more examples to truly make this work...try those two on &lt;A href="https://regex101.com/"&gt;https://regex101.com/&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 15 Oct 2018 22:31:02 GMT</pubDate>
    <dc:creator>gjanders</dc:creator>
    <dc:date>2018-10-15T22:31:02Z</dc:date>
    <item>
      <title>Interesting regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Interesting-regex/m-p/434909#M124042</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have the below data and looking to determine the API call name . &lt;/P&gt;

&lt;P&gt;For the first one the name would be&lt;/P&gt;

&lt;P&gt;alarmSessions&lt;/P&gt;

&lt;P&gt;The follow the same pattern until the 4th one.  The API name in that one is&lt;/P&gt;

&lt;P&gt;actionTemplate&lt;/P&gt;

&lt;P&gt;Also sometimes the /rest/icontrol will be /rest/async/icontrol or /restOperation/(whatever)&lt;/P&gt;

&lt;P&gt;Any regex gurus out there that can help with with one??&lt;/P&gt;

&lt;P&gt;Thank you!!!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;10/14/18
6:59:59.000 PM  
"portal.blah.com" 10.210.192.15 "172.58.72.114, 10.210.192.15" - - [14/Oct/2018:19:59:59 -0400] "GET /rest/icontrol/sites/239466/alarmSessions?maxResults=1 HTTP/1.1" 200 360 0 UCT-9178 "-" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15G77" "-" "-"
date_hour = 19 date_mday =  14 date_minute =    59 date_month = october date_second =   59 date_wday =  sunday date_year =  2018 date_zone =    -240 maxResults =   1 timeendpos =  105 timestartpos =  79
10/14/18
6:59:59.000 PM  
"portal.blah.com" 10.210.192.15 "174.238.30.224, 10.210.192.15" - - [14/Oct/2018:19:59:59 -0400] "GET /rest/async/icontrol/sites/607321/deltas?spsId=55056 HTTP/1.1" 200 1574 0 UCT-1794 "-" "Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/16A366" "-" "-"
date_hour = 19 date_mday =  14 date_minute =    59 date_month = october date_second =   59 date_wday =  sunday date_year =  2018 date_zone =    -240 spsId =    55056 timeendpos =  106 timestartpos =  80
10/14/18
6:59:59.000 PM  
"portal.blah.com" 10.210.192.15 "172.58.22.161, 10.210.192.15" - - [14/Oct/2018:19:59:59 -0400] "GET /rest/icontrol/sites/244140/cmsInfo HTTP/1.1" 200 970 0 UCT-31983 "-" "Mozilla/5.0 (Linux; Android 8.0.0; SM-G935T Build/R16NW; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/69.0.3497.100 Mobile Safari/537.36" "-" "-"
date_hour = 19 date_mday =  14 date_minute =    59 date_month = october date_second =   59 date_wday =  sunday date_year =  2018 date_zone =    -240 timeendpos =   105 timestartpos =  79
10/14/18
6:59:59.000 PM  
"portal.blah.com" 10.210.192.5 "107.77.197.229, 10.210.192.5" - - [14/Oct/2018:19:59:59 -0400] "GET /rest/icontrol/sites/158424/templates/actionTemplates HTTP/1.1" 200 3374 0 UCT-60344 "-" "Mozilla/5.0 (Linux; Android 8.0.0; SM-N950U Build/R16NW; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/69.0.3497.100 Mobile Safari/537.36" "-" "-"
date_hour = 19 date_mday =  14 date_minute =    59 date_month = october date_second =   59 date_wday =  sunday date_year =  2018 date_zone =    -240 timeendpos =   104 timestartpos =  78
10/14/18
6:59:59.000 PM  
"portal.blah.com" 10.210.192.15 "172.58.22.161, 10.210.192.15" - - [14/Oct/2018:19:59:59 -0400] "GET /rest/icontrol/sites/244140/rules HTTP/1.1" 200 1694 0 UCT-131279 "-" "Mozilla/5.0 (Linux; Android 8.0.0; SM-G935T Build/R16NW; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/69.0.3497.100 Mobile Safari/537.36" "-" "-"
date_hour = 19 date_mday =  14 date_minute =    59 date_month = october date_second =   59 date_wday =  sunday date_year =  2018 date_zone =    -240 timeendpos =   105 timestartpos =  79
10/14/18
6:59:59.000 PM  
"portal.blah.com" 10.210.192.15 "172.58.73.206, 10.210.192.15" - - [14/Oct/2018:19:59:59 -0400] "POST /rest/icontrol/sites/612724/network/instances/13b0ce18140337362f.1.0/points/isOn?value=false HTTP/1.1" 202 9 0 UCT-37015 "-" "Mozilla/5.0 (Linux; Android 7.1.1; SM-J700T Build/NMF26X; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/69.0.3497.100 Mobile Safari/537.36" "-" "-"
date_hour = 19 date_mday =  14 date_minute =    59 date_month = october date_second =   59 date_wday =  sunday date_year =  2018 date_zone =    -240 timeendpos =   105 timestartpos =  79 value =  false
10/14/18
6:59:59.000 PM  
"portal.blah.com" 10.210.192.15 "107.77.197.229, 10.210.192.15" - - [14/Oct/2018:19:59:59 -0400] "GET /rest/icontrol/sites/158424/templates/actionTemplates HTTP/1.1" 200 3374 0 UCT-52230 "-" "Mozilla/5.0 (Linux; Android 8.0.0; SM-N950U Build/R16NW; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/69.0.3497.100 Mobile Safari/537.36" "-" "-"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Oct 2018 20:31:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Interesting-regex/m-p/434909#M124042</guid>
      <dc:creator>dbcase</dc:creator>
      <dc:date>2018-10-15T20:31:37Z</dc:date>
    </item>
    <item>
      <title>Re: Interesting regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Interesting-regex/m-p/434910#M124043</link>
      <description>&lt;P&gt;Try this for GET&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; rex field=_raw "GET \W+\w+\S+\d+\W+(?&amp;lt;text&amp;gt;\w+)\?"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Oct 2018 22:24:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Interesting-regex/m-p/434910#M124043</guid>
      <dc:creator>Vijeta</dc:creator>
      <dc:date>2018-10-15T22:24:37Z</dc:date>
    </item>
    <item>
      <title>Re: Interesting regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Interesting-regex/m-p/434911#M124044</link>
      <description>&lt;P&gt;Hi dbcase,&lt;/P&gt;

&lt;P&gt;Not that I'm an regex expert &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; But give this a try, it worked on your provided samples:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; ... | rex "\/(?&amp;lt;myREST&amp;gt;\w+)(?:\?.+|\s)HTTP"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will give you a field called &lt;CODE&gt;myREST&lt;/CODE&gt; with values like &lt;CODE&gt;alarmSessions&lt;/CODE&gt;, &lt;CODE&gt;isOn&lt;/CODE&gt; or &lt;CODE&gt;cmsInfo&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Mon, 15 Oct 2018 22:25:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Interesting-regex/m-p/434911#M124044</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2018-10-15T22:25:41Z</dc:date>
    </item>
    <item>
      <title>Re: Interesting regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Interesting-regex/m-p/434912#M124045</link>
      <description>&lt;P&gt;I started with:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "/rest(Operation)?/([^/]+/){4}(?P&amp;lt;thefieldname&amp;gt;[^/? ]+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But I don't have enough info on what your trying to match here, I mean if icontrol is always there then:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "/rest(Operation)?/icontrol/([^/ ]+/)+(?P&amp;lt;thefieldname&amp;gt;[^/? ]+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Either way I think you need more examples to truly make this work...try those two on &lt;A href="https://regex101.com/"&gt;https://regex101.com/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Oct 2018 22:31:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Interesting-regex/m-p/434912#M124045</guid>
      <dc:creator>gjanders</dc:creator>
      <dc:date>2018-10-15T22:31:02Z</dc:date>
    </item>
    <item>
      <title>Re: Interesting regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Interesting-regex/m-p/434913#M124046</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;... | rex "sites\/\d+\/(?:templates\/)?(?&amp;lt;APIcall&amp;gt;[^?\s]+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Returns these results for APIcall:&lt;/P&gt;

&lt;P&gt;Match 1&lt;BR /&gt;
Group &lt;CODE&gt;APIcall&lt;/CODE&gt; 160-173 &lt;CODE&gt;alarmSessions&lt;/CODE&gt;&lt;BR /&gt;
Match 2&lt;BR /&gt;
Group &lt;CODE&gt;APIcall&lt;/CODE&gt; 730-736 &lt;CODE&gt;deltas&lt;/CODE&gt;&lt;BR /&gt;
Match 3&lt;BR /&gt;
Group &lt;CODE&gt;APIcall&lt;/CODE&gt; 1284-1291       &lt;CODE&gt;cmsInfo&lt;/CODE&gt;&lt;BR /&gt;
Match 4&lt;BR /&gt;
Group &lt;CODE&gt;APIcall&lt;/CODE&gt; 1863-1878       &lt;CODE&gt;actionTemplates&lt;/CODE&gt;&lt;BR /&gt;
Match 5&lt;BR /&gt;
Group &lt;CODE&gt;APIcall&lt;/CODE&gt; 2442-2447       &lt;CODE&gt;rules&lt;/CODE&gt;&lt;BR /&gt;
Match 6&lt;BR /&gt;
Group &lt;CODE&gt;APIcall&lt;/CODE&gt; 3013-3065       &lt;CODE&gt;network/instances/13b0ce18140337362f.1.0/points/isOn&lt;/CODE&gt;&lt;BR /&gt;
Match 7&lt;BR /&gt;
Group &lt;CODE&gt;APIcall&lt;/CODE&gt; 3667-3682       &lt;CODE&gt;actionTemplates&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Your intro made it look to me like you wanted everything after sites/somenumber except in the 4th you specifically said the result should be &lt;CODE&gt;actionTemplate&lt;/CODE&gt; so I skipped /templates/. However, you did not say that #6 should be just &lt;CODE&gt;isOn&lt;/CODE&gt; so I  include the longer result for that one. If you wanted just what MuS returned, you are also all set.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Oct 2018 22:58:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Interesting-regex/m-p/434913#M124046</guid>
      <dc:creator>wrangler2x</dc:creator>
      <dc:date>2018-10-15T22:58:06Z</dc:date>
    </item>
  </channel>
</rss>

