<?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 I edit the regex in my search to extract a part of a string? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-the-regex-in-my-search-to-extract-a-part-of-a/m-p/171468#M49114</link>
    <description>&lt;P&gt;Thanks Chimell....&lt;BR /&gt;
Now it works&lt;/P&gt;</description>
    <pubDate>Fri, 26 Jun 2015 10:15:04 GMT</pubDate>
    <dc:creator>kumina</dc:creator>
    <dc:date>2015-06-26T10:15:04Z</dc:date>
    <item>
      <title>How do I edit the regex in my search to extract a part of a string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-the-regex-in-my-search-to-extract-a-part-of-a/m-p/171464#M49110</link>
      <description>&lt;P&gt;I have a log:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; BL: | LL: INFO | TS: 1234 | AR: RxC_16.00.37.01 | STORE:  :BROADCAST |
 USER: BROADCAST | HOST: BROADCAST | APPSERVER: rri | MSGID: CINTERFACE
 |SC: [Profile] | MSG: ISP Broadcast Received for
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to get &lt;CODE&gt;MSGID-SC (CINTERFACE-Profile)&lt;/CODE&gt; from the string above.&lt;/P&gt;

&lt;P&gt;For this i am trying to use rex command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=rx_connect "USER: BROADCAST" |rex field=_raw
"MSGID:\s(?&amp;lt;MSGID&amp;gt;[^\|]*)\s\|\SC:\s\[(?&amp;lt;SC&amp;gt;[^\]]*)\]" | eval
someNewField=MSGID."-".SC`
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But it is not working. Please suggest further.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jun 2015 11:51:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-the-regex-in-my-search-to-extract-a-part-of-a/m-p/171464#M49110</guid>
      <dc:creator>kumina</dc:creator>
      <dc:date>2015-06-24T11:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit the regex in my search to extract a part of a string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-the-regex-in-my-search-to-extract-a-part-of-a/m-p/171465#M49111</link>
      <description>&lt;P&gt;Your regex has a Typo. Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=rx_connect "USER: BROADCAST" |rex field=_raw "MSGID:\s(?&amp;lt;msgid&amp;gt;[^\|]+)\s\|SC:\s\[(?&amp;lt;sc&amp;gt;[^\]]*)\]" | eval someNewField = msgid."-".sc
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 Jun 2015 11:55:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-the-regex-in-my-search-to-extract-a-part-of-a/m-p/171465#M49111</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2015-06-24T11:55:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit the regex in my search to extract a part of a string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-the-regex-in-my-search-to-extract-a-part-of-a/m-p/171466#M49112</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am still getting whole logs instead of &lt;/P&gt;

&lt;P&gt;MSGID-SC&lt;BR /&gt;&lt;BR /&gt;
example:(CINTERFACE-Profile)&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jun 2015 05:24:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-the-regex-in-my-search-to-extract-a-part-of-a/m-p/171466#M49112</guid>
      <dc:creator>kumina</dc:creator>
      <dc:date>2015-06-25T05:24:11Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit the regex in my search to extract a part of a string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-the-regex-in-my-search-to-extract-a-part-of-a/m-p/171467#M49113</link>
      <description>&lt;P&gt;Hi kumina&lt;/P&gt;

&lt;P&gt;Try this search code it works well&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=rx_connect "USER: BROADCAST" |rex field=_raw "MSGID:\s(?P&amp;lt;msgid&amp;gt;[^\|]+)\s"|rex field=_raw "SC:\s\[(?P&amp;lt;sc&amp;gt;[^\|]+)\]"|rex field=_raw "\|\s(?P&amp;lt;field1&amp;gt;[\w]+)\:\sCINTERFACE"|rex field=_raw "\|(?P&amp;lt;field2&amp;gt;[\w]+)\:\s\[Profile]"|eval someNewField = field1."-".field2."  (".msgid."-".sc.")" |table msgid sc field1 field2 someNewField
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Look at the following screen capture &lt;/P&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/418iDBEB1CF82D1E9E08/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>Thu, 25 Jun 2015 12:28:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-the-regex-in-my-search-to-extract-a-part-of-a/m-p/171467#M49113</guid>
      <dc:creator>chimell</dc:creator>
      <dc:date>2015-06-25T12:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit the regex in my search to extract a part of a string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-the-regex-in-my-search-to-extract-a-part-of-a/m-p/171468#M49114</link>
      <description>&lt;P&gt;Thanks Chimell....&lt;BR /&gt;
Now it works&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jun 2015 10:15:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-the-regex-in-my-search-to-extract-a-part-of-a/m-p/171468#M49114</guid>
      <dc:creator>kumina</dc:creator>
      <dc:date>2015-06-26T10:15:04Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit the regex in my search to extract a part of a string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-the-regex-in-my-search-to-extract-a-part-of-a/m-p/171469#M49115</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;If value of msgid and sc in above logs  is not constant and we want to extract that part then what will be the string&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jun 2015 10:17:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-the-regex-in-my-search-to-extract-a-part-of-a/m-p/171469#M49115</guid>
      <dc:creator>kumina</dc:creator>
      <dc:date>2015-06-26T10:17:00Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit the regex in my search to extract a part of a string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-the-regex-in-my-search-to-extract-a-part-of-a/m-p/171470#M49116</link>
      <description>&lt;P&gt;Thanks too .&lt;BR /&gt;
Test the second result and think to vote and  accept&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jun 2015 14:33:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-the-regex-in-my-search-to-extract-a-part-of-a/m-p/171470#M49116</guid>
      <dc:creator>chimell</dc:creator>
      <dc:date>2015-06-26T14:33:59Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit the regex in my search to extract a part of a string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-the-regex-in-my-search-to-extract-a-part-of-a/m-p/171471#M49117</link>
      <description>&lt;P&gt;Hi kumina&lt;/P&gt;

&lt;P&gt;If  msgid and sc are not constant , use the max_match option and mvindex command to solve your problem&lt;/P&gt;

&lt;P&gt;Try this search code &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=rx_connect "USER: BROADCAST"|rex field=_raw  max_match=0 "\|\s\w+\:\s(?P&amp;lt;msgid1&amp;gt;[^\|]+)\s"|eval msgid=mvindex(msgid1,7)
|rex field=_raw "\[(?P&amp;lt;sc&amp;gt;[^\|]+)\]"|rex field=_raw "\|\s(?P&amp;lt;field1&amp;gt;[\w]+)\:\sCINTERFACE"|rex field=_raw "\|(?P&amp;lt;field2&amp;gt;[\w]+)\:\s\[Profile]"|eval someNewField = field1."-".field2."  (".msgid."-".sc.")" 
|table msgid sc field1 field2 someNewField
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;see result&lt;BR /&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/419iF9B000A15F965835/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>Fri, 26 Jun 2015 15:29:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-the-regex-in-my-search-to-extract-a-part-of-a/m-p/171471#M49117</guid>
      <dc:creator>chimell</dc:creator>
      <dc:date>2015-06-26T15:29:43Z</dc:date>
    </item>
  </channel>
</rss>

