<?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: using eval with automatic lookups in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/using-eval-with-automatic-lookups/m-p/35728#M7847</link>
    <description>&lt;P&gt;I went with this as it was a very quick fix and meant I could start showing Splunk off to the web analytic guys who paid for it ASAP. Thanks for your help&lt;/P&gt;</description>
    <pubDate>Mon, 19 Dec 2011 10:05:38 GMT</pubDate>
    <dc:creator>Bulluk</dc:creator>
    <dc:date>2011-12-19T10:05:38Z</dc:date>
    <item>
      <title>using eval with automatic lookups</title>
      <link>https://community.splunk.com/t5/Splunk-Search/using-eval-with-automatic-lookups/m-p/35723#M7842</link>
      <description>&lt;P&gt;Is there a way to perform an eval when using an automatic lookup? I'm using user IDs in IIS logs to find a user's real name (and lots more stuff but for simplicity let's just say name.) My problem is that the user names can randomly be mixed case so I need to perform an &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eval lower(cs_username) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;prior to performing the lookup. This works fine on the search bar&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="iis" | eval lowuser=lower(cs_username) | lookup ad_lookup lanID AS lowuser OUTPUTNEW  DisplayName AS Name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Unfortunately I can't get this to work with automatic lookups without manually include the eval statement in all my searches. so....:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Is there a way to auto-append a search term to a source type, ie for sourcetype="iis" append eval lowuser=lower(cs_username)&lt;/LI&gt;
&lt;LI&gt;is there a way to add the eval to the auto-lookup stanza in props.conf?&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2011 12:20:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/using-eval-with-automatic-lookups/m-p/35723#M7842</guid>
      <dc:creator>Bulluk</dc:creator>
      <dc:date>2011-12-15T12:20:55Z</dc:date>
    </item>
    <item>
      <title>Re: using eval with automatic lookups</title>
      <link>https://community.splunk.com/t5/Splunk-Search/using-eval-with-automatic-lookups/m-p/35724#M7843</link>
      <description>&lt;P&gt;You could do a scripted lookup instead of a file-based lookup.  Then you could change the case of the input field(s) as part of your script.  &lt;/P&gt;

&lt;P&gt;Another choice, though not as nice, is to build a macro that contains&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eval lowuser=lower(cs_username) | lookup ad_lookup lanID AS lowuser OUTPUTNEW  DisplayName AS Name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But you would have to invoke the macro whenever you wanted the lookup...&lt;/P&gt;</description>
      <pubDate>Sun, 18 Dec 2011 02:01:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/using-eval-with-automatic-lookups/m-p/35724#M7843</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2011-12-18T02:01:15Z</dc:date>
    </item>
    <item>
      <title>Re: using eval with automatic lookups</title>
      <link>https://community.splunk.com/t5/Splunk-Search/using-eval-with-automatic-lookups/m-p/35725#M7844</link>
      <description>&lt;P&gt;In the general sense, I think the answer to your question is "no" -- you cannot have a generalized eval expression applied to an input to a lookup.  &lt;/P&gt;

&lt;P&gt;But, for your specific issue here, you can configure the lookup table such that the search is done in a case-insensitive manner.&lt;/P&gt;

&lt;P&gt;See &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Admin/Transformsconf"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Admin/Transformsconf&lt;/A&gt; for more detail, but it should be as simple as:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[ad_lookup]
case_sensitive_match = false
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 18 Dec 2011 03:59:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/using-eval-with-automatic-lookups/m-p/35725#M7844</guid>
      <dc:creator>dwaddle</dc:creator>
      <dc:date>2011-12-18T03:59:54Z</dc:date>
    </item>
    <item>
      <title>Re: using eval with automatic lookups</title>
      <link>https://community.splunk.com/t5/Splunk-Search/using-eval-with-automatic-lookups/m-p/35726#M7845</link>
      <description>&lt;P&gt;It feels like a scripted input would probably be the best long term solution so I've marked this answer up but have set dwaddle's response as the accepted answer as it's the one I've used for now. Thanks for your help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2011 10:04:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/using-eval-with-automatic-lookups/m-p/35726#M7845</guid>
      <dc:creator>Bulluk</dc:creator>
      <dc:date>2011-12-19T10:04:26Z</dc:date>
    </item>
    <item>
      <title>Re: using eval with automatic lookups</title>
      <link>https://community.splunk.com/t5/Splunk-Search/using-eval-with-automatic-lookups/m-p/35727#M7846</link>
      <description>&lt;P&gt;oh.... I would have if I had enough reputation lol&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2011 10:04:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/using-eval-with-automatic-lookups/m-p/35727#M7846</guid>
      <dc:creator>Bulluk</dc:creator>
      <dc:date>2011-12-19T10:04:50Z</dc:date>
    </item>
    <item>
      <title>Re: using eval with automatic lookups</title>
      <link>https://community.splunk.com/t5/Splunk-Search/using-eval-with-automatic-lookups/m-p/35728#M7847</link>
      <description>&lt;P&gt;I went with this as it was a very quick fix and meant I could start showing Splunk off to the web analytic guys who paid for it ASAP. Thanks for your help&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2011 10:05:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/using-eval-with-automatic-lookups/m-p/35728#M7847</guid>
      <dc:creator>Bulluk</dc:creator>
      <dc:date>2011-12-19T10:05:38Z</dc:date>
    </item>
    <item>
      <title>Re: using eval with automatic lookups</title>
      <link>https://community.splunk.com/t5/Splunk-Search/using-eval-with-automatic-lookups/m-p/35729#M7848</link>
      <description>&lt;P&gt;Np - thanks! -- Actually, I like dwaddle's answer better for most cases.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2011 22:00:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/using-eval-with-automatic-lookups/m-p/35729#M7848</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2011-12-21T22:00:55Z</dc:date>
    </item>
  </channel>
</rss>

