<?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: regex exclude nth word in the event in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/regex-exclude-nth-word-in-the-event/m-p/542137#M153565</link>
    <description>&lt;P&gt;rex either works in capture mode or sed mode - you could use a separate rex to edit the captured field&lt;/P&gt;</description>
    <pubDate>Wed, 03 Mar 2021 11:58:28 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2021-03-03T11:58:28Z</dc:date>
    <item>
      <title>regex exclude nth word in the event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-exclude-nth-word-in-the-event/m-p/542101#M153553</link>
      <description>&lt;P&gt;I want to ignore the actual file name in my exception events so I can group the exceptions .&lt;/P&gt;&lt;P&gt;For example, regex on below event should extract only &amp;nbsp;"Error File not found !!!" &amp;nbsp;and ignore the actual filename in between.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Error File abracadabra.gz not found !!!&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please advise on how to exclude this word in between the fixed format of words .&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Mar 2021 08:31:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-exclude-nth-word-in-the-event/m-p/542101#M153553</guid>
      <dc:creator>ppatkar</dc:creator>
      <dc:date>2021-03-03T08:31:59Z</dc:date>
    </item>
    <item>
      <title>Re: regex exclude nth word in the event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-exclude-nth-word-in-the-event/m-p/542106#M153555</link>
      <description>&lt;P&gt;Use &lt;STRONG&gt;rex&lt;/STRONG&gt; with &lt;STRONG&gt;sed&lt;/STRONG&gt; mode:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults | eval test="Error File abracadabra.gz not found !!!" | rex field=test mode=sed "s/\s\w+\.(gz|tgz|zip)//g"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this reply helps you, an upvote/like would be appreciated.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Mar 2021 08:45:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-exclude-nth-word-in-the-event/m-p/542106#M153555</guid>
      <dc:creator>manjunathmeti</dc:creator>
      <dc:date>2021-03-03T08:45:32Z</dc:date>
    </item>
    <item>
      <title>Re: regex exclude nth word in the event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-exclude-nth-word-in-the-event/m-p/542113#M153558</link>
      <description>&lt;P&gt;To drop the 3rd word&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex mode=sed "s/^(\S+\s)(\S+\s)(\S+\s)/\1\2/g"&lt;/LI-CODE&gt;&lt;P&gt;or for more precision&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex mode=sed "s/^(Error File )(\S+\s)(not found)/\1\3/g"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Mar 2021 09:05:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-exclude-nth-word-in-the-event/m-p/542113#M153558</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-03-03T09:05:41Z</dc:date>
    </item>
    <item>
      <title>Re: regex exclude nth word in the event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-exclude-nth-word-in-the-event/m-p/542124#M153563</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/129090"&gt;@manjunathmeti&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;, Thank you for your quick reply . I have a followup question as I intend to use capture group to gather errors . My existing search is something like below :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=*  "IOError" OR  "file does not exist"  | 
rex field=_raw max_match=1 "IOError:(?&amp;lt;IO_ERROR&amp;gt;.*)" |
rex field=_raw max_match=1 "MESSAGE=(?&amp;lt;FILE_ERROR&amp;gt;file does not exist[^\d|]+)" |
... | eval ERROR_LOG = coalesce(IO_ERROR,FILE_ERROR...) &lt;/LI-CODE&gt;&lt;P&gt;Can I incorporate the sed mode in this type of capture group or is there any other way ?&lt;/P&gt;&lt;P&gt;Thank you for all your help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Mar 2021 09:37:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-exclude-nth-word-in-the-event/m-p/542124#M153563</guid>
      <dc:creator>ppatkar</dc:creator>
      <dc:date>2021-03-03T09:37:56Z</dc:date>
    </item>
    <item>
      <title>Re: regex exclude nth word in the event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-exclude-nth-word-in-the-event/m-p/542137#M153565</link>
      <description>&lt;P&gt;rex either works in capture mode or sed mode - you could use a separate rex to edit the captured field&lt;/P&gt;</description>
      <pubDate>Wed, 03 Mar 2021 11:58:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-exclude-nth-word-in-the-event/m-p/542137#M153565</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-03-03T11:58:28Z</dc:date>
    </item>
  </channel>
</rss>

