<?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 do I extract last numbers in field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-last-numbers-in-field/m-p/165031#M46877</link>
    <description>&lt;P&gt;The backslash before the "d{5}" didn't get rendered. I have edited my answer to fix that. It should be "\d{5}"&lt;/P&gt;</description>
    <pubDate>Tue, 25 Feb 2014 18:51:02 GMT</pubDate>
    <dc:creator>reed_kelly</dc:creator>
    <dc:date>2014-02-25T18:51:02Z</dc:date>
    <item>
      <title>How do I extract last numbers in field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-last-numbers-in-field/m-p/165028#M46874</link>
      <description>&lt;P&gt;Hello Splunkers, &lt;/P&gt;

&lt;P&gt;I Would like to create a new field with the last numbers in another field  called logid&lt;/P&gt;

&lt;P&gt;For example:&lt;/P&gt;

&lt;P&gt;logid = 0101232010&lt;BR /&gt;&lt;BR /&gt;
logid = 0101242010&lt;BR /&gt;
logid = 0101240210    &lt;/P&gt;

&lt;P&gt;I want create a new field with last 5 numbers,  like as:&lt;/P&gt;

&lt;P&gt;id= 32010&lt;BR /&gt;
id= 42010&lt;BR /&gt;
id= 40210&lt;/P&gt;

&lt;P&gt;Could I create a regex for that? &lt;/P&gt;

&lt;P&gt;Tks.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Feb 2014 17:33:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-last-numbers-in-field/m-p/165028#M46874</guid>
      <dc:creator>dfigurello</dc:creator>
      <dc:date>2014-02-25T17:33:38Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract last numbers in field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-last-numbers-in-field/m-p/165029#M46875</link>
      <description>&lt;P&gt;If I understand correctly, you just want to extract the last 5 characters of a field. Here is an example using the rex command:&lt;/P&gt;

&lt;P&gt;|gentimes start=-1 |eval foo="1232134324" |rex field=foo "(?&amp;lt;id&amp;gt;\d{5})$" |table foo,id&lt;/P&gt;

&lt;P&gt;returns: foo=1232134324  id=34324&lt;/P&gt;</description>
      <pubDate>Tue, 25 Feb 2014 17:46:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-last-numbers-in-field/m-p/165029#M46875</guid>
      <dc:creator>reed_kelly</dc:creator>
      <dc:date>2014-02-25T17:46:02Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract last numbers in field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-last-numbers-in-field/m-p/165030#M46876</link>
      <description>&lt;P&gt;hi reed.kelly, &lt;/P&gt;

&lt;P&gt;I don't get it. I am trying it into my search. Look at my seach:&lt;/P&gt;

&lt;P&gt;sourcetype=fortigate subtype=admin pri=warning | stats count by log_id | rex field=log_id  "(?&lt;LOG_ID&gt;d{5})$" | table log_id&lt;/LOG_ID&gt;&lt;/P&gt;

&lt;P&gt;Any idea ?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:58:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-last-numbers-in-field/m-p/165030#M46876</guid>
      <dc:creator>dfigurello</dc:creator>
      <dc:date>2020-09-28T15:58:24Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract last numbers in field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-last-numbers-in-field/m-p/165031#M46877</link>
      <description>&lt;P&gt;The backslash before the "d{5}" didn't get rendered. I have edited my answer to fix that. It should be "\d{5}"&lt;/P&gt;</description>
      <pubDate>Tue, 25 Feb 2014 18:51:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-last-numbers-in-field/m-p/165031#M46877</guid>
      <dc:creator>reed_kelly</dc:creator>
      <dc:date>2014-02-25T18:51:02Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract last numbers in field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-last-numbers-in-field/m-p/165032#M46878</link>
      <description>&lt;P&gt;For a start keep it simple and just try to get the field=value pair like this:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;sourcetype=fortigate subtype=admin pri=warning | rex  "(?&amp;lt;log_id&amp;gt;\d{5})$" | table log_id&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Feb 2014 19:28:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-last-numbers-in-field/m-p/165032#M46878</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-02-25T19:28:59Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract last numbers in field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-last-numbers-in-field/m-p/165033#M46879</link>
      <description>&lt;P&gt;Another options could be using substring.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=fortigate subtype=admin pri=warning | stats count by log_id | eval newfield=substr(log_id,len(log_id)-4) | table log_id, newfield
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Feb 2014 20:03:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-last-numbers-in-field/m-p/165033#M46879</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-02-25T20:03:27Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract last numbers in field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-last-numbers-in-field/m-p/165034#M46880</link>
      <description>&lt;P&gt;Also, you've kept the name of new field same as old field, use following&lt;BR /&gt;
 ...| rex field=log_id "(?&lt;ID&gt;\d{5})$" | table log_id,id&lt;/ID&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:58:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-last-numbers-in-field/m-p/165034#M46880</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-09-28T15:58:29Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract last numbers in field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-last-numbers-in-field/m-p/165035#M46881</link>
      <description>&lt;P&gt;Thank you Splunkers! &lt;/P&gt;

&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Feb 2014 14:12:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-last-numbers-in-field/m-p/165035#M46881</guid>
      <dc:creator>dfigurello</dc:creator>
      <dc:date>2014-02-26T14:12:10Z</dc:date>
    </item>
  </channel>
</rss>

