<?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: Questions in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Questions/m-p/541654#M153363</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231978"&gt;@alnamlahk&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;at first you don't need the dedup before stats!&lt;/P&gt;&lt;P&gt;then, if you want only the IPs from the lookup, you have to filter the results of the main search:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=logs [ | inputlookup Asset.csv | rename src AS IP_Address | fields IP_Address ]
| rename IP_Address AS src
| stats count BY src
| append [ | inputlookup Asset.csv | eval count=0 | fields src count ]
| stats sum(count) AS total BY src
| eval status=if(total=0,"0","1")
| table src status&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
    <pubDate>Sun, 28 Feb 2021 11:13:47 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2021-02-28T11:13:47Z</dc:date>
    <item>
      <title>Questions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Questions/m-p/541643#M153355</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a lookup table which have multiple fields, one of the fields is IP Address of an asset. Additionally, I have an index which contain a list of IPs, that I extract with a certain query. I want to compare the two list of IPs, and then create a new column in my lookup table with ( 0 or 1) value, indicating if there is a match between the IPs.&lt;/P&gt;&lt;P&gt;Any idea how to do that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Sun, 28 Feb 2021 08:30:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Questions/m-p/541643#M153355</guid>
      <dc:creator>alnamlahk</dc:creator>
      <dc:date>2021-02-28T08:30:49Z</dc:date>
    </item>
    <item>
      <title>Re: Questions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Questions/m-p/541644#M153356</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231978"&gt;@alnamlahk&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I hint to see the inputlookup command (&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.1.2/SearchReference/Inputlookup" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/8.1.2/SearchReference/Inputlookup&lt;/A&gt;).&lt;/P&gt;&lt;P&gt;Anyway, you can insert the inputlookup command in a subsearch and use the results to filter the main search.&lt;/P&gt;&lt;P&gt;The only rule is that the field name in main and sub search must be the same, otherwise you have to rename the one in subsearch.&lt;/P&gt;&lt;P&gt;So if they has the same field name (e.g. "ip_address"), you could use a search like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=your_index [ | inputlookup your_lookup.csv | fields ip_address ]
| ...&lt;/LI-CODE&gt;&lt;P&gt;if instead they have a different field name (e.g. in lookup the field name is "ip"), you have to rename the second one:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=your_index [ | inputlookup your_lookup.csv | rename ip AS ip_address 
 | fields ip_address ]
| ...&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: see the Splunk Search Tutorial (&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.1.2/SearchTutorial/WelcometotheSearchTutorial" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/8.1.2/SearchTutorial/WelcometotheSearchTutorial&lt;/A&gt;)&lt;/P&gt;</description>
      <pubDate>Sun, 28 Feb 2021 09:19:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Questions/m-p/541644#M153356</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2021-02-28T09:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: Questions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Questions/m-p/541646#M153358</link>
      <description>&lt;P&gt;Thank you for your reply.&lt;/P&gt;&lt;P&gt;I used this query: "index=logs [ | inputlookup Asset.csv | rename src AS IP_Address | fields IP_Address ] | table IP_Address | dedup IP_Address"&lt;/P&gt;&lt;P&gt;This will give me all the matched IPs. Now, I want to insert a new column in my lookup table which have "0 or 1" values.&amp;nbsp;&lt;/P&gt;&lt;P&gt;if the IP address is present in my query it will have "1" value, otherwise it will have 0 value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 28 Feb 2021 10:32:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Questions/m-p/541646#M153358</guid>
      <dc:creator>alnamlahk</dc:creator>
      <dc:date>2021-02-28T10:32:38Z</dc:date>
    </item>
    <item>
      <title>Re: Questions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Questions/m-p/541649#M153359</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231978"&gt;@alnamlahk&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;this is a different thing, try something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=logs 
| stats count BY IP_Address 
| append [ | inputlookup Asset.csv | rename src AS IP_Address | eval count=0 | fields IP_Address count ] 
| stata sum(count) AS total BY IP_Address 
| eval status=if/total=0,"0","1")
| rename IP_Address AS src 
| table src status
| outputlookup Asset.csv&lt;/LI-CODE&gt;&lt;P&gt;but in this way you have in ths lookup the status field only of the last running.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Sun, 28 Feb 2021 10:44:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Questions/m-p/541649#M153359</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2021-02-28T10:44:13Z</dc:date>
    </item>
    <item>
      <title>Re: Questions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Questions/m-p/541651#M153360</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;SPAN&gt;Giuseppe, really appreciate it my friend.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I used the following query (Adding "dedup IP_Address":&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;index=logs | dedup IP_Address | stats count BY IP_Address&lt;BR /&gt;| append [ | inputlookup Asset.csv | rename src AS IP_Address | eval count=0 | fields IP_Address count ]&lt;BR /&gt;| stats sum(count) AS total BY IP_Address&lt;BR /&gt;| eval status=if(total=0,"0","1")&lt;BR /&gt;| rename IP_Address AS src&lt;BR /&gt;| table src status&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;but this way, it's outputting all the IPs from the index, while I want only the IPs from "Asset.csv" (Those are the IPs that I'm interested&amp;nbsp;in)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 28 Feb 2021 11:03:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Questions/m-p/541651#M153360</guid>
      <dc:creator>alnamlahk</dc:creator>
      <dc:date>2021-02-28T11:03:43Z</dc:date>
    </item>
    <item>
      <title>Re: Questions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Questions/m-p/541654#M153363</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231978"&gt;@alnamlahk&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;at first you don't need the dedup before stats!&lt;/P&gt;&lt;P&gt;then, if you want only the IPs from the lookup, you have to filter the results of the main search:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=logs [ | inputlookup Asset.csv | rename src AS IP_Address | fields IP_Address ]
| rename IP_Address AS src
| stats count BY src
| append [ | inputlookup Asset.csv | eval count=0 | fields src count ]
| stats sum(count) AS total BY src
| eval status=if(total=0,"0","1")
| table src status&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Sun, 28 Feb 2021 11:13:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Questions/m-p/541654#M153363</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2021-02-28T11:13:47Z</dc:date>
    </item>
    <item>
      <title>Re: Questions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Questions/m-p/541657#M153366</link>
      <description>&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have minor issue here, some of the IPs in the csv file are not present in my index, so the resulted IPs in the query less than what I have in my CSV. Any idea how to solve this?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 28 Feb 2021 12:16:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Questions/m-p/541657#M153366</guid>
      <dc:creator>alnamlahk</dc:creator>
      <dc:date>2021-02-28T12:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: Questions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Questions/m-p/541708#M153374</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231978"&gt;@alnamlahk&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;let me understand: the problem is that many of the IPs in the lookup to monitor aren't in the index?&lt;/P&gt;&lt;P&gt;If this is your problem I don't know how to help you because the problem in in the sources: the only hint is analyze your sources to understand if you're receiving logs from all the target systems and, if not, why.&lt;/P&gt;&lt;P&gt;A search like the one I hinted is usually used just to understand if there are some machines in the perimeter that don't send logs, usually I do an alert with a similare search to notice to the administrators when a source is stopping.&lt;/P&gt;&lt;P&gt;Tell me if I can give you more help, otherwise, please accept the answer for the other people of community.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: Karma Points are appreciated &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Mar 2021 06:57:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Questions/m-p/541708#M153374</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2021-03-01T06:57:32Z</dc:date>
    </item>
  </channel>
</rss>

