<?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: Extracting the last words from my Logfile in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Extracting-the-last-words-from-my-Logfile/m-p/318881#M93229</link>
    <description>&lt;P&gt;As from the run anywhere search it is working for the given event. Can you provide some sample events for which it is not working ?&lt;/P&gt;</description>
    <pubDate>Tue, 06 Mar 2018 03:34:52 GMT</pubDate>
    <dc:creator>mayurr98</dc:creator>
    <dc:date>2018-03-06T03:34:52Z</dc:date>
    <item>
      <title>Extracting the last words from my Logfile</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Extracting-the-last-words-from-my-Logfile/m-p/318874#M93222</link>
      <description>&lt;P&gt;My logfile has lines like this:&lt;/P&gt;

&lt;P&gt;MY_TEST;0;12/12/2014 23:30:14:9000;1;MK69KSS97;TRKCHOP;;4480;EXPORT THE TALISMAN;9;0;0;;Q:\TRKCHOP\POMS\KSKAGNE\IN\STAKK.TXT&lt;/P&gt;

&lt;P&gt;i want to extract the the last word that is "STAKK.TXT"&lt;/P&gt;

&lt;P&gt;can anybody help me in this?&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2018 07:08:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Extracting-the-last-words-from-my-Logfile/m-p/318874#M93222</guid>
      <dc:creator>pradiptam</dc:creator>
      <dc:date>2018-03-05T07:08:28Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting the last words from my Logfile</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Extracting-the-last-words-from-my-Logfile/m-p/318875#M93223</link>
      <description>&lt;P&gt;Try this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=your_search |rex "^.*\\\(?P&amp;lt;filename&amp;gt;.*)$"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Mar 2018 08:37:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Extracting-the-last-words-from-my-Logfile/m-p/318875#M93223</guid>
      <dc:creator>miyamaet</dc:creator>
      <dc:date>2018-03-05T08:37:03Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting the last words from my Logfile</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Extracting-the-last-words-from-my-Logfile/m-p/318876#M93224</link>
      <description>&lt;P&gt;Hi @pradiptam,&lt;/P&gt;

&lt;P&gt;Please try &lt;CODE&gt;&amp;lt;yourbasesearch&amp;gt; | rex ".*;*\\\(?&amp;lt;extracted_field&amp;gt;\S+)"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I am running below run anywhere search which is generating new field called &lt;CODE&gt;extracted_field&lt;/CODE&gt; with value &lt;CODE&gt;STAKK.TXT&lt;/CODE&gt; (First 2 lines in below query are generating sample data only.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval _raw="MY_TEST;0;12/12/2014 23:30:14:9000;1;MK69KSS97;TRKCHOP;;4480;EXPORT THE TALISMAN;9;0;0;;Q:\TRKCHOP\POMS\KSKAGNE\IN\STAKK.TXT"
| rex ".*;*\\\(?&amp;lt;extracted_field&amp;gt;\S+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I hope this helps.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Harshil&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2018 08:45:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Extracting-the-last-words-from-my-Logfile/m-p/318876#M93224</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2018-03-05T08:45:46Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting the last words from my Logfile</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Extracting-the-last-words-from-my-Logfile/m-p/318877#M93225</link>
      <description>&lt;P&gt;Hello @pradiptam&lt;/P&gt;

&lt;P&gt;Assuming your sample event looks like this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;MY_TEST;0;12/12/2014 23:32:14:9000;1;MK69KSS97;TRKCHOP;;4480;EXPORT THE TALISMAN;9;0;0;;Q:\TRKCHOP\POMS\KSKAGNE\IN\STAKK.TXT

MY_TEST;0;12/12/2014 23:31:14:9000;1;MK69KSS97;TRKCHOP;;4480;EXPORT THE TALISMAN;9;0;0;;Q:\TRKCHOP\POMS\KSKAGNE\IN\STAKK.TXT

MY_TEST;0;12/12/2014 23:30:14:9000;1;MK69KSS97;TRKCHOP;;4480;EXPORT THE TALISMAN;9;0;0;;Q:\TRKCHOP\POMS\KSKAGNE\IN\STAKK.TXT
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;try this search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | rex field=_raw ".*\\w+\\w+\\w+\\w+(?&amp;lt;your_field_name&amp;gt;\w+\.\w+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope it helps!&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2018 09:17:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Extracting-the-last-words-from-my-Logfile/m-p/318877#M93225</guid>
      <dc:creator>lloydknight</dc:creator>
      <dc:date>2018-03-05T09:17:24Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting the last words from my Logfile</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Extracting-the-last-words-from-my-Logfile/m-p/318878#M93226</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Considering the performance of the regex command I think you should try below run anywhere search as you do not need to go via entire event just to get the last string rather you can directly starts from the last.&lt;/STRONG&gt; &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="MY_TEST;0;12/12/2014 23:30:14:9000;1;MK69KSS97;TRKCHOP;;4480;EXPORT THE TALISMAN;9;0;0;;Q:\TRKCHOP\POMS\KSKAGNE\IN\STAKK.TXT" 
| rex field=_raw "(?&amp;lt;field&amp;gt;[^\\\\]+$)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In your environment, you should write&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your base search&amp;gt; | rex field=_raw "(?&amp;lt;field&amp;gt;[^\\\\]+$)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;let me know if this helps!&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2018 09:33:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Extracting-the-last-words-from-my-Logfile/m-p/318878#M93226</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-03-05T09:33:03Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting the last words from my Logfile</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Extracting-the-last-words-from-my-Logfile/m-p/318879#M93227</link>
      <description>&lt;P&gt;Thanks Harshil&lt;/P&gt;

&lt;P&gt;Its works for the line only, how do i include my full logfile to get the desired results&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Pradipta&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 03:11:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Extracting-the-last-words-from-my-Logfile/m-p/318879#M93227</guid>
      <dc:creator>pradiptam</dc:creator>
      <dc:date>2018-03-06T03:11:40Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting the last words from my Logfile</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Extracting-the-last-words-from-my-Logfile/m-p/318880#M93228</link>
      <description>&lt;P&gt;Thanks Mayur&lt;/P&gt;

&lt;P&gt;Tried this  | rex field=_raw "(?[^\\]+$)"  but its not working&lt;/P&gt;

&lt;P&gt;Any other suggestions.&lt;/P&gt;

&lt;P&gt;Regards,&lt;/P&gt;

&lt;P&gt;Pradipta&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 03:14:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Extracting-the-last-words-from-my-Logfile/m-p/318880#M93228</guid>
      <dc:creator>pradiptam</dc:creator>
      <dc:date>2018-03-06T03:14:31Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting the last words from my Logfile</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Extracting-the-last-words-from-my-Logfile/m-p/318881#M93229</link>
      <description>&lt;P&gt;As from the run anywhere search it is working for the given event. Can you provide some sample events for which it is not working ?&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 03:34:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Extracting-the-last-words-from-my-Logfile/m-p/318881#M93229</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-03-06T03:34:52Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting the last words from my Logfile</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Extracting-the-last-words-from-my-Logfile/m-p/318882#M93230</link>
      <description>&lt;P&gt;Hi Pradipta,&lt;/P&gt;

&lt;P&gt;Can you please provide your full log sample events ?&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 03:38:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Extracting-the-last-words-from-my-Logfile/m-p/318882#M93230</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2018-03-06T03:38:58Z</dc:date>
    </item>
  </channel>
</rss>

