<?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 Field Extraction in Data Model in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction-in-Data-Model/m-p/580465#M202231</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Hey &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/214410"&gt;@isoutamo&lt;/a&gt;. Thanks for the suggestion. However, my question is specific to forming the regex expression in the Regular Expression box within "App/Search/data_model_editor" of Splunk, and not about forming a search query as you've suggested.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2022-01-10 at 11.08.00 PM.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/17494iA62B56538529986A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screen Shot 2022-01-10 at 11.08.00 PM.png" alt="Screen Shot 2022-01-10 at 11.08.00 PM.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 10 Jan 2022 15:09:15 GMT</pubDate>
    <dc:creator>han</dc:creator>
    <dc:date>2022-01-10T15:09:15Z</dc:date>
    <item>
      <title>Regex Field Extraction in Data Model</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction-in-Data-Model/m-p/580423#M202223</link>
      <description>&lt;P&gt;Hi all. I'm fairly new to Splunk and regex. I've got many event logs and I'm making use of data models beforing generating different visualisations.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The fields discovered isn't good enough for my usecase thus I need to extract specific fields. Right now, using the following regex&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(?&amp;lt;field_name&amp;gt;(([a-zA-Z]+(\.[a-zA-Z]+)+)_([a-zA-Z]+(|[a-zA-Z]+)+)|/^([^.]+)/))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;, I'm able to extract this pattern&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ABC|DEF|GHI&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;most accurately.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Subsequently, I would like extract each respective word into its own field. In total 3 different fields for ABC, DEF and GHI respectively.&lt;/P&gt;&lt;P&gt;Is there a way I extract each individual word? How can perform regex expression on top of my current regex expression result? Thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jan 2022 10:12:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction-in-Data-Model/m-p/580423#M202223</guid>
      <dc:creator>han</dc:creator>
      <dc:date>2022-01-10T10:12:02Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Field Extraction in Data Model</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction-in-Data-Model/m-p/580439#M202226</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;excellent place to check and training with your regex is regex101.com. In there you could try with visual feedback how those are working.&lt;/P&gt;&lt;P&gt;To separate those to own variables can be do at least next ways.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;... base search ... 
| rex "(?&amp;lt;field 1&amp;gt;[rex for field one])...(?&amp;lt;f2&amp;gt;[rex for f2])...(?&amp;lt;f3&amp;gt;[rex for f3])"&lt;/LI-CODE&gt;&lt;P&gt;or&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;... base search ... 
| rex "(?&amp;lt;field 1&amp;gt;[rex for field one])"
| rex "(?&amp;lt;f2&amp;gt;[rex for f2])" 
| rex "(?&amp;lt;f3&amp;gt;[rex for f3])"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;But which one is better for you? As usually it depends on what your events are. Are those always in same order &amp;nbsp; and all in place (then probably first one is better). Or can order be different and are those all present? In this case probably second one is better. Of course in second one you must separate those events from each other to get values to correct field name. For that reason you must add some additional strings etc. to those rex to match to the correct part of event.&lt;/P&gt;&lt;P&gt;And one option to use is add those extractions to props.conf and transforms.com especially when you need those in several queries.&lt;/P&gt;&lt;P&gt;Two other commands which can help you&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.2.4/SearchReference/Extract" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/8.2.4/SearchReference/Extract&lt;/A&gt;&amp;nbsp;and&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.2.4/SearchReference/Erex" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/8.2.4/SearchReference/Erex&lt;/A&gt;&lt;/P&gt;&lt;P&gt;r. Ismo&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jan 2022 11:45:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction-in-Data-Model/m-p/580439#M202226</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2022-01-10T11:45:37Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Field Extraction in Data Model</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction-in-Data-Model/m-p/580465#M202231</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hey &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/214410"&gt;@isoutamo&lt;/a&gt;. Thanks for the suggestion. However, my question is specific to forming the regex expression in the Regular Expression box within "App/Search/data_model_editor" of Splunk, and not about forming a search query as you've suggested.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2022-01-10 at 11.08.00 PM.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/17494iA62B56538529986A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screen Shot 2022-01-10 at 11.08.00 PM.png" alt="Screen Shot 2022-01-10 at 11.08.00 PM.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jan 2022 15:09:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction-in-Data-Model/m-p/580465#M202231</guid>
      <dc:creator>han</dc:creator>
      <dc:date>2022-01-10T15:09:15Z</dc:date>
    </item>
  </channel>
</rss>

