<?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: Regex Question for Proxy Logs in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-Question-for-Proxy-Logs/m-p/55944#M13670</link>
    <description>&lt;P&gt;Try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="bcoat_proxysg" |
regex uri_path="http://.*?/\w{8}/welcome.html$"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Problems in your search&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;The rex command creates a new, temporary field. I think you want the regex command, which keeps events that match the pattern, and eliminates events that don't match&lt;/LI&gt;
&lt;LI&gt;Your regular expression seemed not to match the string that you were searching for&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;BTW, the \w character class includes alphanumeric characters, plus the underscore. If you prefer, you could use&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="bcoat_proxysg" |
regex uri_path="http://.*?/[A-Za-z0-9]{8}/welcome.html$"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 19 May 2012 06:56:58 GMT</pubDate>
    <dc:creator>lguinn2</dc:creator>
    <dc:date>2012-05-19T06:56:58Z</dc:date>
    <item>
      <title>Regex Question for Proxy Logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Question-for-Proxy-Logs/m-p/55943#M13669</link>
      <description>&lt;P&gt;I want to view all the HTTP GET Requests in the Proxy Logs to any website of the following format:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&lt;A href="http://example.com/&amp;lt;format&amp;gt;/welcome.html" target="test_blank"&gt;http://example.com/&amp;lt;format&amp;gt;/welcome.html&lt;/A&gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;here, &lt;FORMAT&gt; is as follows:&lt;/FORMAT&gt;&lt;/P&gt;

&lt;P&gt;It consists of a total of 8 characters which may include numbers (0-9), alphabets both, lowercase and upper case (a-z, A-Z)&lt;/P&gt;

&lt;P&gt;few examples:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/HXut2jHC/welcome.html
/mK151WbA/welcome.html
/gMsyk6kT/welcome.html
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My Splunk Search is as following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="bcoat_proxysg" | rex field=uri_path "(?uri_path between angle brackets /^[a-zA-Z0-9]{8}/welcome.html$)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;here, uri_path is the field in Proxy Logs which will contain the URI Path to which the HTTP Request was sent.&lt;/P&gt;

&lt;P&gt;However, this does not seem to work. I think I need to include more conditions in the Regex like:&lt;/P&gt;

&lt;P&gt;The format string should appear between the first and second forward slash of the GET Request followed by welcome.html.&lt;/P&gt;

&lt;P&gt;Note: Why am I not able to write text between angle brackets?&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Sat, 19 May 2012 06:03:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Question-for-Proxy-Logs/m-p/55943#M13669</guid>
      <dc:creator>NeonFlash</dc:creator>
      <dc:date>2012-05-19T06:03:23Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Question for Proxy Logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Question-for-Proxy-Logs/m-p/55944#M13670</link>
      <description>&lt;P&gt;Try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="bcoat_proxysg" |
regex uri_path="http://.*?/\w{8}/welcome.html$"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Problems in your search&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;The rex command creates a new, temporary field. I think you want the regex command, which keeps events that match the pattern, and eliminates events that don't match&lt;/LI&gt;
&lt;LI&gt;Your regular expression seemed not to match the string that you were searching for&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;BTW, the \w character class includes alphanumeric characters, plus the underscore. If you prefer, you could use&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="bcoat_proxysg" |
regex uri_path="http://.*?/[A-Za-z0-9]{8}/welcome.html$"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 19 May 2012 06:56:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Question-for-Proxy-Logs/m-p/55944#M13670</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2012-05-19T06:56:58Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Question for Proxy Logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Question-for-Proxy-Logs/m-p/55945#M13671</link>
      <description>&lt;P&gt;Thanks. An exact match would be,&lt;/P&gt;

&lt;P&gt;"^/[a-zA-Z0-9]{8}/welcome.html$"&lt;/P&gt;

&lt;P&gt;However, this would also match something like /shopping/welcome.html, /politics/welcome.html.&lt;/P&gt;

&lt;P&gt;Can the regex be modified even further so that it looks for a format which has at least 1 or more character from each Charset, [a-z][A-Z][0-9]. I need to match it in such a way that it has at least 1 or more character from each Character Classes.&lt;/P&gt;</description>
      <pubDate>Sat, 19 May 2012 14:06:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Question-for-Proxy-Logs/m-p/55945#M13671</guid>
      <dc:creator>NeonFlash</dc:creator>
      <dc:date>2012-05-19T14:06:08Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Question for Proxy Logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Question-for-Proxy-Logs/m-p/55946#M13672</link>
      <description>&lt;P&gt;I don't think that the caret ^ is going to work if you actually have the http:// as part of the field. I suspect that you could get exactly what you want by using conditional look ahead and/or look behind in your regex. But those things make my head hurt - I'd rather write a custom Splunk command!  (And that's not trivial.)&lt;/P&gt;

&lt;P&gt;You might take the regex problem to a forum that specializes in regexes or maybe Perl.&lt;/P&gt;</description>
      <pubDate>Sat, 19 May 2012 22:07:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Question-for-Proxy-Logs/m-p/55946#M13672</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2012-05-19T22:07:42Z</dc:date>
    </item>
  </channel>
</rss>

