<?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: Help with Regex...? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex/m-p/258731#M77516</link>
    <description>&lt;P&gt;Try this one:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?P&amp;lt;method&amp;gt;\w+)\s(?P&amp;lt;URL&amp;gt;.*)?\s\-\s(?P&amp;lt;port&amp;gt;\d+)\s\-\s(?P&amp;lt;IP&amp;gt;\d+\.\d+\.\d+\.\d+)\s(?P&amp;lt;UserAgent&amp;gt;[^ ]*)?\s?(?P&amp;lt;status&amp;gt;\d\d\d)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you want to modify it test on &lt;A href="https://regex101.com/"&gt;https://regex101.com/&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
    <pubDate>Tue, 18 Oct 2016 14:47:21 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2016-10-18T14:47:21Z</dc:date>
    <item>
      <title>Help with Regex...?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex/m-p/258729#M77514</link>
      <description>&lt;P&gt;I'm trying to extract the following from this regex...somehow i am not able to get the browser agent and status...&lt;/P&gt;

&lt;P&gt;some of the data doesn't have a user agent..any help to get IP, UserAgent(optional), status&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?P&amp;lt;method&amp;gt;\w+)\s(?P&amp;lt;URL&amp;gt;.*)?\s\-\s(?P&amp;lt;port&amp;gt;\d+)\s\-\s(?P&amp;lt;IP&amp;gt;\d+\.\d+\.\d+\.\d+)\s?\-?\s(?P&amp;lt;UserAgent&amp;gt;.*\))?\s?(?P&amp;lt;status&amp;gt;\d+)


GET /user/stell_static/legacy/css/share.css - 443 - 192.188.2.0 - 404

GET / - 443 - 192.168.28.0 - 200 0 0 0

GET /public/about.html - 443 - 192.168.26.7 - 403

POST /data/willer/testsample.php - 443 - 192.168.20.1 Mozilla/4.0+(Windows;+U;+Windows+NT+5.1;+en-US;+rv:1.8.1.14) 404 0 2 0

GET /ajax/real/setsample.asp - 443 - 192.168.21.0 Mozilla/5.0+(Windows+NT+5.1;+WOW64;+rv:35.0)+Gecko/20980000+Firefox/45.0 200 0 0 31 #apache webserver services #version5.5
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Oct 2016 14:18:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex/m-p/258729#M77514</guid>
      <dc:creator>prakash007</dc:creator>
      <dc:date>2016-10-18T14:18:14Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Regex...?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex/m-p/258730#M77515</link>
      <description>&lt;P&gt;You should create 2 separate fields for the user agent string and the status code&lt;/P&gt;

&lt;P&gt;User gent string regex &lt;BR /&gt;
&lt;CODE&gt;(?P&amp;lt;UserAgent&amp;gt;\d+\.\d+\.\d+\.\d+\s(\S+))&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2016 14:23:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex/m-p/258730#M77515</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2016-10-18T14:23:48Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Regex...?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex/m-p/258731#M77516</link>
      <description>&lt;P&gt;Try this one:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?P&amp;lt;method&amp;gt;\w+)\s(?P&amp;lt;URL&amp;gt;.*)?\s\-\s(?P&amp;lt;port&amp;gt;\d+)\s\-\s(?P&amp;lt;IP&amp;gt;\d+\.\d+\.\d+\.\d+)\s(?P&amp;lt;UserAgent&amp;gt;[^ ]*)?\s?(?P&amp;lt;status&amp;gt;\d\d\d)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you want to modify it test on &lt;A href="https://regex101.com/"&gt;https://regex101.com/&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2016 14:47:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex/m-p/258731#M77516</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2016-10-18T14:47:21Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Regex...?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex/m-p/258732#M77517</link>
      <description>&lt;P&gt;This should do it&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?P&amp;lt;method&amp;gt;\w+)\s+(?P&amp;lt;URL&amp;gt;\S+)\s+\S+\s+(?P&amp;lt;port&amp;gt;\d+)\s+\S+\s+(?P&amp;lt;IP&amp;gt;\d+\.\d+\.\d+\.\d+)\s+(?P&amp;lt;UserAgent&amp;gt;\S+)\s+(?P&amp;lt;status&amp;gt;\d+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;A href="https://regex101.com/r/Vg9lbg/1"&gt;https://regex101.com/r/Vg9lbg/1&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2016 15:11:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex/m-p/258732#M77517</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-10-18T15:11:41Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Regex...?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex/m-p/258733#M77518</link>
      <description>&lt;P&gt;somehow it's not working well for this kind of data&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;GET /ajax/real/setsample.asp - 443 - 192.168.21.0 Mozilla/5.0+(Windows+NT+5.1;+WOW64;+rv:35.0)+Gecko/20980000+Firefox/45.0 200 0 0 31 950 #softwate#apache 560 731

UserAgent=Mozilla/5.0+(Windows+NT+5.1;+WOW64;+rv:35.0)+Gecko/20980000+Firefox/45.0 200 0 0 31 950 #softwate#apache 560
 expected(UserAgent=Mozilla/5.0+(Windows+NT+5.1;+WOW64;+rv:35.0)+Gecko/20980000+Firefox/45.0)

status=731
(expected status=200)

GET / - 443 - 192.168.67.1 - 200 0 0 202

UserAgent= -200
(expected UserAgent = -)

status=202
(expected status=200)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Oct 2016 15:15:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex/m-p/258733#M77518</guid>
      <dc:creator>prakash007</dc:creator>
      <dc:date>2016-10-18T15:15:26Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Regex...?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex/m-p/258734#M77519</link>
      <description>&lt;P&gt;tested and its working good..&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="post" 
| rex field=_raw "(?P&amp;lt;method&amp;gt;\w+)\s(?P&amp;lt;URL&amp;gt;.*)?\s\-\s(?P&amp;lt;port&amp;gt;\d{3})\s\-\s(?P&amp;lt;IP&amp;gt;\d+\.\d+\.\d+\.\d+)\s(?P&amp;lt;UserAgent&amp;gt;.*)\s(?P&amp;lt;status&amp;gt;\d{3})"
| table method URL port IP UserAgent status _raw
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/2027iB23ED13EE26D4F6F/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2016 15:15:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex/m-p/258734#M77519</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2016-10-18T15:15:47Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Regex...?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex/m-p/258735#M77520</link>
      <description>&lt;P&gt;This will work for all you cases:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?P&amp;lt;method&amp;gt;[\w]+)\s+(?P&amp;lt;URL&amp;gt;[^\s]+)\s+\S+\s+(?P&amp;lt;port&amp;gt;[\d]+)\s+\S+\s+(?P&amp;lt;IP&amp;gt;[\d\.]+)\s+(?P&amp;lt;UserAgent&amp;gt;[\S]+)\s+(?P&amp;lt;status&amp;gt;[\d]+)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Oct 2016 15:33:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex/m-p/258735#M77520</guid>
      <dc:creator>gokadroid</dc:creator>
      <dc:date>2016-10-18T15:33:10Z</dc:date>
    </item>
  </channel>
</rss>

