<?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: Input Lookup: How can I Edit a Lookup Field with 'eval' command or 'RegEx' to narrow down my search results? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Input-Lookup-How-can-I-Edit-a-Lookup-Field-with-eval-command-or/m-p/497800#M138662</link>
    <description>&lt;P&gt;Hi @driva,&lt;BR /&gt;
edit the transforms.conf where your lookup is defined and add to its stanza &lt;CODE&gt;match_type = WILDCARD&lt;/CODE&gt;, restart splunk and try again.&lt;BR /&gt;
For more infos see at &lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.1/Admin/Transformsconf"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.1/Admin/Transformsconf&lt;/A&gt; .&lt;/P&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
    <pubDate>Wed, 29 Jan 2020 17:11:17 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2020-01-29T17:11:17Z</dc:date>
    <item>
      <title>Input Lookup: How can I Edit a Lookup Field with 'eval' command or 'RegEx' to narrow down my search results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Input-Lookup-How-can-I-Edit-a-Lookup-Field-with-eval-command-or/m-p/497794#M138656</link>
      <description>&lt;P&gt;Apologies if the title of the question is a bit vague!&lt;/P&gt;

&lt;P&gt;I have search that is creating a table based on events that contain a word in a lookup CSV file. This works well, however I'm trying to prevent 'words within words' appearing in the output. For example, if my lookup file contains the word 'kill', I do no want to see the word 'skills' in my results. The field name in the CSV is 'HighRiskWords'.&lt;/P&gt;

&lt;P&gt;Here's what Im working with so far:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=web_filter  

    [| inputlookup highriskwords.csv  

    | eval HighRiskWords="*"+HighRiskWords+"*"  

    | rename HighRiskWords as web_HighRisk]  
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If I use: &lt;STRONG&gt;&lt;EM&gt;eval HighRiskWords=HighRiskWords&lt;/EM&gt;&lt;/STRONG&gt; I get results that offer an exact match. If I use &lt;STRONG&gt;&lt;EM&gt;eval HighRiskWords="&lt;/EM&gt;"+HighRiskWords+"*"&lt;/STRONG&gt;* I get all matches plus any other text string surrounding the matching word, e.g: skills.&lt;/P&gt;

&lt;P&gt;It would be wonderful to put a space in at the end of the eval command like: eval &lt;STRONG&gt;&lt;EM&gt;HighRiskWords=HighRiskWords+" "&lt;/EM&gt;&lt;/STRONG&gt; however this does not work. &lt;/P&gt;

&lt;P&gt;Would anyone be able to show me how to add a space to the end of the lookup field so that I do not get 'word within words'. I want to see results like: 'biggest kill' or 'kill time', not 'top 10 skills'.&lt;/P&gt;

&lt;P&gt;Hopefully that makes sense! Thanks for your help! &lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2020 16:17:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Input-Lookup-How-can-I-Edit-a-Lookup-Field-with-eval-command-or/m-p/497794#M138656</guid>
      <dc:creator>driva</dc:creator>
      <dc:date>2020-01-29T16:17:24Z</dc:date>
    </item>
    <item>
      <title>Re: Input Lookup: How can I Edit a Lookup Field with 'eval' command or 'RegEx' to narrow down my search results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Input-Lookup-How-can-I-Edit-a-Lookup-Field-with-eval-command-or/m-p/497795#M138657</link>
      <description>&lt;P&gt;Hi @driva,&lt;BR /&gt;
I'm not sure to have understood your need: you want to search in a log using the values in a field of a lookup as full text search, is it correct?&lt;/P&gt;

&lt;P&gt;If this is your need, you could try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=web_filter  [ | inputlookup highriskwords.csv  | rename HighRiskWords AS query | fields query ]  
| ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2020 16:22:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Input-Lookup-How-can-I-Edit-a-Lookup-Field-with-eval-command-or/m-p/497795#M138657</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-01-29T16:22:38Z</dc:date>
    </item>
    <item>
      <title>Re: Input Lookup: How can I Edit a Lookup Field with 'eval' command or 'RegEx' to narrow down my search results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Input-Lookup-How-can-I-Edit-a-Lookup-Field-with-eval-command-or/m-p/497796#M138658</link>
      <description>&lt;P&gt;Hi Giuseppe, sorry no, I haven't made myself clear... I believe the focus here is on the eval command. Is it possible to change the field so that it includes a literal space at the end of it? For example: eval HighRiskWords=HighRiskWords+" " &amp;lt;-- Space?&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2020 16:26:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Input-Lookup-How-can-I-Edit-a-Lookup-Field-with-eval-command-or/m-p/497796#M138658</guid>
      <dc:creator>driva</dc:creator>
      <dc:date>2020-01-29T16:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: Input Lookup: How can I Edit a Lookup Field with 'eval' command or 'RegEx' to narrow down my search results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Input-Lookup-How-can-I-Edit-a-Lookup-Field-with-eval-command-or/m-p/497797#M138659</link>
      <description>&lt;P&gt;Hi @driva,&lt;BR /&gt;
ok, sorry for the misunderstand.&lt;BR /&gt;
yes you can, you have to use dot instead +:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=web_filter  
      [| inputlookup highriskwords.csv  
       | eval HighRiskWords="*".HighRiskWords."*"  
       | rename HighRiskWords AS web_HighRisk
      ]
| ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or adding a space &lt;CODE&gt;| eval HighRiskWords=HighRiskWords." "&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2020 16:39:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Input-Lookup-How-can-I-Edit-a-Lookup-Field-with-eval-command-or/m-p/497797#M138659</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-01-29T16:39:23Z</dc:date>
    </item>
    <item>
      <title>Re: Input Lookup: How can I Edit a Lookup Field with 'eval' command or 'RegEx' to narrow down my search results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Input-Lookup-How-can-I-Edit-a-Lookup-Field-with-eval-command-or/m-p/497798#M138660</link>
      <description>&lt;P&gt;Hi Giuseppe,&lt;/P&gt;

&lt;P&gt;Thanks for your reply, unfortunately &lt;STRONG&gt;.&lt;/STRONG&gt; and &lt;STRONG&gt;+&lt;/STRONG&gt; behave the same way? I'm still seeing words like 'skills' appear when using the &lt;STRONG&gt;.&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Kind regards,&lt;BR /&gt;
D&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2020 17:00:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Input-Lookup-How-can-I-Edit-a-Lookup-Field-with-eval-command-or/m-p/497798#M138660</guid>
      <dc:creator>driva</dc:creator>
      <dc:date>2020-01-29T17:00:58Z</dc:date>
    </item>
    <item>
      <title>Re: Input Lookup: How can I Edit a Lookup Field with 'eval' command or 'RegEx' to narrow down my search results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Input-Lookup-How-can-I-Edit-a-Lookup-Field-with-eval-command-or/m-p/497799#M138661</link>
      <description>&lt;P&gt;@gcusello  Here's the full search: &lt;BR /&gt;
     index=web_filter &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;        [| inputlookup highriskwords.csv  

        | eval HighRiskWords="*".HighRiskWords."*"  

        | rename HighRiskWords as web_HighRisk]  

    | stats count by web_HighRisk, web_User, _time  

    | rex field=web_HighRisk max_match=10  

        [| inputlookup highriskwords.csv  

        | table HighRiskWords  

        | stats values(HighRiskWords) AS HighRiskWords  

        | eval search="\"(?&amp;lt;Matched_Word&amp;gt;(".mvjoin(HighRiskWords,"|")."))\""  

        | fields search]  

    | table Matched_Word, web_HighRisk, web_User, _time  

    | sort Matched_Word  
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Jan 2020 17:03:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Input-Lookup-How-can-I-Edit-a-Lookup-Field-with-eval-command-or/m-p/497799#M138661</guid>
      <dc:creator>driva</dc:creator>
      <dc:date>2020-01-29T17:03:41Z</dc:date>
    </item>
    <item>
      <title>Re: Input Lookup: How can I Edit a Lookup Field with 'eval' command or 'RegEx' to narrow down my search results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Input-Lookup-How-can-I-Edit-a-Lookup-Field-with-eval-command-or/m-p/497800#M138662</link>
      <description>&lt;P&gt;Hi @driva,&lt;BR /&gt;
edit the transforms.conf where your lookup is defined and add to its stanza &lt;CODE&gt;match_type = WILDCARD&lt;/CODE&gt;, restart splunk and try again.&lt;BR /&gt;
For more infos see at &lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.1/Admin/Transformsconf"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.1/Admin/Transformsconf&lt;/A&gt; .&lt;/P&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2020 17:11:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Input-Lookup-How-can-I-Edit-a-Lookup-Field-with-eval-command-or/m-p/497800#M138662</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-01-29T17:11:17Z</dc:date>
    </item>
  </channel>
</rss>

