<?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 Match substring in list to event in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Match-substring-in-list-to-event/m-p/41581#M9627</link>
    <description>&lt;P&gt;I am using lookup to "house" this long list of keywords. Now, I want to run a query against field A (eg. ABC-DEF-ZYL) of my events, to see if there is a substring match against the list of keywords (eg. DEF)
How do I:
1) Run the search through so that an additional column comes up to show what has been positively matched.
2) Sort keywords by highest number of occurrence&lt;/P&gt;</description>
    <pubDate>Wed, 09 Feb 2011 18:11:54 GMT</pubDate>
    <dc:creator>jq06</dc:creator>
    <dc:date>2011-02-09T18:11:54Z</dc:date>
    <item>
      <title>Match substring in list to event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Match-substring-in-list-to-event/m-p/41581#M9627</link>
      <description>&lt;P&gt;I am using lookup to "house" this long list of keywords. Now, I want to run a query against field A (eg. ABC-DEF-ZYL) of my events, to see if there is a substring match against the list of keywords (eg. DEF)
How do I:
1) Run the search through so that an additional column comes up to show what has been positively matched.
2) Sort keywords by highest number of occurrence&lt;/P&gt;</description>
      <pubDate>Wed, 09 Feb 2011 18:11:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Match-substring-in-list-to-event/m-p/41581#M9627</guid>
      <dc:creator>jq06</dc:creator>
      <dc:date>2011-02-09T18:11:54Z</dc:date>
    </item>
    <item>
      <title>Re: Match substring in list to event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Match-substring-in-list-to-event/m-p/41582#M9628</link>
      <description>&lt;P&gt;This may not be the best approach, but I think it should get you there. &lt;/P&gt;

&lt;P&gt;Assuming the keywords (DEF) and field A (ABC-DEF-ZYL) are going to be exactly that format (e.g., Field A will have a series of keywords separated by hyphens), I would probably take the following approach:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;YourSearch | makemv delim="-" FieldA | lookup MyTable FieldA OUTPUT Description | search Description=*
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Where your lookup table is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;FieldA,Description
ABC,ABC
DEF,DEF
ZYL,ZYL
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You could then do stats based off that, such as:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;YourSearch | makemv delim="-" FieldA | Lookup MyTable FieldA OUTPUT Description 
           | search Description=* | stats count by Description
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;A href="http://www.splunk.com/base/Documentation/latest/SearchReference/Makemv" rel="nofollow"&gt;http://www.splunk.com/base/Documentation/latest/SearchReference/Makemv&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="http://www.splunk.com/base/Documentation/latest/SearchReference/Lookup" rel="nofollow"&gt;http://www.splunk.com/base/Documentation/latest/SearchReference/Lookup&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Feb 2011 02:03:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Match-substring-in-list-to-event/m-p/41582#M9628</guid>
      <dc:creator>David</dc:creator>
      <dc:date>2011-02-10T02:03:16Z</dc:date>
    </item>
    <item>
      <title>Re: Match substring in list to event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Match-substring-in-list-to-event/m-p/41583#M9629</link>
      <description>&lt;P&gt;Great stuff! Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Feb 2011 09:07:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Match-substring-in-list-to-event/m-p/41583#M9629</guid>
      <dc:creator>jq06</dc:creator>
      <dc:date>2011-02-10T09:07:29Z</dc:date>
    </item>
    <item>
      <title>Re: Match substring in list to event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Match-substring-in-list-to-event/m-p/41584#M9630</link>
      <description>&lt;P&gt;I'm glad it works. I should improve my point by saying that a "better" approach would probably be to have the Description be something actually useful. For example, in your Lookup table, you could have:&lt;BR /&gt;
ABC,"ABC - Transaction successful"&lt;BR /&gt;
DEF,"DEF - Database Deadlock, Contact Support Immediately!"&lt;BR /&gt;
And then the rest would work just fine. You might change the last query to &lt;BR /&gt;
...| search Description=* | stats count by FieldA&lt;BR /&gt;
to maintain statistics about FieldA, from from a methodology perspective, if we're adding data we should add useful data. Anyway -- Food for Thought.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Feb 2011 02:06:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Match-substring-in-list-to-event/m-p/41584#M9630</guid>
      <dc:creator>David</dc:creator>
      <dc:date>2011-02-11T02:06:30Z</dc:date>
    </item>
  </channel>
</rss>

