<?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 Regex string end of the url and in between in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-string-end-of-the-url-and-in-between/m-p/403737#M169354</link>
    <description>&lt;P&gt;10.1.151.100 [18/May/2018:09:09:57 +0200] "GET &lt;A href="http://example.com/DCQ/templates/GetAggregated?channel=TV&amp;amp;contentId=4ek4k4&amp;amp;lang=eng" target="_blank"&gt;http://example.com/DCQ/templates/GetAggregated?channel=TV&amp;amp;contentId=4ek4k4&amp;amp;lang=eng&lt;/A&gt; HTTP/1.1" 200 2856 hit 0.000111 hit - 154.176.135.239&lt;BR /&gt;
10.1.51.16 [18/May/2018:09:20:42 +0200] "GET &lt;A href="http://video-play.vodacom.co.za/AVS/besc?action=GetIsFavorite&amp;amp;channel=IPHONE&amp;amp;contentId=1200668" target="_blank"&gt;http://video-play.vodacom.co.za/AVS/besc?action=GetIsFavorite&amp;amp;channel=IPHONE&amp;amp;contentId=1200668&lt;/A&gt; HTTP/1.1" 200 113 miss 0.007757 miss - 19.392.33.103&lt;BR /&gt;
10.1.51.16 [18/May/2018:08:37:51 +0200] "GET &lt;A href="http://example.com/AVS/besc?username=00007&amp;amp;channel=ANDROID&amp;amp;action=GetAccountList" target="_blank"&gt;http://example.com/AVS/besc?username=00007&amp;amp;channel=ANDROID&amp;amp;action=GetAccountList&lt;/A&gt; HTTP/1.1" 200 1516 miss 0.030941 miss - 203.122.32.11&lt;/P&gt;

&lt;P&gt;I tried this but it does not print the ones with action=&amp;lt;&amp;gt; that are at the end of the url. &lt;BR /&gt;
index=index-name_idx earliest=-1h | rex "(?i)action=(?P[^&amp;amp;]+)" |stats count by test&lt;BR /&gt;
index=index-name_idx earliest=-1h | rex "(?i)action=(?P[^&amp;amp;]+|[\s]+)" |stats count by test&lt;/P&gt;

&lt;P&gt;The result i get is: &lt;BR /&gt;
CheckSession    444&lt;BR /&gt;
DeleteFavourite 1&lt;BR /&gt;
GetAccountList  116&lt;BR /&gt;
GetAccountList HTTP/1.1" 200 1516 miss 0.030941 miss - 119.92.253.103   1&lt;BR /&gt;
GetAccountList HTTP/1.1" 200 1898 miss 0.029884 miss - 119.92.253.103   1&lt;BR /&gt;
GetAccountList HTTP/1.1" 200 1902 miss 0.023020 miss - 119.92.253.103       1&lt;/P&gt;

&lt;P&gt;I want result for action=&amp;lt;&amp;gt; anything sorted by channel= and count but the key action could be anywhere in the URL and hence i dont get the exact count. &lt;/P&gt;

&lt;P&gt;How do we use regex to find action=&amp;lt;&amp;gt; if it is at the end of the URL.  &lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 19:34:45 GMT</pubDate>
    <dc:creator>panandshah</dc:creator>
    <dc:date>2020-09-29T19:34:45Z</dc:date>
    <item>
      <title>Regex string end of the url and in between</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-string-end-of-the-url-and-in-between/m-p/403737#M169354</link>
      <description>&lt;P&gt;10.1.151.100 [18/May/2018:09:09:57 +0200] "GET &lt;A href="http://example.com/DCQ/templates/GetAggregated?channel=TV&amp;amp;contentId=4ek4k4&amp;amp;lang=eng" target="_blank"&gt;http://example.com/DCQ/templates/GetAggregated?channel=TV&amp;amp;contentId=4ek4k4&amp;amp;lang=eng&lt;/A&gt; HTTP/1.1" 200 2856 hit 0.000111 hit - 154.176.135.239&lt;BR /&gt;
10.1.51.16 [18/May/2018:09:20:42 +0200] "GET &lt;A href="http://video-play.vodacom.co.za/AVS/besc?action=GetIsFavorite&amp;amp;channel=IPHONE&amp;amp;contentId=1200668" target="_blank"&gt;http://video-play.vodacom.co.za/AVS/besc?action=GetIsFavorite&amp;amp;channel=IPHONE&amp;amp;contentId=1200668&lt;/A&gt; HTTP/1.1" 200 113 miss 0.007757 miss - 19.392.33.103&lt;BR /&gt;
10.1.51.16 [18/May/2018:08:37:51 +0200] "GET &lt;A href="http://example.com/AVS/besc?username=00007&amp;amp;channel=ANDROID&amp;amp;action=GetAccountList" target="_blank"&gt;http://example.com/AVS/besc?username=00007&amp;amp;channel=ANDROID&amp;amp;action=GetAccountList&lt;/A&gt; HTTP/1.1" 200 1516 miss 0.030941 miss - 203.122.32.11&lt;/P&gt;

&lt;P&gt;I tried this but it does not print the ones with action=&amp;lt;&amp;gt; that are at the end of the url. &lt;BR /&gt;
index=index-name_idx earliest=-1h | rex "(?i)action=(?P[^&amp;amp;]+)" |stats count by test&lt;BR /&gt;
index=index-name_idx earliest=-1h | rex "(?i)action=(?P[^&amp;amp;]+|[\s]+)" |stats count by test&lt;/P&gt;

&lt;P&gt;The result i get is: &lt;BR /&gt;
CheckSession    444&lt;BR /&gt;
DeleteFavourite 1&lt;BR /&gt;
GetAccountList  116&lt;BR /&gt;
GetAccountList HTTP/1.1" 200 1516 miss 0.030941 miss - 119.92.253.103   1&lt;BR /&gt;
GetAccountList HTTP/1.1" 200 1898 miss 0.029884 miss - 119.92.253.103   1&lt;BR /&gt;
GetAccountList HTTP/1.1" 200 1902 miss 0.023020 miss - 119.92.253.103       1&lt;/P&gt;

&lt;P&gt;I want result for action=&amp;lt;&amp;gt; anything sorted by channel= and count but the key action could be anywhere in the URL and hence i dont get the exact count. &lt;/P&gt;

&lt;P&gt;How do we use regex to find action=&amp;lt;&amp;gt; if it is at the end of the URL.  &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 19:34:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-string-end-of-the-url-and-in-between/m-p/403737#M169354</guid>
      <dc:creator>panandshah</dc:creator>
      <dc:date>2020-09-29T19:34:45Z</dc:date>
    </item>
    <item>
      <title>Re: Regex string end of the url and in between</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-string-end-of-the-url-and-in-between/m-p/403738#M169355</link>
      <description>&lt;P&gt;@panandshah, please use the Code button ie. button with &lt;CODE&gt;101010&lt;/CODE&gt; or shortcut key &lt;CODE&gt;CTRL+K&lt;/CODE&gt; while posting data or code so that special characters do not escape.&lt;/P&gt;

&lt;P&gt;Based on the data sample provided, can you try the following regex?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  index=index-name_idx earliest=-1h | 
 | rex  "action=(?&amp;lt;action&amp;gt;[^\&amp;amp;\s]+)[&amp;amp;|\s]"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What is the action field in the first example is there a pattern for that?&lt;BR /&gt;
Also the third data has &lt;CODE&gt;channel=ANDROID∾tion=GetAccountList&lt;/CODE&gt; is the &lt;CODE&gt;∾&lt;/CODE&gt; character actually present in your raw data or is it due to copy paste and the character is actually &lt;CODE&gt;ac&lt;/CODE&gt;.?&lt;BR /&gt;
Do you need to extract &lt;CODE&gt;channel&lt;/CODE&gt; as well?&lt;/P&gt;</description>
      <pubDate>Fri, 18 May 2018 09:02:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-string-end-of-the-url-and-in-between/m-p/403738#M169355</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-05-18T09:02:57Z</dc:date>
    </item>
    <item>
      <title>Re: Regex string end of the url and in between</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-string-end-of-the-url-and-in-between/m-p/403739#M169356</link>
      <description>&lt;P&gt;That works indeed!! Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 18 May 2018 14:58:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-string-end-of-the-url-and-in-between/m-p/403739#M169356</guid>
      <dc:creator>panandshah</dc:creator>
      <dc:date>2018-05-18T14:58:47Z</dc:date>
    </item>
  </channel>
</rss>

