<?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 Search for an adjacent IP address in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Search-for-an-adjacent-IP-address/m-p/529532#M149561</link>
    <description>&lt;P&gt;Hi.&lt;BR /&gt;&lt;BR /&gt;I have an alert that'll tell me if a host is down, and it runs for both Active and Standby hosts.&lt;BR /&gt;&lt;BR /&gt;The issue is that when the standby host hasn't received a log,&amp;nbsp; I'd like to run a search to see if the active host has received a log in the last 24 hours, and if so to ignore it.&lt;BR /&gt;&lt;BR /&gt;I can run a search for all IPs, but what I cant seem to do is see if 198.0.0.2 is down, to check for 198.0.0.1 (the Active is always -1 from Standby)&lt;BR /&gt;&lt;BR /&gt;I thought something like this might work, but no.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;index=* host=*&lt;BR /&gt;[search index="*" host=198.0.0.2&lt;/P&gt;&lt;P&gt;|rex field=host "(?&amp;lt;Net&amp;gt;\d+\.\d+\.\d+)\.(?&amp;lt;Host&amp;gt;\d+)"&lt;BR /&gt;|eval Host2 = (Host-1)&lt;BR /&gt;|eval newhost= Net. "." .Host2&lt;BR /&gt;|fields newhost]&lt;BR /&gt;|where host=newhost&lt;BR /&gt;&lt;BR /&gt;any and all help appreciated&lt;/P&gt;</description>
    <pubDate>Mon, 16 Nov 2020 13:12:42 GMT</pubDate>
    <dc:creator>logginz85</dc:creator>
    <dc:date>2020-11-16T13:12:42Z</dc:date>
    <item>
      <title>Search for an adjacent IP address</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-for-an-adjacent-IP-address/m-p/529532#M149561</link>
      <description>&lt;P&gt;Hi.&lt;BR /&gt;&lt;BR /&gt;I have an alert that'll tell me if a host is down, and it runs for both Active and Standby hosts.&lt;BR /&gt;&lt;BR /&gt;The issue is that when the standby host hasn't received a log,&amp;nbsp; I'd like to run a search to see if the active host has received a log in the last 24 hours, and if so to ignore it.&lt;BR /&gt;&lt;BR /&gt;I can run a search for all IPs, but what I cant seem to do is see if 198.0.0.2 is down, to check for 198.0.0.1 (the Active is always -1 from Standby)&lt;BR /&gt;&lt;BR /&gt;I thought something like this might work, but no.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;index=* host=*&lt;BR /&gt;[search index="*" host=198.0.0.2&lt;/P&gt;&lt;P&gt;|rex field=host "(?&amp;lt;Net&amp;gt;\d+\.\d+\.\d+)\.(?&amp;lt;Host&amp;gt;\d+)"&lt;BR /&gt;|eval Host2 = (Host-1)&lt;BR /&gt;|eval newhost= Net. "." .Host2&lt;BR /&gt;|fields newhost]&lt;BR /&gt;|where host=newhost&lt;BR /&gt;&lt;BR /&gt;any and all help appreciated&lt;/P&gt;</description>
      <pubDate>Mon, 16 Nov 2020 13:12:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-for-an-adjacent-IP-address/m-p/529532#M149561</guid>
      <dc:creator>logginz85</dc:creator>
      <dc:date>2020-11-16T13:12:42Z</dc:date>
    </item>
    <item>
      <title>Re: Search for an adjacent IP address</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-for-an-adjacent-IP-address/m-p/529563#M149576</link>
      <description>&lt;P&gt;Splunk has a hard time finding things that aren't there.&amp;nbsp; In this case, if host 198.0.0.2 isn't found then there will be no host field from which to extract sub-fields and, so, no newhost field.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you run the subsearch by itself with "| format" added then you'll see what it returns to the main search.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Nov 2020 15:47:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-for-an-adjacent-IP-address/m-p/529563#M149576</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-11-16T15:47:38Z</dc:date>
    </item>
    <item>
      <title>Re: Search for an adjacent IP address</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-for-an-adjacent-IP-address/m-p/529572#M149579</link>
      <description>&lt;P&gt;Hi, that makes sense, and |format helped me realise it wasn't pulling through right.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;That lead me onto this.&lt;BR /&gt;&lt;BR /&gt;index="*" host = *&lt;BR /&gt;| eval standbyhost = "198.0.0.2"&lt;BR /&gt;| rex field=standbyhost "(?&amp;lt;Net&amp;gt;\d+\.\d+\.\d+)\.(?&amp;lt;Host&amp;gt;\d+)"&lt;BR /&gt;| eval Host2 = (Host-1)&lt;BR /&gt;| eval newhost= Net. "." .Host2&lt;BR /&gt;| where host = newhost&lt;BR /&gt;&lt;BR /&gt;I create a new field "standbyhost" that is the value of the standby host I already know. I apply this to all results.&lt;BR /&gt;Then I do maths to lower this IP by 1, and create the new field newhost.&lt;BR /&gt;&lt;BR /&gt;Now every rsult has their host as their own host IP, but the field newvalue of the target I'm looking for.&lt;BR /&gt;&lt;BR /&gt;Then its just a where host=newhost to find it.&lt;BR /&gt;&lt;BR /&gt;Seeing as this will actually pull the value of standbyhost from a field in an alert, I think this'll work.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Nov 2020 16:34:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-for-an-adjacent-IP-address/m-p/529572#M149579</guid>
      <dc:creator>logginz85</dc:creator>
      <dc:date>2020-11-16T16:34:08Z</dc:date>
    </item>
    <item>
      <title>Re: Search for an adjacent IP address</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-for-an-adjacent-IP-address/m-p/529586#M149584</link>
      <description>&lt;P&gt;If your problem is resolved, then please click the "Accept as Solution" button to help future readers.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Nov 2020 17:56:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-for-an-adjacent-IP-address/m-p/529586#M149584</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-11-16T17:56:48Z</dc:date>
    </item>
  </channel>
</rss>

