<?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 Field Extraction regex, stop at word or $ in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-regex-stop-at-word-or/m-p/500793#M139438</link>
    <description>&lt;P&gt;So I have some data that I'm trying to extract the application name from. These are Citrix ICA syslog events. &lt;/P&gt;

&lt;P&gt;Here's the 2 snippets I'm trying to match. One I'd like to stop at " - startTime" the other stop at the $. Both are the same field applicationName.&lt;/P&gt;

&lt;P&gt;applicationName &lt;EM&gt;SXe Staging GCAST-2&lt;/EM&gt; - startTime&lt;BR /&gt;
applicationName &lt;EM&gt;HDS 2016 VIRTUAL DESKTOP TEST&lt;/EM&gt; $S88-166 - startTime &lt;/P&gt;

&lt;P&gt;The italic text is what I'd like to get for the field value "applicationName"  &lt;/P&gt;

&lt;P&gt;Here is what I have come up with that does capture to - startTime.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; rex "applicationName (?&amp;lt;AAAAAAA&amp;gt;.+)(?=(\s-\sstartTime))"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However when I try &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;     rex "applicationName (?&amp;lt;AAAAAAA&amp;gt;.+)(?=(\s-\sstartTime|$))" 
     rex "applicationName (?&amp;lt;AAAAAAA&amp;gt;.+)(?=(\s-\sstartTime|\$))" 
     rex "applicationName (?&amp;lt;AAAAAAA&amp;gt;.+)(?=(\s-\sstartTime|\\$))" 
     rex "applicationName (?&amp;lt;AAAAAAA&amp;gt;[^$].+)(?=(\s-\sstartTime))" 
     rex "applicationName (?&amp;lt;AAAAAAA&amp;gt;[^\$|startTime].+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It doesn't quite work right. Anyway I'm just trying to limit the results to actual application names, not this extra bit of data that Citrix someone has thrown into the field.&lt;/P&gt;

&lt;P&gt;Like these, the two Windows 10 events should really be the same field value.&lt;BR /&gt;
SXe Staging GCAST-2&lt;BR /&gt;
HDS 2016 VIRTUAL DESKTOP TEST $S88-166&lt;BR /&gt;
Canada Greatplains&lt;BR /&gt;
Windows 10 $A41-29-3D5DDA4A-0001&lt;BR /&gt;
aSa ex Menu&lt;BR /&gt;
Windows 10 $A67-37-3D5C3C71-0001&lt;/P&gt;</description>
    <pubDate>Thu, 26 Mar 2020 14:43:11 GMT</pubDate>
    <dc:creator>JDukeSplunk</dc:creator>
    <dc:date>2020-03-26T14:43:11Z</dc:date>
    <item>
      <title>Field Extraction regex, stop at word or $</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-regex-stop-at-word-or/m-p/500793#M139438</link>
      <description>&lt;P&gt;So I have some data that I'm trying to extract the application name from. These are Citrix ICA syslog events. &lt;/P&gt;

&lt;P&gt;Here's the 2 snippets I'm trying to match. One I'd like to stop at " - startTime" the other stop at the $. Both are the same field applicationName.&lt;/P&gt;

&lt;P&gt;applicationName &lt;EM&gt;SXe Staging GCAST-2&lt;/EM&gt; - startTime&lt;BR /&gt;
applicationName &lt;EM&gt;HDS 2016 VIRTUAL DESKTOP TEST&lt;/EM&gt; $S88-166 - startTime &lt;/P&gt;

&lt;P&gt;The italic text is what I'd like to get for the field value "applicationName"  &lt;/P&gt;

&lt;P&gt;Here is what I have come up with that does capture to - startTime.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; rex "applicationName (?&amp;lt;AAAAAAA&amp;gt;.+)(?=(\s-\sstartTime))"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However when I try &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;     rex "applicationName (?&amp;lt;AAAAAAA&amp;gt;.+)(?=(\s-\sstartTime|$))" 
     rex "applicationName (?&amp;lt;AAAAAAA&amp;gt;.+)(?=(\s-\sstartTime|\$))" 
     rex "applicationName (?&amp;lt;AAAAAAA&amp;gt;.+)(?=(\s-\sstartTime|\\$))" 
     rex "applicationName (?&amp;lt;AAAAAAA&amp;gt;[^$].+)(?=(\s-\sstartTime))" 
     rex "applicationName (?&amp;lt;AAAAAAA&amp;gt;[^\$|startTime].+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It doesn't quite work right. Anyway I'm just trying to limit the results to actual application names, not this extra bit of data that Citrix someone has thrown into the field.&lt;/P&gt;

&lt;P&gt;Like these, the two Windows 10 events should really be the same field value.&lt;BR /&gt;
SXe Staging GCAST-2&lt;BR /&gt;
HDS 2016 VIRTUAL DESKTOP TEST $S88-166&lt;BR /&gt;
Canada Greatplains&lt;BR /&gt;
Windows 10 $A41-29-3D5DDA4A-0001&lt;BR /&gt;
aSa ex Menu&lt;BR /&gt;
Windows 10 $A67-37-3D5C3C71-0001&lt;/P&gt;</description>
      <pubDate>Thu, 26 Mar 2020 14:43:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-regex-stop-at-word-or/m-p/500793#M139438</guid>
      <dc:creator>JDukeSplunk</dc:creator>
      <dc:date>2020-03-26T14:43:11Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction regex, stop at word or $</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-regex-stop-at-word-or/m-p/500794#M139439</link>
      <description>&lt;P&gt;hi @JDukeSplunk,&lt;/P&gt;

&lt;P&gt;Try this regex:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "applicationName\s(?&amp;lt;application_name&amp;gt;[^\$]+).*\s-\sstartTime"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Sample query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="_raw
applicationName SXe Staging GCAST-2 - startTime
applicationName HDS 2016 VIRTUAL DESKTOP TEST $S88-166 - startTime
applicationName Canada Greatplains - startTime
applicationName Windows 10 $A41-29-3D5DDA4A-0001 - startTime" 
| multikv forceheader=1 
| rex "applicationName\s(?&amp;lt;application_name&amp;gt;[^\$]+).*\s-\sstartTime"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 26 Mar 2020 16:01:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-regex-stop-at-word-or/m-p/500794#M139439</guid>
      <dc:creator>manjunathmeti</dc:creator>
      <dc:date>2020-03-26T16:01:52Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction regex, stop at word or $</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-regex-stop-at-word-or/m-p/500795#M139440</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;\s+(?&amp;lt;capture&amp;gt;.*?)\s+(?:-|\$)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;See here:&lt;BR /&gt;
&lt;A href="https://regex101.com/r/TZlhtj/1"&gt;https://regex101.com/r/TZlhtj/1&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Mar 2020 16:25:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-regex-stop-at-word-or/m-p/500795#M139440</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2020-03-26T16:25:00Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction regex, stop at word or $</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-regex-stop-at-word-or/m-p/500796#M139441</link>
      <description>&lt;P&gt;In fairness, both regex's here work equally well. I just wanted to give @manjunathmeti the credit because his points are lower. &lt;/P&gt;

&lt;P&gt;Thanks both of you.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Mar 2020 17:28:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-regex-stop-at-word-or/m-p/500796#M139441</guid>
      <dc:creator>JDukeSplunk</dc:creator>
      <dc:date>2020-03-26T17:28:51Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction regex, stop at word or $</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-regex-stop-at-word-or/m-p/500797#M139442</link>
      <description>&lt;P&gt;As you should.  I also think his is probably better, too.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Mar 2020 17:36:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-regex-stop-at-word-or/m-p/500797#M139442</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2020-03-26T17:36:51Z</dc:date>
    </item>
  </channel>
</rss>

