<?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 can I search for an exact match in the raw text of an event? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-search-for-an-exact-match-in-the-raw-text-of-an-event/m-p/124267#M33597</link>
    <description>&lt;P&gt;What delimits the strings you're searching for?  If it's a fixed character like comma or space, put it in your like() clause - '&lt;CODE&gt;... | where like(rawtext,"% "+hit+" %") | ...&lt;/CODE&gt;'.  You may need to use multiple like() clauses if the delimiter varies (&lt;CODE&gt;... | where like(rawtext,"% "+hit+" %") OR like(rawtext,"%,"+hit+",%") | ...&lt;/CODE&gt;).&lt;/P&gt;</description>
    <pubDate>Thu, 31 Oct 2013 17:31:48 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2013-10-31T17:31:48Z</dc:date>
    <item>
      <title>How can I search for an exact match in the raw text of an event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-search-for-an-exact-match-in-the-raw-text-of-an-event/m-p/124266#M33596</link>
      <description>&lt;P&gt;I currently have a search that kinda works for what I need but it returns a lot of false positives.&lt;/P&gt;

&lt;P&gt;Example:&lt;/P&gt;

&lt;P&gt;Say I have a lookup table file that contains the string "ed" as an entry.  Currently when I run the query I get hits on every string that contains "ed" like fred, red, bed, education, etc...&lt;/P&gt;

&lt;P&gt;What I would like to do is be able to specify that I only get a hit on an exact match and exclude straings that only contain the string I'm searching for.&lt;/P&gt;

&lt;P&gt;Current search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;*[| inputlookup MY_LOOKUP_FILE.csv | rename COLUMN_HEADER as search | fields search | format] | eval rawText= _raw | eval hit=[| inputlookup MY_LOOKUP_FILE.csv | stats values(COLUMN_HEADER) as query | eval query=mvjoin(query,",") | fields query | eval query = "".query.""] | eval hit=split(hit,",") | mvexpand hit | eval hit=lower(hit) | eval rawText=lower(rawText) | where like(rawText,"%"+hit+"%") | TABLE _time,hit,rawText
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Any ideas?&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2013 16:47:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-search-for-an-exact-match-in-the-raw-text-of-an-event/m-p/124266#M33596</guid>
      <dc:creator>digital_alchemy</dc:creator>
      <dc:date>2013-10-31T16:47:42Z</dc:date>
    </item>
    <item>
      <title>Re: How can I search for an exact match in the raw text of an event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-search-for-an-exact-match-in-the-raw-text-of-an-event/m-p/124267#M33597</link>
      <description>&lt;P&gt;What delimits the strings you're searching for?  If it's a fixed character like comma or space, put it in your like() clause - '&lt;CODE&gt;... | where like(rawtext,"% "+hit+" %") | ...&lt;/CODE&gt;'.  You may need to use multiple like() clauses if the delimiter varies (&lt;CODE&gt;... | where like(rawtext,"% "+hit+" %") OR like(rawtext,"%,"+hit+",%") | ...&lt;/CODE&gt;).&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2013 17:31:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-search-for-an-exact-match-in-the-raw-text-of-an-event/m-p/124267#M33597</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2013-10-31T17:31:48Z</dc:date>
    </item>
    <item>
      <title>Re: How can I search for an exact match in the raw text of an event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-search-for-an-exact-match-in-the-raw-text-of-an-event/m-p/124268#M33598</link>
      <description>&lt;P&gt;I've tried that with no results.  &lt;/P&gt;

&lt;P&gt;I've also tried to use&lt;BR /&gt;
...| where make(rawtext, hit) |... and I get the same results with the false positives.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Nov 2013 18:56:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-search-for-an-exact-match-in-the-raw-text-of-an-event/m-p/124268#M33598</guid>
      <dc:creator>digital_alchemy</dc:creator>
      <dc:date>2013-11-08T18:56:37Z</dc:date>
    </item>
    <item>
      <title>Re: How can I search for an exact match in the raw text of an event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-search-for-an-exact-match-in-the-raw-text-of-an-event/m-p/124269#M33599</link>
      <description>&lt;P&gt;Do you have a named field? You can use that for an exact match quite easily.&lt;BR /&gt;
This example, lets call it approach A does an exact match on path:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=my_host path=/somepath/ | timechart  span=1m count by path
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This while this example, lets call it approach B uses '/somepath/' as a word to do a partial match&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=my_host /somepath/ | timechart  span=1m count by path
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Given logs with the following entries for path:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/somepath/
/somepath/hello
/somepath/world
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Approach A will only match /somepath/ while approach B will match all three&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jul 2014 22:36:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-search-for-an-exact-match-in-the-raw-text-of-an-event/m-p/124269#M33599</guid>
      <dc:creator>airsplunk</dc:creator>
      <dc:date>2014-07-30T22:36:29Z</dc:date>
    </item>
  </channel>
</rss>

