<?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 create a condition based on the number of digits  of a value? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-condition-based-on-the-number-of-digits-of-a/m-p/547031#M155077</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/6367"&gt;@bowesmana&lt;/a&gt;&amp;nbsp; hey man! I am not going to waste any time taking your answer as the solution because you nailed it! 10/10&amp;nbsp; I have to praise you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would be so thankful if you could please tell me how this regular expression works as I cant seem to find documentation about it&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;| rex field=ID "[^-]*-(?&amp;lt;ID_ONLY_NUMBERS&amp;gt;\d+)"&lt;/PRE&gt;&lt;P&gt;and this one&lt;/P&gt;&lt;PRE&gt;| multikv forceheader=1&lt;/PRE&gt;&lt;P&gt;thank you so much my friend&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 07 Apr 2021 13:23:04 GMT</pubDate>
    <dc:creator>andres91302</dc:creator>
    <dc:date>2021-04-07T13:23:04Z</dc:date>
    <item>
      <title>How to create a condition based on the number of digits  of a value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-condition-based-on-the-number-of-digits-of-a/m-p/546957#M155056</link>
      <description>&lt;P&gt;Hello Talented People of the wordl!&lt;BR /&gt;&lt;BR /&gt;I hope you are having a great day, I wish to know if there is a way to have a YES or NOT output of the number of digits in each row is greater than a&amp;nbsp; certain limit, for example: I want the column MET equal to true if the number of digits in the raws of the field ID is greater than 9 .. kind of like this:&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;ID&lt;/TD&gt;&lt;TD width="50%" height="25px"&gt;MET&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;123456789&lt;/TD&gt;&lt;TD width="50%" height="25px"&gt;NOT&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;548554569362&lt;/TD&gt;&lt;TD width="50%" height="25px"&gt;YES&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;14521421&lt;/TD&gt;&lt;TD width="50%" height="25px"&gt;NOT&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;1254&lt;/TD&gt;&lt;TD width="50%" height="25px"&gt;NOT&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;4858466358475248&lt;/TD&gt;&lt;TD width="50%" height="25px"&gt;YES&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;lets say that my search begings as follows:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;index="medic_dni" ID=* | field ID&lt;BR /&gt;&lt;BR /&gt;#######################################################################&lt;BR /&gt;STAGE 2=&lt;BR /&gt;I would wonder how would the code would have to look like if the column ID would show some values witha string followed by the (-) sign and then a string of&amp;nbsp; numbers something like this:&amp;nbsp; ID-47855478554 OR IDUSA-47854785545 or something like this: IDSPAIN-7854545454&lt;BR /&gt;&lt;BR /&gt;How can I obtain the following table&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="40px"&gt;&lt;P&gt;ID&lt;/P&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="40px"&gt;ID_ONLY_NUMBERS&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="40px"&gt;NUMBERS_GREATER_THAN_9&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;ID-47855478554841&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;47855478554&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;YES&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;IDUSA-47854785545521972&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;47854785545&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;YES&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;IDSPAIN-785454545474588&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;7854545454&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;YES&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;THANK YOU SO&amp;nbsp; SO MUCH TO ANYONE WHO WOULD LIKE TO HELP I TRULLY FROM THE BOTTOM OF MY HEART THANK YOU&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Apr 2021 02:04:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-condition-based-on-the-number-of-digits-of-a/m-p/546957#M155056</guid>
      <dc:creator>andres91302</dc:creator>
      <dc:date>2021-04-07T02:04:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a condition based on the number of digits  of a value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-condition-based-on-the-number-of-digits-of-a/m-p/546964#M155059</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/232004"&gt;@andres91302&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm assuming the ID_ONLY_NUMBERS column in your example is not what you would expect with the data in your ID column as the numbers are not the same, however, you can paste this example to a search window which simulates your data.&lt;/P&gt;&lt;P&gt;The last two lines of the search will give you what you need.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw="ID
ID-47855478554841
IDUSA-47854785545521972
IDSPAIN-785454545474588
IDUK-123456789"
| multikv forceheader=1
| fields - _time linecount _raw
| rex field=ID "[^-]*-(?&amp;lt;ID_ONLY_NUMBERS&amp;gt;\d+)"
| eval NUMBERS_GREATER_THAN_9=if(len(ID_ONLY_NUMBERS)&amp;gt;9,"YES","NO")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Hope this helps&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Apr 2021 04:56:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-condition-based-on-the-number-of-digits-of-a/m-p/546964#M155059</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2021-04-07T04:56:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a condition based on the number of digits  of a value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-condition-based-on-the-number-of-digits-of-a/m-p/547031#M155077</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/6367"&gt;@bowesmana&lt;/a&gt;&amp;nbsp; hey man! I am not going to waste any time taking your answer as the solution because you nailed it! 10/10&amp;nbsp; I have to praise you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would be so thankful if you could please tell me how this regular expression works as I cant seem to find documentation about it&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;| rex field=ID "[^-]*-(?&amp;lt;ID_ONLY_NUMBERS&amp;gt;\d+)"&lt;/PRE&gt;&lt;P&gt;and this one&lt;/P&gt;&lt;PRE&gt;| multikv forceheader=1&lt;/PRE&gt;&lt;P&gt;thank you so much my friend&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Apr 2021 13:23:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-condition-based-on-the-number-of-digits-of-a/m-p/547031#M155077</guid>
      <dc:creator>andres91302</dc:creator>
      <dc:date>2021-04-07T13:23:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a condition based on the number of digits  of a value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-condition-based-on-the-number-of-digits-of-a/m-p/547113#M155108</link>
      <description>&lt;P&gt;The rex command is documented here&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/SplunkCloud/8.1.2012/SearchReference/Rex" target="_blank"&gt;https://docs.splunk.com/Documentation/SplunkCloud/8.1.2012/SearchReference/Rex&lt;/A&gt;&lt;/P&gt;&lt;P&gt;as for regular expressions, there are many sites that will help you learn about those&lt;/P&gt;&lt;P&gt;This is a good site for testing regular expressions&lt;/P&gt;&lt;P&gt;&lt;A href="https://regex101.com/" target="_blank"&gt;https://regex101.com/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You can see how the regex works from that rex command with that site&lt;/P&gt;&lt;P&gt;As for multikv, that's also documented on the Splunk site above. It's quite commonly used in examples here to set up some data.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Apr 2021 21:44:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-condition-based-on-the-number-of-digits-of-a/m-p/547113#M155108</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2021-04-07T21:44:55Z</dc:date>
    </item>
  </channel>
</rss>

