<?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: Comparison of a field with a digit with a field where there are alphabetic characters. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-comparison-of-a-field-with-a-digit-with-a-field/m-p/615924#M214140</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/248856"&gt;@metylkinandrey&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;if the structure of the second field is fixed, you can use a regex to extract a part of the second field to compare with the first field, something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;your_search&amp;gt;
| rex field=field2 "^(?&amp;lt;field2_num&amp;gt;\d+)\."
| search field1=field2_num&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
    <pubDate>Wed, 05 Oct 2022 06:51:18 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2022-10-05T06:51:18Z</dc:date>
    <item>
      <title>How to make comparison of a field with a digit with a field where there are alphabetic characters?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-comparison-of-a-field-with-a-digit-with-a-field/m-p/615923#M214139</link>
      <description>&lt;P&gt;Prompt as I can make arithmetic comparison of two fields. Comparison: more, less.&lt;BR /&gt;The first field consists of numbers: field="1", field="2"&lt;BR /&gt;The second of numbers and letters: field="1.route", field="2.route"&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2022 13:23:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-make-comparison-of-a-field-with-a-digit-with-a-field/m-p/615923#M214139</guid>
      <dc:creator>metylkinandrey</dc:creator>
      <dc:date>2022-10-05T13:23:41Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison of a field with a digit with a field where there are alphabetic characters.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-comparison-of-a-field-with-a-digit-with-a-field/m-p/615924#M214140</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/248856"&gt;@metylkinandrey&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;if the structure of the second field is fixed, you can use a regex to extract a part of the second field to compare with the first field, something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;your_search&amp;gt;
| rex field=field2 "^(?&amp;lt;field2_num&amp;gt;\d+)\."
| search field1=field2_num&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2022 06:51:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-make-comparison-of-a-field-with-a-digit-with-a-field/m-p/615924#M214140</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-10-05T06:51:18Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison of a field with a digit with a field where there are alphabetic characters.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-comparison-of-a-field-with-a-digit-with-a-field/m-p/615992#M214141</link>
      <description>&lt;P&gt;Giuseppe, Hello!&lt;BR /&gt;I do not quite understand how it works, it gives an error:&lt;BR /&gt;error in 'rex' command: The regex '(routepointID)=routepointID2' does not extract anything. It should specify at least one named group. Format: (?&amp;lt;name&amp;gt;...).&lt;/P&gt;&lt;P&gt;What am I doing:&lt;BR /&gt;| rex routepointID=routepointID2 "^(?&amp;lt;routepointID2_num&amp;gt;\d+)\."&lt;/P&gt;&lt;P&gt;What I need:&lt;BR /&gt;Where: "routepointID": "1.SAPS-SIS.TO.LSP.SEND" or "routepointID": "2.SAPS-SIS.TO.LSP.RECEIVE"&lt;/P&gt;&lt;P&gt;I want to receive: "routepointID2_num": "1" or "routepointID2_num": "1"&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2022 13:58:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-make-comparison-of-a-field-with-a-digit-with-a-field/m-p/615992#M214141</guid>
      <dc:creator>metylkinandrey</dc:creator>
      <dc:date>2022-10-05T13:58:01Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison of a field with a digit with a field where there are alphabetic characters.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-comparison-of-a-field-with-a-digit-with-a-field/m-p/616016#M214142</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/248856"&gt;@metylkinandrey&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;read again the rex command syntax at &lt;A href="https://docs.splunk.com/Documentation/Splunk/9.0.1/SearchReference/Rex" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/9.0.1/SearchReference/Rex&lt;/A&gt; :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=routepointID "^(?&amp;lt;routepointID_num&amp;gt;\d+)\."&lt;/LI-CODE&gt;&lt;P&gt;Could youshare a sample of your logs?&lt;/P&gt;&lt;P&gt;I have to understand if you have both the values in the same event or in two different events for the comparison.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2022 15:13:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-make-comparison-of-a-field-with-a-digit-with-a-field/m-p/616016#M214142</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-10-05T15:13:56Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison of a field with a digit with a field where there are alphabetic characters.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-comparison-of-a-field-with-a-digit-with-a-field/m-p/616120#M214143</link>
      <description>&lt;P&gt;Giuseppe, within one message, the field can take only one value, either: 1.SAPS-SIS.TO.LSP.SEND, or: "2.SAPS-SIS.TO.LSP.RECEIVE".&lt;BR /&gt;I still don't understand what I need&lt;BR /&gt;AT:&lt;BR /&gt;| rex field=routepointID "^(?&amp;lt;routepointID_num&amp;gt;\d+)\."&lt;BR /&gt;What does refer to: field?&lt;BR /&gt;Am I doing the right thing if I want to get a new field "routepointIDnum": "1" or "routepointIDnum": "2"&lt;BR /&gt;So?&lt;BR /&gt;| rex routepointIDnum=routepointID "^(?&amp;lt;routepointID_num&amp;gt;\d+)\."&lt;/P&gt;&lt;P&gt;&amp;lt;routepointID_num&amp;gt; - what should I substitute instead?&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2022 09:55:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-make-comparison-of-a-field-with-a-digit-with-a-field/m-p/616120#M214143</guid>
      <dc:creator>metylkinandrey</dc:creator>
      <dc:date>2022-10-06T09:55:05Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison of a field with a digit with a field where there are alphabetic characters.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-comparison-of-a-field-with-a-digit-with-a-field/m-p/616136#M214144</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/248856"&gt;@metylkinandrey&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;as you can read in the above link (&lt;A href="https://docs.splunk.com/Documentation/Splunk/9.0.1/SearchReference/Rex" target="_blank" rel="nofollow noopener noreferrer"&gt;https://docs.splunk.com/Documentation/Splunk/9.0.1/SearchReference/Rex&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;)&lt;/SPAN&gt;, in the rex command you can specify a field for regex application,&lt;/P&gt;&lt;P&gt;in other words, if you don't specify any field, the regex is applied to the entire event (_raw),&lt;/P&gt;&lt;P&gt;if instead you specify a field, the regex is appliad, as in your case, only to the specified field.&lt;/P&gt;&lt;P&gt;The meaning of the command I sent you is:&lt;/P&gt;&lt;P&gt;take in the field "&lt;SPAN&gt;routepointID"&amp;nbsp;the number that is at the beginning of the field and put it in a field called "routepointID_num"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In this way, in the&amp;nbsp;routepointID_num field you have the numbers to match.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;For this reason you cannot put the condition in the rex command, but you have to put it in the following command.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The questions now are: &lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;are the two values of routepointID field for field extraction and comparison in the same event or in two different events?&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;and, if they are in two events, how can I correlate them? there's a common value in a field (a correlation key)?&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN&gt;Ciao.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Giuseppe&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2022 10:20:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-make-comparison-of-a-field-with-a-digit-with-a-field/m-p/616136#M214144</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-10-06T10:20:19Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison of a field with a digit with a field where there are alphabetic characters.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-comparison-of-a-field-with-a-digit-with-a-field/m-p/616160#M214145</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Giuseppe,&amp;nbsp;thank you!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Figured it out, it worked:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;index="main" sourcetype="testsystem-script333" &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;| rex field=routepointID "^(?&amp;lt;routepointID_num&amp;gt;\d+)\." &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;| table routepointID_num&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2022 11:08:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-make-comparison-of-a-field-with-a-digit-with-a-field/m-p/616160#M214145</guid>
      <dc:creator>metylkinandrey</dc:creator>
      <dc:date>2022-10-06T11:08:28Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison of a field with a digit with a field where there are alphabetic characters.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-comparison-of-a-field-with-a-digit-with-a-field/m-p/616166#M214146</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/248856"&gt;@metylkinandrey&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;if one answer solves your need, please accept one answer for the other people of Community or tell us how we can help you.&lt;/P&gt;&lt;P&gt;Ciao and happy splunking&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: Karma Points are appreciated &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2022 12:12:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-make-comparison-of-a-field-with-a-digit-with-a-field/m-p/616166#M214146</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-10-06T12:12:21Z</dc:date>
    </item>
  </channel>
</rss>

