<?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 write the regex to extract these values from my sample data? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-extract-these-values-from-my-sample/m-p/228799#M67704</link>
    <description>&lt;P&gt;Here's one way &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;GENID\s(?&amp;lt;gen_id&amp;gt;\d+)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 17 Nov 2015 03:00:29 GMT</pubDate>
    <dc:creator>sundareshr</dc:creator>
    <dc:date>2015-11-17T03:00:29Z</dc:date>
    <item>
      <title>How do I write the regex to extract these values from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-extract-these-values-from-my-sample/m-p/228798#M67703</link>
      <description>&lt;P&gt;Evening Splunk experts,&lt;/P&gt;

&lt;P&gt;I am stuck trying to perform an extraction.  I am using the built-in tool, but it keeps generating an incorrect regex.  When I try to generate one myself, which works just fine using only regex tester, I get a message that no matches were found.  &lt;/P&gt;

&lt;P&gt;Below are sample logs from an in-house app and I am trying to create a field called &lt;STRONG&gt;gen_id&lt;/STRONG&gt; and store the value to the right of the GENDID in the logs.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Nov 16 20:34:39 dtcSource01 dtc_data: detailStatus: Message finished GENID 399488 done
Nov 16 20:34:39 dtcSource01 dtc_data: detailStatus: MMR Message done RGENID 4 GENID 399488
Nov 16 20:34:39 dtcSource01 dtc_data: detailStatus: DSTC: shield GENID 399488
Nov 16 20:34:39 dtcSource01 dtc_data: detailStatus: MMR processing Begin RGENID 4 GENID 399488 to local shield
Nov 16 20:34:36 dtcSource01 dtc_data: detailStatus: GENID 399488 queued for processing
Nov 16 20:34:36 dtcSource01 dtc_data: detailStatus: DSTC: Delivering GENID 399488 to DSTC (skipping local)
Nov 16 20:34:36 dtcSource01 dtc_data: detailStatus: DSTC: Tagging GENID 399488 for shield from 192.x.x.x
Nov 16 20:19:14 dtcSource01 dtc_data: detailStatus: Begin GENID 568833 GID 289575
Nov 16 20:19:12 dtcSource01 dtc_data: detailStatus: GENID 568938 queued for local processing
Nov 16 20:19:12 dtcSource01 dtc_data: detailStatus: DSTC: Delivering GENID 568938 to DSTC (skipping work queue)
Nov 16 20:21:05 dtcSource01 dtc_data: detailStatus: GENID 398845 SubStatus 'working'
Nov 16 20:21:05 dtcSource01 dtc_data: detailStatus: DSTC: Delivering GENID 398845 to DSTC (skipping work queue)
Nov 16 20:21:05 dtcSource01 dtc_data: detailStatus: GENID 398845 queued for processing
Nov 16 20:19:17 dtcSource01 dtc_data: detailStatus: MMR processing Begin RGENID 4 GENID 568938 to local
Nov 16 20:19:14 dtcSource01 dtc_data: detailStatus: DSTC: Delivering GENID 568833 to DSTC (skipping local)
Nov 16 20:19:11 dtcSource01 dtc_data: detailStatus: DSTC: Delivering GENID 568899 to DSTC (skipping local)  
Nov 16 20:11:33 dtcSource01 dtc_data: detailStatus: DSTC: Tagging GENID 703728 for shield from 192.x.x.x
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I tried the following commands, but they either don't capture what I need or capture data before or after the ID - not sure what I am doing wrong.  A simple &lt;CODE&gt;GENID\s\d+&lt;/CODE&gt; should do it.  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  | rex field=_raw "GENID (?&amp;lt;GENID&amp;gt;.*)"
  | rex field=_raw "GENID (?&amp;lt;GENID&amp;gt;\s\d+)"
  | rex field=_raw "GENID (?&amp;lt;GENID&amp;gt; \d+).*?"
  | (?P&amp;lt;FIELDNAME&amp;gt;\w+\s+\d+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What I would like to have extracted are the following values - I want to be able to create a field called &lt;STRONG&gt;gen_id&lt;/STRONG&gt; and store the values below. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    Fieldname         ID
    GENID            399488
    GENID            568833
    GENID            398845
    GENID            568833
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks for helping out.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2015 02:30:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-extract-these-values-from-my-sample/m-p/228798#M67703</guid>
      <dc:creator>splunker1981</dc:creator>
      <dc:date>2015-11-17T02:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: How do I write the regex to extract these values from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-extract-these-values-from-my-sample/m-p/228799#M67704</link>
      <description>&lt;P&gt;Here's one way &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;GENID\s(?&amp;lt;gen_id&amp;gt;\d+)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 17 Nov 2015 03:00:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-extract-these-values-from-my-sample/m-p/228799#M67704</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2015-11-17T03:00:29Z</dc:date>
    </item>
    <item>
      <title>Re: How do I write the regex to extract these values from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-extract-these-values-from-my-sample/m-p/228800#M67705</link>
      <description>&lt;P&gt;Thanks for the reply, but I don't follow.  I tried adding that to the regex generator to test and I get an error "Invalid regex: unexpected end of pattern"&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2015 03:16:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-extract-these-values-from-my-sample/m-p/228800#M67705</guid>
      <dc:creator>splunker1981</dc:creator>
      <dc:date>2015-11-17T03:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: How do I write the regex to extract these values from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-extract-these-values-from-my-sample/m-p/228801#M67706</link>
      <description>&lt;P&gt;That's strange. It missing the field name. Try this &lt;CODE&gt;GENID\s(?\d+)&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2015 03:34:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-extract-these-values-from-my-sample/m-p/228801#M67706</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2015-11-17T03:34:29Z</dc:date>
    </item>
    <item>
      <title>Re: How do I write the regex to extract these values from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-extract-these-values-from-my-sample/m-p/228802#M67707</link>
      <description>&lt;P&gt;It's missing again. For some reason, the field name is getting dropped here. In the online documentation (&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.0/SearchReference/rex"&gt;http://docs.splunk.com/Documentation/Splunk/6.0/SearchReference/rex&lt;/A&gt;) for rex. look at the first example. There a "from" after the ? within angle brackets. That's what is missing. You need to add that, you may change "from" to whatever you would like to name the field. Hope this explains it&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2015 03:35:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-extract-these-values-from-my-sample/m-p/228802#M67707</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2015-11-17T03:35:22Z</dc:date>
    </item>
    <item>
      <title>Re: How do I write the regex to extract these values from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-extract-these-values-from-my-sample/m-p/228803#M67708</link>
      <description>&lt;P&gt;I hope this work. I use &lt;CODE&gt;\s&lt;/CODE&gt; before GENID because there is value "RGENID" in your data.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=_raw "\sGENID\s(?&amp;lt;gen_id&amp;gt;\d+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 17 Nov 2015 08:16:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-extract-these-values-from-my-sample/m-p/228803#M67708</guid>
      <dc:creator>yulianaif</dc:creator>
      <dc:date>2015-11-17T08:16:08Z</dc:date>
    </item>
    <item>
      <title>Re: How do I write the regex to extract these values from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-extract-these-values-from-my-sample/m-p/228804#M67709</link>
      <description>&lt;P&gt;Hi @sundareshr &lt;/P&gt;

&lt;P&gt;I just edited your original answer to get the field name within angle brackets to show up properly. Looks like it has to be within a Code Sample box on its own line. I've filed a bug with angle brackets not being rendered properly on this site when only surrounded by backticks. &lt;/P&gt;

&lt;P&gt;Cheers!&lt;/P&gt;

&lt;P&gt;Patrick&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 02:35:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-extract-these-values-from-my-sample/m-p/228804#M67709</guid>
      <dc:creator>ppablo</dc:creator>
      <dc:date>2015-11-18T02:35:58Z</dc:date>
    </item>
    <item>
      <title>Re: How do I write the regex to extract these values from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-extract-these-values-from-my-sample/m-p/228805#M67710</link>
      <description>&lt;P&gt;@ppablo Thanks. I tried both backticks as well as code sample box on its own line. I have not been able to get those angle brackets to show these past couple days.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 03:10:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-extract-these-values-from-my-sample/m-p/228805#M67710</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2015-11-18T03:10:43Z</dc:date>
    </item>
  </channel>
</rss>

