<?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 In Splunk Enterprise Security, how do you use a regular expression to find destination port numbers? in Splunk Enterprise Security</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/In-Splunk-Enterprise-Security-how-do-you-use-a-regular/m-p/402987#M4617</link>
    <description>&lt;P&gt;I want to make a usecase that will detect the usage of several destination port numbers. For this, I think it's easiest to use a regular expression. But I'm not sure. I'm also having trouble implementing a regular expression into my query. I've never worked with them before. &lt;/P&gt;

&lt;P&gt;Please evaluate the following information and tell me what you think is best to develop the query. &lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;The usecase must be easy to add or remove any port numbers from, in case we want to detect other things.&lt;/LI&gt;
&lt;LI&gt;The usecase must be able to detect ranges of port numbers when indicated.&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Now, for what I've tried is the following: &lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;index=network &lt;BR /&gt;
| regex dest_port&amp;gt;="688[1-9]"&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;But this doesn't work. I will use datamodel later. &lt;BR /&gt;
The range for the ports is: &lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;6881 to 6889&lt;/LI&gt;
&lt;LI&gt;6969&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;In addition to those ports, we also want it to alert when it finds the following strings in the field app_category:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;app_category field contains tracker&lt;/LI&gt;
&lt;LI&gt;app_category field contains torrent&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;Any help would be much appreciated. I think someone with a lot of regular expression experience will be able to make the query easily, I've been stuck on it for hours sadly and I would love some help.&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Fri, 11 Jan 2019 11:44:09 GMT</pubDate>
    <dc:creator>kokanne</dc:creator>
    <dc:date>2019-01-11T11:44:09Z</dc:date>
    <item>
      <title>In Splunk Enterprise Security, how do you use a regular expression to find destination port numbers?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/In-Splunk-Enterprise-Security-how-do-you-use-a-regular/m-p/402987#M4617</link>
      <description>&lt;P&gt;I want to make a usecase that will detect the usage of several destination port numbers. For this, I think it's easiest to use a regular expression. But I'm not sure. I'm also having trouble implementing a regular expression into my query. I've never worked with them before. &lt;/P&gt;

&lt;P&gt;Please evaluate the following information and tell me what you think is best to develop the query. &lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;The usecase must be easy to add or remove any port numbers from, in case we want to detect other things.&lt;/LI&gt;
&lt;LI&gt;The usecase must be able to detect ranges of port numbers when indicated.&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Now, for what I've tried is the following: &lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;index=network &lt;BR /&gt;
| regex dest_port&amp;gt;="688[1-9]"&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;But this doesn't work. I will use datamodel later. &lt;BR /&gt;
The range for the ports is: &lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;6881 to 6889&lt;/LI&gt;
&lt;LI&gt;6969&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;In addition to those ports, we also want it to alert when it finds the following strings in the field app_category:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;app_category field contains tracker&lt;/LI&gt;
&lt;LI&gt;app_category field contains torrent&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;Any help would be much appreciated. I think someone with a lot of regular expression experience will be able to make the query easily, I've been stuck on it for hours sadly and I would love some help.&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jan 2019 11:44:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/In-Splunk-Enterprise-Security-how-do-you-use-a-regular/m-p/402987#M4617</guid>
      <dc:creator>kokanne</dc:creator>
      <dc:date>2019-01-11T11:44:09Z</dc:date>
    </item>
    <item>
      <title>Re: In Splunk Enterprise Security, how do you use a regular expression to find destination port numbers?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/In-Splunk-Enterprise-Security-how-do-you-use-a-regular/m-p/402988#M4618</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/96384"&gt;@kokanne&lt;/a&gt; ,&lt;/P&gt;

&lt;P&gt;For the dest_port, try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=network | regex dest_port="688[1-9]|6969" 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and for the app_category, you could search with &lt;CODE&gt;(app_category="*tracker*" OR app_category="*torrent*")&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Or if both conditions are to be matched , try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=network |where (match(dest_port,"688[1-9]|6969") OR match(app_category,"tracker|torrent"))
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 22:44:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/In-Splunk-Enterprise-Security-how-do-you-use-a-regular/m-p/402988#M4618</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2020-09-29T22:44:59Z</dc:date>
    </item>
    <item>
      <title>Re: In Splunk Enterprise Security, how do you use a regular expression to find destination port numbers?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/In-Splunk-Enterprise-Security-how-do-you-use-a-regular/m-p/402989#M4619</link>
      <description>&lt;P&gt;Like this (breaks down at 1000 values):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=network [ |makeresults | eval port=mvappend(mvrange(6881, 6889, 1), "6969") | format ]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 12 Jan 2019 00:25:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/In-Splunk-Enterprise-Security-how-do-you-use-a-regular/m-p/402989#M4619</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-01-12T00:25:43Z</dc:date>
    </item>
    <item>
      <title>Re: In Splunk Enterprise Security, how do you use a regular expression to find destination port numbers?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/In-Splunk-Enterprise-Security-how-do-you-use-a-regular/m-p/402990#M4620</link>
      <description>&lt;P&gt;Do NOT use &lt;CODE&gt;regex&lt;/CODE&gt; because it does not map-reduce and you will pull all the values out only to throw them away and your search will take 1000x longer than the way that I just showed you.&lt;/P&gt;</description>
      <pubDate>Sat, 12 Jan 2019 00:26:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/In-Splunk-Enterprise-Security-how-do-you-use-a-regular/m-p/402990#M4620</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-01-12T00:26:33Z</dc:date>
    </item>
  </channel>
</rss>

