<?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 What is the rex command to extract the last value from a source field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/What-is-the-rex-command-to-extract-the-last-value-from-a-source/m-p/279554#M84461</link>
    <description>&lt;P&gt;Hi .. I need to extract back123 from the source field. pls provide the entire rex command needed to fetch back123 to a new field.&lt;BR /&gt;
eg:&lt;/P&gt;

&lt;P&gt;source = /opensource/final/back123&lt;/P&gt;</description>
    <pubDate>Fri, 16 Sep 2016 12:18:28 GMT</pubDate>
    <dc:creator>simona2121</dc:creator>
    <dc:date>2016-09-16T12:18:28Z</dc:date>
    <item>
      <title>What is the rex command to extract the last value from a source field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-is-the-rex-command-to-extract-the-last-value-from-a-source/m-p/279554#M84461</link>
      <description>&lt;P&gt;Hi .. I need to extract back123 from the source field. pls provide the entire rex command needed to fetch back123 to a new field.&lt;BR /&gt;
eg:&lt;/P&gt;

&lt;P&gt;source = /opensource/final/back123&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2016 12:18:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-is-the-rex-command-to-extract-the-last-value-from-a-source/m-p/279554#M84461</guid>
      <dc:creator>simona2121</dc:creator>
      <dc:date>2016-09-16T12:18:28Z</dc:date>
    </item>
    <item>
      <title>Re: What is the rex command to extract the last value from a source field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-is-the-rex-command-to-extract-the-last-value-from-a-source/m-p/279555#M84462</link>
      <description>&lt;P&gt;if that source is part of your event, then field=_raw is good. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;yoursearch | rex field=_raw "final\/(?&amp;lt;rexField&amp;gt;.*)" | table rexField
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;if that source is splunk extracted source field, then field=source is good. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;yoursearch | rex field=source "final\/(?&amp;lt;rexField&amp;gt;.*)" | table rexField
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Sep 2016 12:25:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-is-the-rex-command-to-extract-the-last-value-from-a-source/m-p/279555#M84462</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2016-09-16T12:25:51Z</dc:date>
    </item>
    <item>
      <title>Re: What is the rex command to extract the last value from a source field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-is-the-rex-command-to-extract-the-last-value-from-a-source/m-p/279556#M84463</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; yoursearch | rex field=source ".*\/(?[^ ]+)" | table myfield
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2016 12:33:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-is-the-rex-command-to-extract-the-last-value-from-a-source/m-p/279556#M84463</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2016-09-16T12:33:02Z</dc:date>
    </item>
    <item>
      <title>Re: What is the rex command to extract the last value from a source field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-is-the-rex-command-to-extract-the-last-value-from-a-source/m-p/279557#M84464</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex field=source ".*?(?&amp;lt;fn&amp;gt;[^\/]*)$"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Sep 2016 14:03:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-is-the-rex-command-to-extract-the-last-value-from-a-source/m-p/279557#M84464</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-09-16T14:03:38Z</dc:date>
    </item>
    <item>
      <title>Re: What is the rex command to extract the last value from a source field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-is-the-rex-command-to-extract-the-last-value-from-a-source/m-p/279558#M84465</link>
      <description>&lt;P&gt;Let's make it an even 4&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex field=source "\/(?&amp;lt;folder&amp;gt;[^\/]*)$"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Sep 2016 14:11:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-is-the-rex-command-to-extract-the-last-value-from-a-source/m-p/279558#M84465</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-09-16T14:11:04Z</dc:date>
    </item>
    <item>
      <title>Re: What is the rex command to extract the last value from a source field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-is-the-rex-command-to-extract-the-last-value-from-a-source/m-p/279559#M84466</link>
      <description>&lt;P&gt;This should do:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex field=source ".*\/(?&amp;lt;new&amp;gt;\S+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;A href="https://regex101.com/r/QEsDmB/1"&gt;https://regex101.com/r/QEsDmB/1&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2016 10:23:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-is-the-rex-command-to-extract-the-last-value-from-a-source/m-p/279559#M84466</guid>
      <dc:creator>lakromani</dc:creator>
      <dc:date>2016-09-29T10:23:17Z</dc:date>
    </item>
    <item>
      <title>Re: What is the rex command to extract the last value from a source field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-is-the-rex-command-to-extract-the-last-value-from-a-source/m-p/279560#M84467</link>
      <description>&lt;P&gt;Joining the answer party...&lt;/P&gt;

&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source = "*opensource*" | dedup source | rex field=source ".*\/(?&amp;lt;new&amp;gt;.*)" | table source, new
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Sep 2016 13:47:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-is-the-rex-command-to-extract-the-last-value-from-a-source/m-p/279560#M84467</guid>
      <dc:creator>lukejadamec</dc:creator>
      <dc:date>2016-09-29T13:47:07Z</dc:date>
    </item>
    <item>
      <title>Re: What is the rex command to extract the last value from a source field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-is-the-rex-command-to-extract-the-last-value-from-a-source/m-p/279561#M84468</link>
      <description>&lt;P&gt;Hi @simona2121 - Looks like you have several answers to try out &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; If one of them has worked, please click "Accept" below the best answer to resolve this post. Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2016 00:49:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-is-the-rex-command-to-extract-the-last-value-from-a-source/m-p/279561#M84468</guid>
      <dc:creator>aaraneta_splunk</dc:creator>
      <dc:date>2016-09-30T00:49:52Z</dc:date>
    </item>
  </channel>
</rss>

