<?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: How do you extract multiple substrings from the following events? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-extract-multiple-substrings-from-the-following-events/m-p/423240#M174272</link>
    <description>&lt;P&gt;Thanks nagarjuna280 for your answer but I got the following error&lt;BR /&gt;
Regex: unrecognized character after (?P and error entry in the log file is&lt;/P&gt;

&lt;P&gt;12-04-2018 21:43:51.453 ERROR dispatchRunner - RunDispatch::runDispatchThread threw error: Error in 'rex' command: Encountered the following error while compiling the regex '\w+\s+(?P[^\s]+)([^]]+)]\s"(?P[^"]+)"\s"(?P[^\s]+)\s(?P[^\s]+)\s(?P[^"]+)"': Regex: unrecognized character after (?P&lt;/P&gt;</description>
    <pubDate>Wed, 05 Dec 2018 03:48:52 GMT</pubDate>
    <dc:creator>atul9771</dc:creator>
    <dc:date>2018-12-05T03:48:52Z</dc:date>
    <item>
      <title>How do you extract multiple substrings from the following events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-extract-multiple-substrings-from-the-following-events/m-p/423238#M174270</link>
      <description>&lt;P&gt;I'm new to splunk.&lt;/P&gt;

&lt;P&gt;I have a log event in the following format. The report should capture the Hostname, Agentname and Resource. Also, I'd like to remove the duplicate entries. &lt;BR /&gt;
[Event] [Hostname] [Date/Time] [ClientIP] [UserDN] [Agentname] [Action] [Resource] &lt;BR /&gt;
[TransactionID] [Reason] [Status Message] [Impersonator Name] [Impersonator Dir Name]&lt;/P&gt;

&lt;P&gt;and log entry example is below&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;AuthAccept Hostname [03/Dec/2018:17:43:06 -0600] "ClientIP UserDN" "Agentname GET /WMT_Logon/Account/LogOn?ViewFlag=false" [idletime=1800;maxtime=603603054;authlevel=5;] [0]  [] []
CN =    FirstName LastName host =   HostName source =   c:\Program Files (x86)\ca\siteminder\log\smaccess-dotoksm03pv.log sourcetype =  smaccess
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want hostname, Agentname, Resource and Resource in above example is /WMT_Logon/Account/LogOn?ViewFlag=false.  But could be different for every event.&lt;/P&gt;

&lt;P&gt;I appreciate any help writing this search string.  Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 04 Dec 2018 23:43:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-extract-multiple-substrings-from-the-following-events/m-p/423238#M174270</guid>
      <dc:creator>atul9771</dc:creator>
      <dc:date>2018-12-04T23:43:16Z</dc:date>
    </item>
    <item>
      <title>Re: How do you extract multiple substrings from the following events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-extract-multiple-substrings-from-the-following-events/m-p/423239#M174271</link>
      <description>&lt;P&gt;try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=* host=* sourcetype = smaccess | rex field=_raw "\w+\s+(?P[^\s]+)([^\]]+)\]\s\"(?P[^\"]+)\"\s\"(?P[^\s]+)\s(?P[^\s]+)\s(?P[^\"]+)\""  
 | table Hostname, Agentname  Resource | dedup Hostname, Agentname  Resource
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 05 Dec 2018 02:09:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-extract-multiple-substrings-from-the-following-events/m-p/423239#M174271</guid>
      <dc:creator>nagarjuna280</dc:creator>
      <dc:date>2018-12-05T02:09:58Z</dc:date>
    </item>
    <item>
      <title>Re: How do you extract multiple substrings from the following events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-extract-multiple-substrings-from-the-following-events/m-p/423240#M174272</link>
      <description>&lt;P&gt;Thanks nagarjuna280 for your answer but I got the following error&lt;BR /&gt;
Regex: unrecognized character after (?P and error entry in the log file is&lt;/P&gt;

&lt;P&gt;12-04-2018 21:43:51.453 ERROR dispatchRunner - RunDispatch::runDispatchThread threw error: Error in 'rex' command: Encountered the following error while compiling the regex '\w+\s+(?P[^\s]+)([^]]+)]\s"(?P[^"]+)"\s"(?P[^\s]+)\s(?P[^\s]+)\s(?P[^"]+)"': Regex: unrecognized character after (?P&lt;/P&gt;</description>
      <pubDate>Wed, 05 Dec 2018 03:48:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-extract-multiple-substrings-from-the-following-events/m-p/423240#M174272</guid>
      <dc:creator>atul9771</dc:creator>
      <dc:date>2018-12-05T03:48:52Z</dc:date>
    </item>
    <item>
      <title>Re: How do you extract multiple substrings from the following events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-extract-multiple-substrings-from-the-following-events/m-p/423241#M174273</link>
      <description>&lt;P&gt;I figure out the error, Instead of P , you need to put actual field name. here is final syntax. Thanks for your help&lt;BR /&gt;
(?[^\s]+)([^]]+)]\s\"(?[^\"]+)\"\s\"(?[^\s]+)\s(?[^\s]+)\s(?[^\"]+)&lt;/P&gt;</description>
      <pubDate>Wed, 05 Dec 2018 05:44:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-extract-multiple-substrings-from-the-following-events/m-p/423241#M174273</guid>
      <dc:creator>atul9771</dc:creator>
      <dc:date>2018-12-05T05:44:35Z</dc:date>
    </item>
    <item>
      <title>Re: How do you extract multiple substrings from the following events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-extract-multiple-substrings-from-the-following-events/m-p/423242#M174274</link>
      <description>&lt;P&gt;this site is hiding some characters, that is why you are not able to see the whole regex (fieldnames), &lt;/P&gt;

&lt;P&gt;look at this  &lt;A href="https://www.regular-expressions.info/refext.html"&gt;https://www.regular-expressions.info/refext.html&lt;/A&gt; , you can see named capturing groups (3 ways)&lt;/P&gt;</description>
      <pubDate>Wed, 05 Dec 2018 06:09:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-extract-multiple-substrings-from-the-following-events/m-p/423242#M174274</guid>
      <dc:creator>nagarjuna280</dc:creator>
      <dc:date>2018-12-05T06:09:15Z</dc:date>
    </item>
  </channel>
</rss>

