<?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 to terminate an extracted field at a specific string in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-terminate-an-extracted-field-at-a-specific-string/m-p/29787#M6024</link>
    <description>&lt;P&gt;If its really terminated by linefeed, you could do something like this instead&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?i)object_name:(?P&amp;lt;SQL_AUDIT_OBJECT&amp;gt;[^\n]+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That will find everything till the end of the line.  I think the problem your having is that the .+ is greedy.  I usually try to do regex where i don't use .  &lt;/P&gt;

&lt;P&gt;If its not line feed terminated and the above is formatted for our benefit, you could do &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?i)object_name:(?P&amp;lt;SQL_AUDIT_OBJECT&amp;gt;[^\s]+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;which will break at the first whitespace character (tab, space, linefeed, etc.)&lt;/P&gt;

&lt;P&gt;rob&lt;/P&gt;</description>
    <pubDate>Wed, 18 Apr 2012 20:57:35 GMT</pubDate>
    <dc:creator>robgreen</dc:creator>
    <dc:date>2012-04-18T20:57:35Z</dc:date>
    <item>
      <title>How to terminate an extracted field at a specific string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-terminate-an-extracted-field-at-a-specific-string/m-p/29786#M6023</link>
      <description>&lt;P&gt;I have a log entry that looks like the following:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;04/18/2012 09:41:36 AM&lt;BR /&gt;
LogName=Application&lt;BR /&gt;
SourceName=MSSQLSERVER&lt;BR /&gt;
EventCode=33205&lt;BR /&gt;
EventType=0&lt;BR /&gt;
Type=Information&lt;BR /&gt;
ComputerName=Computer_Name&lt;BR /&gt;
TaskCategory=None&lt;BR /&gt;
OpCode=None&lt;BR /&gt;
RecordNumber=193724&lt;BR /&gt;
Keywords=Audit Success, Classic&lt;BR /&gt;
Message=Audit event: event_time:2012-04-18 14:41:35.6506383&lt;BR /&gt;
sequence_number:1&lt;BR /&gt;
action_id:SL &lt;BR /&gt;
succeeded:true&lt;BR /&gt;
permission_bitmask:1&lt;BR /&gt;
is_column_permission:true&lt;BR /&gt;
session_id:261&lt;BR /&gt;
server_principal_id:2&lt;BR /&gt;
database_principal_id:1&lt;BR /&gt;
target_server_principal_id:0&lt;BR /&gt;
target_database_principal_id:0&lt;BR /&gt;
object_id:310160421&lt;BR /&gt;
class_type:U &lt;BR /&gt;
session_server_principal_name:user&lt;BR /&gt;
server_principal_name:user&lt;BR /&gt;
server_principal_sid:random_number&lt;BR /&gt;
database_principal_name:dbo&lt;BR /&gt;
target_server_principal_name:&lt;BR /&gt;
target_server_principal_sid:&lt;BR /&gt;
target_database_principal_name:&lt;BR /&gt;
server_instance_name:Computer_Name&lt;BR /&gt;
database_name:dbName&lt;BR /&gt;
schema_name:dbo&lt;BR /&gt;
object_name:TableName&lt;BR /&gt;
statement:select *&lt;BR /&gt;
 from TableName order by CreateDate desc&lt;BR /&gt;
additional_information:&lt;BR /&gt;
.&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I am attempting to only extract the object_name field out of the Message from the event log entry(this log came from the Windows Application Event Log).  Going through the field extraction UI I generated the following extraction:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?i)object_name:(?P&amp;lt;SQL_AUDIT_OBJECT&amp;gt;.+\s)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I would like to be able to parse the object_name field from within the message up to the word 'statement:'.  This would allow me to capture database objects that might have a space in them.  The extraction created in the wizard (noted above) yields the remainder of the message including the statement and additional information in the extracted field.  This causes a problem when it comes to grouping by the object_name extraction.&lt;/P&gt;

&lt;P&gt;Any help is appreciated.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 11:41:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-terminate-an-extracted-field-at-a-specific-string/m-p/29786#M6023</guid>
      <dc:creator>dweh</dc:creator>
      <dc:date>2020-09-28T11:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to terminate an extracted field at a specific string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-terminate-an-extracted-field-at-a-specific-string/m-p/29787#M6024</link>
      <description>&lt;P&gt;If its really terminated by linefeed, you could do something like this instead&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?i)object_name:(?P&amp;lt;SQL_AUDIT_OBJECT&amp;gt;[^\n]+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That will find everything till the end of the line.  I think the problem your having is that the .+ is greedy.  I usually try to do regex where i don't use .  &lt;/P&gt;

&lt;P&gt;If its not line feed terminated and the above is formatted for our benefit, you could do &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?i)object_name:(?P&amp;lt;SQL_AUDIT_OBJECT&amp;gt;[^\s]+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;which will break at the first whitespace character (tab, space, linefeed, etc.)&lt;/P&gt;

&lt;P&gt;rob&lt;/P&gt;</description>
      <pubDate>Wed, 18 Apr 2012 20:57:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-terminate-an-extracted-field-at-a-specific-string/m-p/29787#M6024</guid>
      <dc:creator>robgreen</dc:creator>
      <dc:date>2012-04-18T20:57:35Z</dc:date>
    </item>
  </channel>
</rss>

