<?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 Regex searching using a csv list vs inline RegEx in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-searching-using-a-csv-list-vs-inline-RegEx/m-p/323979#M96693</link>
    <description>&lt;P&gt;My search results return a list of FQDN domain names. I need to replace that domain name with an app name when a portion of that domain name is located.&lt;/P&gt;

&lt;P&gt;For example this would be the output from my index&lt;BR /&gt;
office365.com&lt;BR /&gt;
outlook.office365.com&lt;BR /&gt;
sharepoint.office365.com&lt;BR /&gt;
office.com&lt;BR /&gt;
fbcdn.net&lt;/P&gt;

&lt;P&gt;This is my current search which works but becomes extremely slow when adding a lot of match lines. This search looks for any domain even if it contains subdomains.&lt;BR /&gt;
For example X10232.fbserver.fbcdn.net. The Facebook line below would match on any *.fbcdn.net domain.&lt;BR /&gt;
I also need to match on exacts like facebook.com&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=weblogs | sort 0 -domain
| eval domain=case(

match(domain,"^(?=.*\bwordpress.com\b).*$"),"WordPress",
match(domain,"^(?=.*\b.sharepoint.com\b).*$"),"Microsoft Office 365 - Sharepoint",
match(domain,"^(?=.*\b.office365.com\b).*$"),"Microsoft Office 365",
match(domain,"^(?=.*\b.fbcdn.net\b).*$"),"Facebook",
match(domain,"^(?=.*\b.facebook.com\b).*$"),"Facebook",
match(domain,"^(?=.*\bfacebook.com\b).*$"),"Facebook",

true(),domain) | table domain
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I would like preform the same matching task but from a CSV lookup list with three fields. This way I can create two new fields for each event containing appname and apptype&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Domain,AppName,AppType
facebook.com,Facebook,Social Media
office.com,Office 365,Productivity
fbcdn.net,Facebook,Social Media
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 31 May 2017 15:47:53 GMT</pubDate>
    <dc:creator>justinbarta</dc:creator>
    <dc:date>2017-05-31T15:47:53Z</dc:date>
    <item>
      <title>Regex searching using a csv list vs inline RegEx</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-searching-using-a-csv-list-vs-inline-RegEx/m-p/323979#M96693</link>
      <description>&lt;P&gt;My search results return a list of FQDN domain names. I need to replace that domain name with an app name when a portion of that domain name is located.&lt;/P&gt;

&lt;P&gt;For example this would be the output from my index&lt;BR /&gt;
office365.com&lt;BR /&gt;
outlook.office365.com&lt;BR /&gt;
sharepoint.office365.com&lt;BR /&gt;
office.com&lt;BR /&gt;
fbcdn.net&lt;/P&gt;

&lt;P&gt;This is my current search which works but becomes extremely slow when adding a lot of match lines. This search looks for any domain even if it contains subdomains.&lt;BR /&gt;
For example X10232.fbserver.fbcdn.net. The Facebook line below would match on any *.fbcdn.net domain.&lt;BR /&gt;
I also need to match on exacts like facebook.com&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=weblogs | sort 0 -domain
| eval domain=case(

match(domain,"^(?=.*\bwordpress.com\b).*$"),"WordPress",
match(domain,"^(?=.*\b.sharepoint.com\b).*$"),"Microsoft Office 365 - Sharepoint",
match(domain,"^(?=.*\b.office365.com\b).*$"),"Microsoft Office 365",
match(domain,"^(?=.*\b.fbcdn.net\b).*$"),"Facebook",
match(domain,"^(?=.*\b.facebook.com\b).*$"),"Facebook",
match(domain,"^(?=.*\bfacebook.com\b).*$"),"Facebook",

true(),domain) | table domain
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I would like preform the same matching task but from a CSV lookup list with three fields. This way I can create two new fields for each event containing appname and apptype&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Domain,AppName,AppType
facebook.com,Facebook,Social Media
office.com,Office 365,Productivity
fbcdn.net,Facebook,Social Media
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 31 May 2017 15:47:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-searching-using-a-csv-list-vs-inline-RegEx/m-p/323979#M96693</guid>
      <dc:creator>justinbarta</dc:creator>
      <dc:date>2017-05-31T15:47:53Z</dc:date>
    </item>
    <item>
      <title>Re: Regex searching using a csv list vs inline RegEx</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-searching-using-a-csv-list-vs-inline-RegEx/m-p/323980#M96694</link>
      <description>&lt;P&gt;You can do this with a lookup, making use of match_type (&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Admin/Transformsconf"&gt;transforms.conf&lt;/A&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;match_type = &amp;lt;string&amp;gt;
* A comma and space-delimited list of &amp;lt;match_type&amp;gt;(&amp;lt;field_name&amp;gt;)
  specification to allow for non-exact matching
* The available match_type values are WILDCARD, CIDR, and EXACT.  EXACT is
  the default and does not need to be specified.  Only fields that should
  use WILDCARD or CIDR matching should be specified in this list
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You probably want your lookup to look like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;     Domain,AppName,AppType
     facebook.com,Facebook,Social Media
     *.facebook.com,Facebook,Social Media
     office.com,Office 365,Productivity
     *.office.com,Office 365,Productivity
     fbcdn.net,Facebook,Social Media
     *.fbcdn.net,Facebook,Social Media
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In order to match facebook.com and &lt;A href="http://www.facebook.com"&gt;www.facebook.com&lt;/A&gt;, but not fakefacebook.com.&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 16:17:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-searching-using-a-csv-list-vs-inline-RegEx/m-p/323980#M96694</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2017-05-31T16:17:06Z</dc:date>
    </item>
    <item>
      <title>Re: Regex searching using a csv list vs inline RegEx</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-searching-using-a-csv-list-vs-inline-RegEx/m-p/323981#M96695</link>
      <description>&lt;P&gt;It is not going to be as simple as you might expect; there are apps for this stuff and I would highly suggest you check out how others have tackled this same kind of thing (the lookup part is easy once you get the domain normalization stuff working):&lt;/P&gt;

&lt;P&gt;URL Tollbox: &lt;A href="https://splunkbase.splunk.com/app/2734/"&gt;https://splunkbase.splunk.com/app/2734/&lt;/A&gt;&lt;BR /&gt;
URL Parser: &lt;A href="https://splunkbase.splunk.com/app/1545/"&gt;https://splunkbase.splunk.com/app/1545/&lt;/A&gt;&lt;BR /&gt;
URL Expander: &lt;A href="https://splunkbase.splunk.com/app/3460/"&gt;https://splunkbase.splunk.com/app/3460/&lt;/A&gt;&lt;BR /&gt;
URL Parser: &lt;A href="https://splunkbase.splunk.com/app/3396/"&gt;https://splunkbase.splunk.com/app/3396/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 17:01:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-searching-using-a-csv-list-vs-inline-RegEx/m-p/323981#M96695</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-05-31T17:01:46Z</dc:date>
    </item>
  </channel>
</rss>

