<?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: Useragent  regex is not working in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Useragent-regex-is-not-working/m-p/182063#M52499</link>
    <description>&lt;P&gt;Try this (replace the &lt;CODE&gt;&amp;amp;lt;&lt;/CODE&gt; and &lt;CODE&gt;&amp;amp;gt;&lt;/CODE&gt; with "&amp;lt;" and "&amp;gt;"):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex "\"(?&amp;amp;lt;http_user_agent&amp;amp;gt;[^\"]+)\"[^\"]+$"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 06 May 2015 21:35:35 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2015-05-06T21:35:35Z</dc:date>
    <item>
      <title>Useragent  regex is not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Useragent-regex-is-not-working/m-p/182062#M52498</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;
I am trying to create a regex to capture different types of browsers and I found that I need to have useragent setup for that which is another regex So I tried creating a field extraction which is not working for me so I need help to figure out what I need to do.&lt;/P&gt;

&lt;P&gt;1) Goal is to display a chart with X IP's are hitting IE and Y are hitting Firefox so on&lt;BR /&gt;
2) What I need to accomplish this ? I have a access log which looks like this &lt;BR /&gt;
2XX.1XX.XX.1XX - - [04/Apr/2015:17:14:24 -0400] "POST /ABC_Call/History.do HTTP/1.1" 200 22480 -  - - "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)" 1106670 /ABC_Call/History.do&lt;BR /&gt;
So Above access log shows I am using IE 5.01&lt;/P&gt;

&lt;P&gt;I used \s\"(?P&amp;lt;http_user_agent&amp;gt;[^"]+)  THIS IS Not working for me&lt;/P&gt;

&lt;P&gt;I tried this to make it work&lt;BR /&gt;&lt;BR /&gt;
index="cc_web" sourcetype=*  | rex field=_raw "\s\"(?P&amp;lt;http_user_agent&amp;gt;[^"]+)"&lt;BR /&gt;
 Error: Mismatched ']' &lt;/P&gt;

&lt;P&gt;tried to resolve but doesnt work anything &lt;/P&gt;

&lt;P&gt;then I found something like this which I cannot use because it says useragent&lt;BR /&gt;
 sourcetype="access_combined" useragent!="-" AND useragent!="Apache" AND useragent!="Load-weight" AND useragent!="Java" AND useragent!="Jakarta Commons-HttpClient" | stats count(eval(match(useragent, "Firefox"))) as "Firefox", count(eval(match(useragent, "Chrome"))) as "Chrome", count(eval(match(useragent, "Safari"))) as "Safari", count(eval(match(useragent, "MSIE"))) as "IE", count(eval(NOT match(useragent, "Chrome|Firefox|Safari|MSIE"))) as "Other"&lt;/P&gt;

&lt;P&gt;Please help&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:50:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Useragent-regex-is-not-working/m-p/182062#M52498</guid>
      <dc:creator>puneetkharband1</dc:creator>
      <dc:date>2020-09-28T19:50:58Z</dc:date>
    </item>
    <item>
      <title>Re: Useragent  regex is not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Useragent-regex-is-not-working/m-p/182063#M52499</link>
      <description>&lt;P&gt;Try this (replace the &lt;CODE&gt;&amp;amp;lt;&lt;/CODE&gt; and &lt;CODE&gt;&amp;amp;gt;&lt;/CODE&gt; with "&amp;lt;" and "&amp;gt;"):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex "\"(?&amp;amp;lt;http_user_agent&amp;amp;gt;[^\"]+)\"[^\"]+$"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 May 2015 21:35:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Useragent-regex-is-not-working/m-p/182063#M52499</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-05-06T21:35:35Z</dc:date>
    </item>
    <item>
      <title>Re: Useragent  regex is not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Useragent-regex-is-not-working/m-p/182064#M52500</link>
      <description>&lt;P&gt;ndex="cc_web" sourcetype=* | rex field=_raw "s"(?P&amp;lt;http_user_agent&amp;gt;[^"]+)"&lt;/P&gt;

&lt;P&gt;Mismatched ']'.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:51:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Useragent-regex-is-not-working/m-p/182064#M52500</guid>
      <dc:creator>puneetkharband1</dc:creator>
      <dc:date>2020-09-28T19:51:22Z</dc:date>
    </item>
  </channel>
</rss>

