<?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 How to extract the field by using regex? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-field-by-using-regex/m-p/623716#M216824</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hi , I need to extract the value &lt;STRONG&gt;FISOBPIT10101&lt;/STRONG&gt; from the below lines.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;message:PSUS7|8897|FISOBPIT10101|OWA|8897|8897|SignOnID|SPT|adding routing key in producer&lt;/P&gt;</description>
    <pubDate>Thu, 08 Dec 2022 19:34:39 GMT</pubDate>
    <dc:creator>Peru123</dc:creator>
    <dc:date>2022-12-08T19:34:39Z</dc:date>
    <item>
      <title>How to extract the field by using regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-field-by-using-regex/m-p/623716#M216824</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hi , I need to extract the value &lt;STRONG&gt;FISOBPIT10101&lt;/STRONG&gt; from the below lines.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;message:PSUS7|8897|FISOBPIT10101|OWA|8897|8897|SignOnID|SPT|adding routing key in producer&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2022 19:34:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-field-by-using-regex/m-p/623716#M216824</guid>
      <dc:creator>Peru123</dc:creator>
      <dc:date>2022-12-08T19:34:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the field by using regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-field-by-using-regex/m-p/623718#M216826</link>
      <description>&lt;P&gt;You could go with &lt;A href="https://docs.splunk.com/Documentation/Splunk/9.0.2/SearchReference/Erex" target="_self"&gt;| erex&lt;/A&gt; , if you're not expert with RegExs.&lt;/P&gt;&lt;P&gt;Otherwise, assuming the value is always in that position and not assuming a specific set of alphanumeric values, go with the following (13 steps per log, very efficient)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=&amp;lt;yourFieldOr_raw&amp;gt; "^(?:[^\|\v]*+\|){2}(?&amp;lt;yourValue&amp;gt;[^\|\v]*)"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2022 13:10:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-field-by-using-regex/m-p/623718#M216826</guid>
      <dc:creator>StefanoA</dc:creator>
      <dc:date>2022-12-08T13:10:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the field by using regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-field-by-using-regex/m-p/623719#M216827</link>
      <description>&lt;LI-CODE lang="markup"&gt;| rex "([^|]+\|){2}(?&amp;lt;field&amp;gt;[^|]+)"&lt;/LI-CODE&gt;&lt;P&gt;&lt;A href="https://regex101.com/r/UTPJb4/1" target="_blank"&gt;https://regex101.com/r/UTPJb4/1&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2022 13:11:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-field-by-using-regex/m-p/623719#M216827</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-12-08T13:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the field by using regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-field-by-using-regex/m-p/623724#M216832</link>
      <description>&lt;P&gt;Hi , I need this value only &lt;STRONG&gt;FISOBPIT10101&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2022 13:47:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-field-by-using-regex/m-p/623724#M216832</guid>
      <dc:creator>Peru123</dc:creator>
      <dc:date>2022-12-08T13:47:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the field by using regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-field-by-using-regex/m-p/623726#M216834</link>
      <description>&lt;LI-CODE lang="markup"&gt;| rex "([^|]+\|){2}(?&amp;lt;field&amp;gt;FISOBPIT10101)"&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 08 Dec 2022 13:50:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-field-by-using-regex/m-p/623726#M216834</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-12-08T13:50:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the field by using regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-field-by-using-regex/m-p/623789#M216859</link>
      <description>&lt;P&gt;Depending on whether the leading phrase "message" and the trailing phrases such as "&lt;SPAN&gt;adding routing key in producer" are important, you can use rex or just&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;&lt;SPAN&gt;If those phrases are unimportant, use&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/MultivalueEvalFunctions#split.28X.2C.22Y.22.29" target="_blank" rel="noopener"&gt;split&lt;/A&gt;. &amp;nbsp;It is more efficient.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval of_interest = mvindex(split(your_field, "|"), 2)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;If the first phrase and the last are important,&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=your_field "message:(\d+|){2}(?&amp;lt;of_interest&amp;gt;\w+)(|\d+){5}|adding routing key in producer"​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2022 04:33:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-field-by-using-regex/m-p/623789#M216859</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-12-09T04:33:08Z</dc:date>
    </item>
  </channel>
</rss>

