<?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: Using Rex to extract string from event for table in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Using-Rex-to-extract-string-from-event-for-table/m-p/287312#M86972</link>
    <description>&lt;P&gt;This run-anywhere example works in my environment.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| metadata type=sourcetypes | head 1 | eval string="2016-06-06 12:14:11,114 [RMI TCP Connection(453679)-10.128.110.184]- Remote invocation of and here would be specifics." | rex field=string "Remote invocation of (?&amp;lt;Remote_Invocation&amp;gt;.*)" | Table Remote_Invocation
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 06 Jun 2016 17:45:15 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2016-06-06T17:45:15Z</dc:date>
    <item>
      <title>Using Rex to extract string from event for table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Rex-to-extract-string-from-event-for-table/m-p/287308#M86968</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I'm sure this is very simple, but I'm fairly new to regex and rex.&lt;/P&gt;

&lt;P&gt;I'm trying to use rex to extract a string from the event logs, and then show that sring in a table.&lt;/P&gt;

&lt;P&gt;Here is a sample event:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"2016-06-06 12:14:11,114 [RMI TCP Connection(453679)-10.128.110.184]- Remote invocation of " and here would be specifics.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Using the field extractor, I came up with the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex field=_raw "(?ms)^(?:[^ \\n]* ){5}(?P&amp;lt;Remote_Invocation&amp;gt;\\w+\\s+\\w+\\s+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This allowed me to use the following search to table it:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=qp_mds source="/app/logdata/logs/marketdata/performance.log"| rex field=_raw "(?ms)^(?:[^ \\n]* ){5}(?P&amp;lt;Remote_Invocation&amp;gt;\\w+\\s+\\w+\\s+)"| Table Remote_Invocation
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However, all my table shows is Remote Invocation where the event should be.  I can get the string if I table _raw, but it give me the whole string, whereas I only want what is after Remote invocation.  Any help would be greatly appreciated.&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jun 2016 17:24:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Rex-to-extract-string-from-event-for-table/m-p/287308#M86968</guid>
      <dc:creator>vil505</dc:creator>
      <dc:date>2016-06-06T17:24:53Z</dc:date>
    </item>
    <item>
      <title>Re: Using Rex to extract string from event for table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Rex-to-extract-string-from-event-for-table/m-p/287309#M86969</link>
      <description>&lt;P&gt;The field extractor can be hit-or-miss.  Sometimes it's too specific.  Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=qp_mds source="/app/logdata/logs/marketdata/performance.log"| rex "Remote invocation of (?&amp;lt;Remote_Invocation&amp;gt;.*)" | Table Remote_Invocation
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Jun 2016 17:31:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Rex-to-extract-string-from-event-for-table/m-p/287309#M86969</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2016-06-06T17:31:47Z</dc:date>
    </item>
    <item>
      <title>Re: Using Rex to extract string from event for table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Rex-to-extract-string-from-event-for-table/m-p/287310#M86970</link>
      <description>&lt;P&gt;No, that didn't work. Now the just shows up blank.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jun 2016 17:38:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Rex-to-extract-string-from-event-for-table/m-p/287310#M86970</guid>
      <dc:creator>vil505</dc:creator>
      <dc:date>2016-06-06T17:38:27Z</dc:date>
    </item>
    <item>
      <title>Re: Using Rex to extract string from event for table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Rex-to-extract-string-from-event-for-table/m-p/287311#M86971</link>
      <description>&lt;P&gt;Can you paste in an event without the obfuscation (or at least with far far less obfuscation)?  &lt;/P&gt;

&lt;P&gt;You could try a minor variant of richgalloway's answer in case there are differences in spacing:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=qp_mds source="/app/logdata/logs/marketdata/performance.log"| rex "Remote\s+invocation\s+of\s+(?&amp;lt;Remote_Invocation&amp;gt;.*)" | Table Remote_Invocation
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How many events contain the "Remote invocation" string?  You could try limited your search to only those events up front, in case it's just that it's in such a small percentage it doesn't show up all over:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=qp_mds source="/app/logdata/logs/marketdata/performance.log" "Remote invocation"| rex "Remote\s+invocation\s+of\s+(?&amp;lt;Remote_Invocation&amp;gt;.*)" | Table Remote_Invocation
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Jun 2016 17:42:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Rex-to-extract-string-from-event-for-table/m-p/287311#M86971</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2016-06-06T17:42:52Z</dc:date>
    </item>
    <item>
      <title>Re: Using Rex to extract string from event for table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Rex-to-extract-string-from-event-for-table/m-p/287312#M86972</link>
      <description>&lt;P&gt;This run-anywhere example works in my environment.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| metadata type=sourcetypes | head 1 | eval string="2016-06-06 12:14:11,114 [RMI TCP Connection(453679)-10.128.110.184]- Remote invocation of and here would be specifics." | rex field=string "Remote invocation of (?&amp;lt;Remote_Invocation&amp;gt;.*)" | Table Remote_Invocation
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Jun 2016 17:45:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Rex-to-extract-string-from-event-for-table/m-p/287312#M86972</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2016-06-06T17:45:15Z</dc:date>
    </item>
    <item>
      <title>Re: Using Rex to extract string from event for table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Rex-to-extract-string-from-event-for-table/m-p/287313#M86973</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex "Remote\s+Invocation\s+of\s+(?&amp;lt;Remote_Invocation&amp;gt;.+)" | stats count by Remote_Invocation
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Jun 2016 17:46:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Rex-to-extract-string-from-event-for-table/m-p/287313#M86973</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-06-06T17:46:06Z</dc:date>
    </item>
  </channel>
</rss>

