<?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: Can I use lookup output inside calculated field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Can-I-use-lookup-output-inside-calculated-field/m-p/552312#M156748</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As per Splunk docs lookups get executed after calculated fields.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;* Splunk software processes calculated fields after field extraction and
  field aliasing but before lookups. This means that:
  * You can use a field alias in the eval statement for a calculated
    field.
  * You cannot use a field added through a lookup in an eval statement for a
    calculated field.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ref. link -&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Admin/Propsconf" target="_blank" rel="noopener"&gt;props.conf - Splunk Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You can use it in search query instead writing props.conf same way as you written second query. unfortunately there seems no way you can invoke lookup first inside eval.&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------&lt;/P&gt;&lt;P&gt;An upvote would be appreciated if it helps!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 20 May 2021 05:17:19 GMT</pubDate>
    <dc:creator>venkatasri</dc:creator>
    <dc:date>2021-05-20T05:17:19Z</dc:date>
    <item>
      <title>Can I use lookup output inside calculated field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-use-lookup-output-inside-calculated-field/m-p/552300#M156742</link>
      <description>&lt;P&gt;I have an attribute that is determined by two inputs, one with many possible values, the other few. &amp;nbsp;I can enlist them in a giant joint table for automatic lookup, but building and maintaining the table would be tedious. &amp;nbsp;I can put all criteria in one giant eval, but maintenance is a worse nightmare. &amp;nbsp;The most maintainable way to do this would be to lookup a map with the numerous input, then calculate with the sparse input. &amp;nbsp;The challenge is to do this automatically for all searches.&lt;/P&gt;&lt;P&gt;Because automatic lookup is performed after calculated field, I cannot access the lookup map as a new field. &amp;nbsp;My question is whether there is a way to explicitly invoke a lookup inside eval, like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;EVAL-new_attrib = if(lookup(map1, value_of_many) == "X", xvaluefunct(value_of_few), elsefunct(value_of_few))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here, new_attrib is the attribute I wanted, value_of_many and value_of_few are the two inputs. &amp;nbsp;I'm hoping that lookup(map1, value_of_many) would give me an output as if I use&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| lookup map_of_many value_of_many OUTPUT map1
| new_attrib = if(map1 == "X", xvaluefunct(value_of_few), elsefunct(value_of_few))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 May 2021 23:54:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-use-lookup-output-inside-calculated-field/m-p/552300#M156742</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2021-05-19T23:54:33Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use lookup output inside calculated field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-use-lookup-output-inside-calculated-field/m-p/552312#M156748</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As per Splunk docs lookups get executed after calculated fields.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;* Splunk software processes calculated fields after field extraction and
  field aliasing but before lookups. This means that:
  * You can use a field alias in the eval statement for a calculated
    field.
  * You cannot use a field added through a lookup in an eval statement for a
    calculated field.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ref. link -&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Admin/Propsconf" target="_blank" rel="noopener"&gt;props.conf - Splunk Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You can use it in search query instead writing props.conf same way as you written second query. unfortunately there seems no way you can invoke lookup first inside eval.&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------&lt;/P&gt;&lt;P&gt;An upvote would be appreciated if it helps!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 May 2021 05:17:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-use-lookup-output-inside-calculated-field/m-p/552312#M156748</guid>
      <dc:creator>venkatasri</dc:creator>
      <dc:date>2021-05-20T05:17:19Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use lookup output inside calculated field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-use-lookup-output-inside-calculated-field/m-p/552320#M156751</link>
      <description>&lt;P&gt;Thank you for the reply. &amp;nbsp;The reason why I wanted &amp;nbsp;to evaluate this automatically is because this new field is to be used in so many searches.&lt;/P&gt;</description>
      <pubDate>Thu, 20 May 2021 06:06:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-use-lookup-output-inside-calculated-field/m-p/552320#M156751</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2021-05-20T06:06:52Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use lookup output inside calculated field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-use-lookup-output-inside-calculated-field/m-p/552322#M156752</link>
      <description>&lt;P&gt;You can probably try macro for reusability.&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.2.0/Knowledge/Definesearchmacros" target="_blank"&gt;Define search macros in Settings - Splunk Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------&lt;/P&gt;&lt;P&gt;An upvote would be appreciated if it helps!&lt;/P&gt;</description>
      <pubDate>Thu, 20 May 2021 06:27:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-use-lookup-output-inside-calculated-field/m-p/552322#M156752</guid>
      <dc:creator>venkatasri</dc:creator>
      <dc:date>2021-05-20T06:27:58Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use lookup output inside calculated field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-use-lookup-output-inside-calculated-field/m-p/552329#M156755</link>
      <description>&lt;P&gt;Yes! &amp;nbsp;How can I forget macros&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 May 2021 06:57:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-use-lookup-output-inside-calculated-field/m-p/552329#M156755</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2021-05-20T06:57:28Z</dc:date>
    </item>
  </channel>
</rss>

