<?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 create a regex to extract data from windows event? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-data-from-windows-event/m-p/502250#M139795</link>
    <description>&lt;P&gt;I have an event code 33205 which comes from Windows application logs, for which field extraction is not happening eventhough Windows Add-on in installed. &lt;BR /&gt;
To extract the statement field in the event, I am using the below regular expression &lt;/P&gt;

&lt;P&gt;| rex field=_raw "statement:(?[\d\D]*[\n\s])additional"&lt;/P&gt;

&lt;P&gt;which extracts the data till additional_information field. But there are extra spaces which are getting included while extracting like this&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;quote&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;EXEC %%Object(MultiName = @qualified_name).LockMatchID(ID = @tabid, Exclusive = 1, BindInternal = 0)&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;unquote&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;The extra spaces is not getting removed. Could you please help on this to write regex?&lt;/P&gt;

&lt;P&gt;Sample event.&lt;/P&gt;

&lt;P&gt;database_name:test&lt;BR /&gt;
schema_name:dbo&lt;BR /&gt;
object_name:Table_2&lt;BR /&gt;
statement:EXEC %%Object(MultiName = @qualified_name).LockMatchID(ID = @tabid, Exclusive = 1, BindInternal = 0)&lt;/P&gt;

&lt;P&gt;additional_information:&lt;BR /&gt;
user_defined_information:&lt;BR /&gt;
application_name:EUPTTOPDBS004\SQLNAV-test-test2-4&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 04:44:39 GMT</pubDate>
    <dc:creator>gndivya</dc:creator>
    <dc:date>2020-09-30T04:44:39Z</dc:date>
    <item>
      <title>How to create a regex to extract data from windows event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-data-from-windows-event/m-p/502250#M139795</link>
      <description>&lt;P&gt;I have an event code 33205 which comes from Windows application logs, for which field extraction is not happening eventhough Windows Add-on in installed. &lt;BR /&gt;
To extract the statement field in the event, I am using the below regular expression &lt;/P&gt;

&lt;P&gt;| rex field=_raw "statement:(?[\d\D]*[\n\s])additional"&lt;/P&gt;

&lt;P&gt;which extracts the data till additional_information field. But there are extra spaces which are getting included while extracting like this&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;quote&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;EXEC %%Object(MultiName = @qualified_name).LockMatchID(ID = @tabid, Exclusive = 1, BindInternal = 0)&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;unquote&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;The extra spaces is not getting removed. Could you please help on this to write regex?&lt;/P&gt;

&lt;P&gt;Sample event.&lt;/P&gt;

&lt;P&gt;database_name:test&lt;BR /&gt;
schema_name:dbo&lt;BR /&gt;
object_name:Table_2&lt;BR /&gt;
statement:EXEC %%Object(MultiName = @qualified_name).LockMatchID(ID = @tabid, Exclusive = 1, BindInternal = 0)&lt;/P&gt;

&lt;P&gt;additional_information:&lt;BR /&gt;
user_defined_information:&lt;BR /&gt;
application_name:EUPTTOPDBS004\SQLNAV-test-test2-4&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:44:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-data-from-windows-event/m-p/502250#M139795</guid>
      <dc:creator>gndivya</dc:creator>
      <dc:date>2020-09-30T04:44:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a regex to extract data from windows event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-data-from-windows-event/m-p/502251#M139796</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;Check this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
 | eval log="database_name:test
schema_name:dbo
object_name:Table_2
statement:EXEC %%Object(MultiName = @qualified_name).LockMatchID(ID = @tabid, Exclusive = 1, BindInternal = 0)

additional_information:
user_defined_information:
application_name:EUPTTOPDBS004\SQLNAV-test-test2-4" |rex field=log "statement:(?P&amp;lt;statement&amp;gt;[^\n]+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 Mar 2020 07:49:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-data-from-windows-event/m-p/502251#M139796</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2020-03-20T07:49:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a regex to extract data from windows event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-data-from-windows-event/m-p/502252#M139797</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| rex "(?m)statement:(?&amp;lt;statement&amp;gt;.*$)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;try &lt;CODE&gt;(?m)&lt;/CODE&gt; option.     OR&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "statement:(?&amp;lt;statement&amp;gt;.*+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 Mar 2020 09:50:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-data-from-windows-event/m-p/502252#M139797</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-03-20T09:50:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a regex to extract data from windows event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-data-from-windows-event/m-p/502253#M139798</link>
      <description>&lt;P&gt;@to4kawa this worked when in a normal search query, I am not sure why the same regex is not working when it is used in inline field extractions. Could you please help me with this?&lt;BR /&gt;
I want to know, what does that (?m) means at the beginning of the regex string. If possible, kindly let me know what document you refer to while creating regular expression.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Mar 2020 14:44:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-data-from-windows-event/m-p/502253#M139798</guid>
      <dc:creator>gndivya</dc:creator>
      <dc:date>2020-03-20T14:44:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a regex to extract data from windows event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-data-from-windows-event/m-p/502254#M139799</link>
      <description>&lt;P&gt;@vnravikumar , This is working when used in a normal query, but I am not sure why the same regex is not working when it is used in inline field extractions. Could you please help me with this?&lt;/P&gt;</description>
      <pubDate>Fri, 20 Mar 2020 14:45:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-data-from-windows-event/m-p/502254#M139799</guid>
      <dc:creator>gndivya</dc:creator>
      <dc:date>2020-03-20T14:45:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a regex to extract data from windows event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-data-from-windows-event/m-p/502255#M139800</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex "statement\:(?&amp;lt;statement&amp;gt;.*)[\r\n\s]+additional"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 Mar 2020 15:58:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-data-from-windows-event/m-p/502255#M139800</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2020-03-20T15:58:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a regex to extract data from windows event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-data-from-windows-event/m-p/502256#M139801</link>
      <description>&lt;P&gt;&lt;CODE&gt;(?m)&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="https://www.php.net/manual/en/reference.pcre.pattern.modifiers.php"&gt;https://www.php.net/manual/en/reference.pcre.pattern.modifiers.php&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Settings:&lt;/P&gt;

&lt;P&gt;Fields » Field extractions » Add new&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;Destination app &lt;CODE&gt;search&lt;/CODE&gt;(default)&lt;/LI&gt;
&lt;LI&gt;Name &lt;CODE&gt;statement_extraction&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;Apply to &lt;CODE&gt;sourcetype&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;named &lt;CODE&gt;your sourcetype&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;Type &lt;CODE&gt;Inline&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;Extraction/Transform &lt;CODE&gt;statement:(?&amp;lt;statement&amp;gt;.*+)&lt;/CODE&gt;&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Fri, 20 Mar 2020 20:55:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-data-from-windows-event/m-p/502256#M139801</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-03-20T20:55:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a regex to extract data from windows event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-data-from-windows-event/m-p/502257#M139802</link>
      <description>&lt;P&gt;There is a fairly unknown gem which is your best friend in these scenarios, "erex".&lt;/P&gt;

&lt;P&gt;Easiest to quote examples directly from the documentation, but it works like a champ.&lt;BR /&gt;
... | erex monthday examples="7/01, 07/02" counterexamples="99/2"&lt;/P&gt;

&lt;P&gt;Use "examples" to include samples of what you are searching for, and "counterexamples" to exclude.&lt;BR /&gt;
Append one or both to your existing search, then view the Job Inspector. It'll give you the correct regex syntax to find what you are looking for. It is extremely useful!&lt;/P&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.2/SearchReference/Erex"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.2/SearchReference/Erex&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 21 Mar 2020 00:34:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-data-from-windows-event/m-p/502257#M139802</guid>
      <dc:creator>codebuilder</dc:creator>
      <dc:date>2020-03-21T00:34:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a regex to extract data from windows event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-data-from-windows-event/m-p/502258#M139803</link>
      <description>&lt;P&gt;When I use this, I am getting all the data after "statement" like additional_information, user_defined_information, all other things. Please let me know what else can be done to get only the required information&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:40:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-data-from-windows-event/m-p/502258#M139803</guid>
      <dc:creator>gndivya</dc:creator>
      <dc:date>2020-09-30T04:40:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a regex to extract data from windows event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-data-from-windows-event/m-p/502259#M139804</link>
      <description>&lt;P&gt;your log is something wrong.&lt;BR /&gt;
check props.conf and LINE_BREAKER&lt;/P&gt;</description>
      <pubDate>Mon, 23 Mar 2020 08:56:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-to-extract-data-from-windows-event/m-p/502259#M139804</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-03-23T08:56:05Z</dc:date>
    </item>
  </channel>
</rss>

