<?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 question in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/regex-field-extraction-question/m-p/84110#M21450</link>
    <description>&lt;P&gt;no prob &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 30 Sep 2011 10:25:52 GMT</pubDate>
    <dc:creator>Drainy</dc:creator>
    <dc:date>2011-09-30T10:25:52Z</dc:date>
    <item>
      <title>regex field extraction question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-field-extraction-question/m-p/84100#M21440</link>
      <description>&lt;P&gt;I'm trying to extract these values into a field called Data. &lt;/P&gt;

&lt;P&gt;from sample 1:&lt;BR /&gt;&lt;BR /&gt;
&lt;STRONG&gt;CMD(XYZ) Val(*12A)&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;In props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[log]
REPORT-mydata = mydata 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In transforms.conf  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[mydata]
REGEX = (?i).*CMD\((?&amp;lt;Data&amp;gt;\S+)\) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but it can only capture the values XYZ after CMD.I wana include the entire string like CMD(XYZ) Val(*12A).&lt;BR /&gt;
How do I specify in the regex to include the entire string? &lt;/P&gt;

&lt;P&gt;sample 1:&lt;BR /&gt;&lt;BR /&gt;
Sep 29 13:13:25 10.138.20.37 Sep 29 13:07:25 serverA A command (CMD) was run.|3|src=1.2.3.4 dst=0.0.0.0 msg=TYPE:JRN CLS:AUD JJOB:123 JUSER:user JNBR:123 PGM:abc OBJECT: LIBRARY: MEMBER: DETAIL:C CMD SYS &lt;EM&gt;CMD N SYS/CMD LIB(ABCD) DEV(*SA) SAVF(temp) OPTION(*NA) MBROPT(*ALL) OBJ(*ALL) FR(*SYSVAL) **CMD(XYZ) Val(*12A)&lt;/EM&gt;*&lt;/P&gt;

&lt;P&gt;Sep 29 13:13:25 10.138.20.37 Sep 29 13:07:25 serverA A command (CMD) was run.|3|src=1.2.3.4 dst=0.0.0.0 msg=TYPE:JRN CLS:AUD JJOB:123 JUSER:user JNBR:123 PGM:abc OBJECT: LIBRARY: MEMBER: DETAIL:C CMD SYS &lt;EM&gt;CMD N SYS/CMD LIB(ABCD) DEV(*SA) SAVF(temp) OPTION(*NA) MBROPT(*ALL) OBJ(*ALL) JJJ(*NA) **CMD(XYZ) Val(*12A)&lt;/EM&gt;*&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 09:56:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-field-extraction-question/m-p/84100#M21440</guid>
      <dc:creator>remy06</dc:creator>
      <dc:date>2020-09-28T09:56:06Z</dc:date>
    </item>
    <item>
      <title>Re: regex field extraction question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-field-extraction-question/m-p/84101#M21441</link>
      <description>&lt;P&gt;you could use;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(\w+\([^)]+\))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;to capture each one separately and then just assign them the same field extraction name so you can associate them with your events correctly.&lt;BR /&gt;
I have made some assumptions however that there isn't another set of characters arranged like that in the events.&lt;/P&gt;

&lt;P&gt;Feel free to comment if this is off the mark &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Have a look at the following links for details on configuring these via the config files&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/4.2.3/admin/Transformsconf"&gt;http://docs.splunk.com/Documentation/Splunk/4.2.3/admin/Transformsconf&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/4.2.3/admin/Propsconf"&gt;http://docs.splunk.com/Documentation/Splunk/4.2.3/admin/Propsconf&lt;/A&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Transforms.conf
[data_regex]
REGEX = (\w+\([^)]+\))
FORMAT = data::$1

Props.conf
REPORT-data_regex = data_regex
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The transforms lines say to name group 1 ($1) as data (or whatever you specify).&lt;BR /&gt;
You could also do;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Transforms.conf
[data_regex]
REGEX = (?&amp;lt;data&amp;gt;\w+\([^)]+\))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;EDIT:&lt;BR /&gt;
Assuming you answer yes to my comment on your question then;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(CMD\([^)]+\) [^)]+\))
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 30 Sep 2011 08:33:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-field-extraction-question/m-p/84101#M21441</guid>
      <dc:creator>Drainy</dc:creator>
      <dc:date>2011-09-30T08:33:48Z</dc:date>
    </item>
    <item>
      <title>Re: regex field extraction question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-field-extraction-question/m-p/84102#M21442</link>
      <description>&lt;P&gt;there are set of characters in other parts of the event. I've updated the sample.Usually if I specify in transforms.conf the "&lt;DATA&gt;" becomes the extracted field name. In your example how do I specify the field name?&lt;/DATA&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2011 08:51:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-field-extraction-question/m-p/84102#M21442</guid>
      <dc:creator>remy06</dc:creator>
      <dc:date>2011-09-30T08:51:11Z</dc:date>
    </item>
    <item>
      <title>Re: regex field extraction question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-field-extraction-question/m-p/84103#M21443</link>
      <description>&lt;P&gt;@remy06 you can use the same thing, I'll update my answer with two examples&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2011 08:54:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-field-extraction-question/m-p/84103#M21443</guid>
      <dc:creator>Drainy</dc:creator>
      <dc:date>2011-09-30T08:54:07Z</dc:date>
    </item>
    <item>
      <title>Re: regex field extraction question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-field-extraction-question/m-p/84104#M21444</link>
      <description>&lt;P&gt;your added examples have 3 characters followed by whitespace and then more characters. my example will look for characters followed directly by an open bracket.&lt;BR /&gt;
Is there some defined example that this data always follows  you could also use to regex on?&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2011 08:59:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-field-extraction-question/m-p/84104#M21444</guid>
      <dc:creator>Drainy</dc:creator>
      <dc:date>2011-09-30T08:59:03Z</dc:date>
    </item>
    <item>
      <title>Re: regex field extraction question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-field-extraction-question/m-p/84105#M21445</link>
      <description>&lt;P&gt;does it always end with the data you want to collect? as in they are always at the end of the event?&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2011 09:40:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-field-extraction-question/m-p/84105#M21445</guid>
      <dc:creator>Drainy</dc:creator>
      <dc:date>2011-09-30T09:40:32Z</dc:date>
    </item>
    <item>
      <title>Re: regex field extraction question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-field-extraction-question/m-p/84106#M21446</link>
      <description>&lt;P&gt;thanks..I've also updated the example event hopefully its much clearer&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2011 09:41:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-field-extraction-question/m-p/84106#M21446</guid>
      <dc:creator>remy06</dc:creator>
      <dc:date>2011-09-30T09:41:37Z</dc:date>
    </item>
    <item>
      <title>Re: regex field extraction question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-field-extraction-question/m-p/84107#M21447</link>
      <description>&lt;P&gt;way ahead of you, check out my comment on the question and my edit &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2011 09:42:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-field-extraction-question/m-p/84107#M21447</guid>
      <dc:creator>Drainy</dc:creator>
      <dc:date>2011-09-30T09:42:04Z</dc:date>
    </item>
    <item>
      <title>Re: regex field extraction question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-field-extraction-question/m-p/84108#M21448</link>
      <description>&lt;P&gt;thanks!gona test it soon&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2011 09:44:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-field-extraction-question/m-p/84108#M21448</guid>
      <dc:creator>remy06</dc:creator>
      <dc:date>2011-09-30T09:44:46Z</dc:date>
    </item>
    <item>
      <title>Re: regex field extraction question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-field-extraction-question/m-p/84109#M21449</link>
      <description>&lt;P&gt;it works..thanks &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2011 10:25:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-field-extraction-question/m-p/84109#M21449</guid>
      <dc:creator>remy06</dc:creator>
      <dc:date>2011-09-30T10:25:15Z</dc:date>
    </item>
    <item>
      <title>Re: regex field extraction question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-field-extraction-question/m-p/84110#M21450</link>
      <description>&lt;P&gt;no prob &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2011 10:25:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-field-extraction-question/m-p/84110#M21450</guid>
      <dc:creator>Drainy</dc:creator>
      <dc:date>2011-09-30T10:25:52Z</dc:date>
    </item>
  </channel>
</rss>

