<?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 extract fields from my sample log using regex? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-fields-from-my-sample-log-using-regex/m-p/224722#M66208</link>
    <description>&lt;P&gt;Don't know if you can do it with a regex, but what you can do is capture everything from the first "Step=" to the next field value, and then use &lt;CODE&gt;makemv&lt;/CODE&gt; with &lt;CODE&gt;delim=" , Step="&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Regex would look like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex "Step=(?P&amp;lt;steps&amp;gt;.+) ,&amp;lt;following field&amp;gt;"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or if there are no fields after the "step" fields:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex "Step=(?P&amp;lt;steps&amp;gt;.+) , $"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then use makemv to convert the single string into a list of values:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | makemv delim=" , Step=" steps
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This should result in something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Field1   Field2   steps
A        B        11001 11018 12302 ... 15016
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope this helps&lt;/P&gt;</description>
    <pubDate>Wed, 11 Nov 2015 14:22:33 GMT</pubDate>
    <dc:creator>aholzer</dc:creator>
    <dc:date>2015-11-11T14:22:33Z</dc:date>
    <item>
      <title>How do I extract fields from my sample log using regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-fields-from-my-sample-log-using-regex/m-p/224721#M66207</link>
      <description>&lt;P&gt;I got a log containing "Step" values in order:&lt;/P&gt;

&lt;P&gt;Step=11001 , Step=11018 , Step=12302 , Step=12319 , Step=12800 , Step=12805 , Step=12806 , Step=12801 , Step=12802 , Step=12305 , Step=11006 , Step=11001 , Step=11018 , Step=12304 , Step=12319 , Step=12804 , Step=12816 , Step=12311 , Step=15041 , Step=15004 , Step=15013 , Step=24432 , Step=24416 , Step=22037 , Step=15044 , Step=12312 , Step=12305 , Step=11006 , Step=11001 , Step=11018 , Step=12304 , Step=12306 , Step=11503 , Step=24703 , Step=24702 , Step=15035 , Step=15042 , Step=15036 , Step=15004 , Step=15016 , &lt;/P&gt;

&lt;P&gt;How can I extract fields from this? End result should be that each Step has its own field (Step1, Step2) and so on&lt;/P&gt;</description>
      <pubDate>Wed, 11 Nov 2015 14:04:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-fields-from-my-sample-log-using-regex/m-p/224721#M66207</guid>
      <dc:creator>bravon</dc:creator>
      <dc:date>2015-11-11T14:04:24Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract fields from my sample log using regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-fields-from-my-sample-log-using-regex/m-p/224722#M66208</link>
      <description>&lt;P&gt;Don't know if you can do it with a regex, but what you can do is capture everything from the first "Step=" to the next field value, and then use &lt;CODE&gt;makemv&lt;/CODE&gt; with &lt;CODE&gt;delim=" , Step="&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Regex would look like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex "Step=(?P&amp;lt;steps&amp;gt;.+) ,&amp;lt;following field&amp;gt;"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or if there are no fields after the "step" fields:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex "Step=(?P&amp;lt;steps&amp;gt;.+) , $"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then use makemv to convert the single string into a list of values:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | makemv delim=" , Step=" steps
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This should result in something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Field1   Field2   steps
A        B        11001 11018 12302 ... 15016
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope this helps&lt;/P&gt;</description>
      <pubDate>Wed, 11 Nov 2015 14:22:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-fields-from-my-sample-log-using-regex/m-p/224722#M66208</guid>
      <dc:creator>aholzer</dc:creator>
      <dc:date>2015-11-11T14:22:33Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract fields from my sample log using regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-fields-from-my-sample-log-using-regex/m-p/224723#M66209</link>
      <description>&lt;P&gt;Thanks for the input - it got us on the right track:)&lt;/P&gt;</description>
      <pubDate>Thu, 12 Nov 2015 15:23:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-fields-from-my-sample-log-using-regex/m-p/224723#M66209</guid>
      <dc:creator>bravon</dc:creator>
      <dc:date>2015-11-12T15:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract fields from my sample log using regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-fields-from-my-sample-log-using-regex/m-p/224724#M66210</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| rex max_match=0 "Step=(?&amp;lt;a_Step&amp;gt;([0-9]{5}))" 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This puts all the "Step" values in one field called "a_Step"&lt;BR /&gt;
Next task is to lookup the a_Step-values in a .cvs-file and properly present the info to a user&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| lookup my_csv_lookup "Message Code" AS a_Step OUTPUT Category 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When using the search app and applying the rex+lookup the "Category" field now lists the Category for each Step in the right order.&lt;BR /&gt;
Next task at hand is to figure out how to best present this to the users accessing the data&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:55:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-fields-from-my-sample-log-using-regex/m-p/224724#M66210</guid>
      <dc:creator>bravon</dc:creator>
      <dc:date>2020-09-29T07:55:01Z</dc:date>
    </item>
  </channel>
</rss>

