<?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: Analysis using lookup file in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Analysis-using-lookup-file/m-p/532579#M150450</link>
    <description>&lt;P&gt;Try this run anywhere example and check if it works for your use case&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;|makeresults|eval continent="Asia Asia Africa Europe"|makemv continent|mvexpand continent
|appendcols [|makeresults |eval country="China China Angola Germany"|makemv country|mvexpand country]
|rename COMMENT as "Created dummy events above"
|append [|inputlookup geo_attr_countries.csv  |fields country]
|fillnull continent value="NULL"
|stats count by country,continent
|eval count=if(continent=="NULL",0,count)&lt;/LI-CODE&gt;&lt;P&gt;we have few events with country &amp;amp; continent and we compare it against the lookup which has only a list of countries.&lt;/P&gt;</description>
    <pubDate>Thu, 10 Dec 2020 03:57:31 GMT</pubDate>
    <dc:creator>renjith_nair</dc:creator>
    <dc:date>2020-12-10T03:57:31Z</dc:date>
    <item>
      <title>Analysis using lookup file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Analysis-using-lookup-file/m-p/532418#M150408</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a lookup file with the entire list of service names,now i want to perform a search to have the count of the service and and for the service not present in logs for the selected time range but present in lookup file,the count has to be shown as 0&lt;/P&gt;&lt;P&gt;Please assist &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/201110"&gt;@niketn&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 05:51:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Analysis-using-lookup-file/m-p/532418#M150408</guid>
      <dc:creator>Deepz2612</dc:creator>
      <dc:date>2020-12-09T05:51:25Z</dc:date>
    </item>
    <item>
      <title>Re: Analysis using lookup file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Analysis-using-lookup-file/m-p/532424#M150410</link>
      <description>&lt;P&gt;Try&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;"your base search"
|stats count by service
|inputlookup yourlookup.csv append=true
|fillnull count value=0
|stats sum(count) as count by service&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2020 03:41:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Analysis-using-lookup-file/m-p/532424#M150410</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2020-12-10T03:41:30Z</dc:date>
    </item>
    <item>
      <title>Re: Analysis using lookup file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Analysis-using-lookup-file/m-p/532426#M150411</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/136781"&gt;@renjith_nair&lt;/a&gt;&amp;nbsp;Thanks for the suggestion,this worked,but i have another question,&lt;/P&gt;&lt;P&gt;When the service is present in both logs and lookup file,it should take the function (field that is extracted using regex) from logs..&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 07:22:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Analysis-using-lookup-file/m-p/532426#M150411</guid>
      <dc:creator>Deepz2612</dc:creator>
      <dc:date>2020-12-09T07:22:20Z</dc:date>
    </item>
    <item>
      <title>Re: Analysis using lookup file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Analysis-using-lookup-file/m-p/532435#M150414</link>
      <description>&lt;P&gt;Glad that the solution worked. &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt; would be appreciated &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Would you mind sharing the search and explain what you currently have and what do you expect? Is that function/field is after the stats function?&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 08:48:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Analysis-using-lookup-file/m-p/532435#M150414</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2020-12-09T08:48:08Z</dc:date>
    </item>
    <item>
      <title>Re: Analysis using lookup file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Analysis-using-lookup-file/m-p/532454#M150422</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/136781"&gt;@renjith_nair&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The event in which service name is present in the same event function name corresponding to service name is also present.&lt;/P&gt;&lt;P&gt;Now i have a lookup file with whole list of service names&lt;/P&gt;&lt;P&gt;My search has to look for service name in the log,if present it bring its corresponding function name and also the count by service and function name..&lt;/P&gt;&lt;P&gt;And for services not present in log but present in lookup file,it should bring the count as zero&lt;/P&gt;&lt;P&gt;This is my requirement&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 12:01:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Analysis-using-lookup-file/m-p/532454#M150422</guid>
      <dc:creator>Deepz2612</dc:creator>
      <dc:date>2020-12-09T12:01:30Z</dc:date>
    </item>
    <item>
      <title>Re: Analysis using lookup file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Analysis-using-lookup-file/m-p/532579#M150450</link>
      <description>&lt;P&gt;Try this run anywhere example and check if it works for your use case&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;|makeresults|eval continent="Asia Asia Africa Europe"|makemv continent|mvexpand continent
|appendcols [|makeresults |eval country="China China Angola Germany"|makemv country|mvexpand country]
|rename COMMENT as "Created dummy events above"
|append [|inputlookup geo_attr_countries.csv  |fields country]
|fillnull continent value="NULL"
|stats count by country,continent
|eval count=if(continent=="NULL",0,count)&lt;/LI-CODE&gt;&lt;P&gt;we have few events with country &amp;amp; continent and we compare it against the lookup which has only a list of countries.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2020 03:57:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Analysis-using-lookup-file/m-p/532579#M150450</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2020-12-10T03:57:31Z</dc:date>
    </item>
    <item>
      <title>Re: Analysis using lookup file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Analysis-using-lookup-file/m-p/533804#M150850</link>
      <description>&lt;UL&gt;&lt;LI&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/136781"&gt;@renjith_nair&lt;/a&gt;&amp;nbsp;@I'm sorry,this is not working for me.&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Let me explain it once again as I'm not sure if i had explained it right earlier.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;For say,below are the services,and few of them are in the lookup file.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;Services&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Service0- present in lookup&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;Service45&lt;/LI&gt;&lt;LI&gt;Service05&lt;/LI&gt;&lt;LI&gt;Service078 - present in lookup&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Now,1.I should find the count of all the services whether present in lookup file or not.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;i.e.,a. service is present in log but not in lookup file&lt;/LI&gt;&lt;LI&gt;b.service presnt in both log and lookup file&lt;/LI&gt;&lt;LI&gt;c.service not present in log but in lookup file (in this case the count will be zero).&lt;/LI&gt;&lt;LI&gt;&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;2.And for the service,the corresponding function(present in the same event) has to be fetched (i use regex to extract the function)&lt;/LI&gt;&lt;LI&gt;(this will be applicable for a and b cases&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Tue, 22 Dec 2020 09:44:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Analysis-using-lookup-file/m-p/533804#M150850</guid>
      <dc:creator>Deepz2612</dc:creator>
      <dc:date>2020-12-22T09:44:27Z</dc:date>
    </item>
    <item>
      <title>Re: Analysis using lookup file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Analysis-using-lookup-file/m-p/533924#M150887</link>
      <description>&lt;P&gt;The same logic explained above can be used. Let me try to explain that&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Get events from index&lt;/LI&gt;&lt;LI&gt;Stats count by service&amp;nbsp; and add a field source="events"&lt;/LI&gt;&lt;LI&gt;Append the inputlookup results to the event and add a field source="lookup"&lt;/LI&gt;&lt;LI&gt;Fillnull count with 0 for the lookup&lt;/LI&gt;&lt;LI&gt;Eventstats values(source) as source&lt;/LI&gt;&lt;LI&gt;From the source field, you will be able to identify whether the entry is present / not present / source&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;with a dummy search&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="your index" |stats count by service, "other fields"
|eval source="events"
|append [|inputlookup &amp;lt;your lookup file&amp;gt; |fields service|eval source="lookup" ]
|eventstats values(source) as source by service
|eval status=if(mvcount(source)&amp;gt;1,"Avaialble in Both",if(isnotnull(mvfind(source,"events")),"Available in Events","Available in Lookup"))
|fields - source
|fillnull count value=0
|stats sum(count) as count,values(function) as function,values(status) as status by service&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is again a run anywhere example&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval continent="Asia Asia Africa Europe" 
| makemv continent 
| mvexpand continent 
| appendcols 
    [| makeresults 
    | eval country="China China Angola Germany" 
    | makemv country 
    | mvexpand country] 
| stats count by country,continent 
| eval source="events" 
| append 
    [| inputlookup geo_attr_countries.csv 
    | fields country 
    | eval source="lookup"] 
| eventstats values(source) as source by country 
| eval status=if(mvcount(source)&amp;gt;1,"Avaialble in Both",if(isnotnull(mvfind(source,"events")),"Available in Events","Available in Lookup")) 
| fields - source 
| fillnull count value=0 
| stats sum(count) as count,values(continent) as continent,values(status) as status by country&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know the changes you want from the above search&lt;/P&gt;</description>
      <pubDate>Wed, 23 Dec 2020 08:23:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Analysis-using-lookup-file/m-p/533924#M150887</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2020-12-23T08:23:39Z</dc:date>
    </item>
  </channel>
</rss>

