<?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 to test if a lookup does exist in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-test-if-a-lookup-does-exist/m-p/621309#M215962</link>
    <description>&lt;P&gt;If this is part of a dashboard then I can see it working.&amp;nbsp; The dashboard runs the &lt;FONT face="courier new,courier"&gt;rest&lt;/FONT&gt; command at launch to see if the lookup file is present and sets a token based on its findings.&amp;nbsp; If the file was found then the token would contain the &lt;FONT face="courier new,courier"&gt;lookup&lt;/FONT&gt; command.&amp;nbsp; if the file was not found then the token would contain an &lt;FONT face="courier new,courier"&gt;eval&lt;/FONT&gt; that sets the field sought by the lookup to something like "No lookup available" or "N/A".&amp;nbsp; The query just needs to replace the existing lookup command with the token.&lt;/P&gt;</description>
    <pubDate>Thu, 17 Nov 2022 21:09:07 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2022-11-17T21:09:07Z</dc:date>
    <item>
      <title>How to test if a lookup does exist?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-test-if-a-lookup-does-exist/m-p/621285#M215957</link>
      <description>&lt;P&gt;Hi Splunkers,&lt;/P&gt;
&lt;P&gt;I want to create a macro that will be looking inside a lookup file, but in a way that will not break the search if the lookup is non-existent after some time.&lt;/P&gt;
&lt;P&gt;Is there any equivalent of for example Linux known "test -f filename" in Splunk?&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 18:56:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-test-if-a-lookup-does-exist/m-p/621285#M215957</guid>
      <dc:creator>vagnet</dc:creator>
      <dc:date>2022-11-17T18:56:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to test if a lookup does exist</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-test-if-a-lookup-does-exist/m-p/621294#M215958</link>
      <description>&lt;P&gt;You can use REST to see if a lookup file exists&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rest splunk_server=local /services/admin/lookup-table-files/logins.csv | stats count&lt;/LI-CODE&gt;&lt;P&gt;but SPL does not have branching commands so I'm not sure how it helps this use case.&amp;nbsp; Can you say more about the macro and what it will do if the lookup file doesn't exist?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 18:22:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-test-if-a-lookup-does-exist/m-p/621294#M215958</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-11-17T18:22:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to test if a lookup does exist</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-test-if-a-lookup-does-exist/m-p/621296#M215959</link>
      <description>&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The macro is responsible to find matching IPs between the lookup and the search. If the lookup does not exist, then the only thing I need is to not break the search, and that runs as normal.&lt;BR /&gt;&lt;BR /&gt;You would wonder, in this case, why I have the lookup inside the search if not existing. The answer is scaling, as that lookup is placed on many searches, and editing them would be time consuming.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 18:59:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-test-if-a-lookup-does-exist/m-p/621296#M215959</guid>
      <dc:creator>vagnet</dc:creator>
      <dc:date>2022-11-17T18:59:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to test if a lookup does exist</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-test-if-a-lookup-does-exist/m-p/621309#M215962</link>
      <description>&lt;P&gt;If this is part of a dashboard then I can see it working.&amp;nbsp; The dashboard runs the &lt;FONT face="courier new,courier"&gt;rest&lt;/FONT&gt; command at launch to see if the lookup file is present and sets a token based on its findings.&amp;nbsp; If the file was found then the token would contain the &lt;FONT face="courier new,courier"&gt;lookup&lt;/FONT&gt; command.&amp;nbsp; if the file was not found then the token would contain an &lt;FONT face="courier new,courier"&gt;eval&lt;/FONT&gt; that sets the field sought by the lookup to something like "No lookup available" or "N/A".&amp;nbsp; The query just needs to replace the existing lookup command with the token.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 21:09:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-test-if-a-lookup-does-exist/m-p/621309#M215962</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-11-17T21:09:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to test if a lookup does exist</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-test-if-a-lookup-does-exist/m-p/621319#M215967</link>
      <description>&lt;P&gt;I see, sorry for not making it that clear!&lt;BR /&gt;&lt;BR /&gt;The search is to be part of many alerts in my case and not dashboard&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 22:33:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-test-if-a-lookup-does-exist/m-p/621319#M215967</guid>
      <dc:creator>vagnet</dc:creator>
      <dc:date>2022-11-17T22:33:16Z</dc:date>
    </item>
  </channel>
</rss>

