<?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 inputlookup loops in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/inputlookup-loops/m-p/363528#M160546</link>
    <description>&lt;P&gt;The idea is my hosts will write a status message to a log file that gets picked up by Splunk and put into a shared index with all others servers. I then want to go through a list of servers via an inputlookup to see when the last time they reported their status was. I can get the time diff to work, but I can't find a way to go through all my servers ie like a for loop. Any suggestions?&lt;/P&gt;

&lt;P&gt;input.csv:&lt;BR /&gt;
ServerName,Environment,App&lt;BR /&gt;
serverA,Prod,database&lt;BR /&gt;
serverB,Dev,webserver&lt;/P&gt;

&lt;P&gt;base search:&lt;BR /&gt;
index="server_health" "pulse_detected" |  head 1 | eval tnow = now() | eval timediff = (tnow - _time)| eval timediff = timediff/60/60| convert ctime(tnow) |table _time,tnow,timediff&lt;/P&gt;

&lt;P&gt;I've tried various versions of this below and just can't wrap my head around how it should work &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;|indexlookup server.csv | table Server [ index="server_health" "pulse_detected" |  head 1 | eval tnow = now() | eval timediff = (tnow - _time)| eval timediff = timediff/60/60| convert ctime(tnow) |table _time,tnow,timediff} ]&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 14:35:05 GMT</pubDate>
    <dc:creator>synsoc</dc:creator>
    <dc:date>2020-09-29T14:35:05Z</dc:date>
    <item>
      <title>inputlookup loops</title>
      <link>https://community.splunk.com/t5/Splunk-Search/inputlookup-loops/m-p/363528#M160546</link>
      <description>&lt;P&gt;The idea is my hosts will write a status message to a log file that gets picked up by Splunk and put into a shared index with all others servers. I then want to go through a list of servers via an inputlookup to see when the last time they reported their status was. I can get the time diff to work, but I can't find a way to go through all my servers ie like a for loop. Any suggestions?&lt;/P&gt;

&lt;P&gt;input.csv:&lt;BR /&gt;
ServerName,Environment,App&lt;BR /&gt;
serverA,Prod,database&lt;BR /&gt;
serverB,Dev,webserver&lt;/P&gt;

&lt;P&gt;base search:&lt;BR /&gt;
index="server_health" "pulse_detected" |  head 1 | eval tnow = now() | eval timediff = (tnow - _time)| eval timediff = timediff/60/60| convert ctime(tnow) |table _time,tnow,timediff&lt;/P&gt;

&lt;P&gt;I've tried various versions of this below and just can't wrap my head around how it should work &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;|indexlookup server.csv | table Server [ index="server_health" "pulse_detected" |  head 1 | eval tnow = now() | eval timediff = (tnow - _time)| eval timediff = timediff/60/60| convert ctime(tnow) |table _time,tnow,timediff} ]&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:35:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/inputlookup-loops/m-p/363528#M160546</guid>
      <dc:creator>synsoc</dc:creator>
      <dc:date>2020-09-29T14:35:05Z</dc:date>
    </item>
    <item>
      <title>Re: inputlookup loops</title>
      <link>https://community.splunk.com/t5/Splunk-Search/inputlookup-loops/m-p/363529#M160547</link>
      <description>&lt;P&gt;Try like this (assuming your logs have field called &lt;CODE&gt;Server&lt;/CODE&gt; which matching the lookup's field &lt;CODE&gt;ServerName&lt;/CODE&gt;)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="server_health" "pulse_detected"  [| inputlookup server.csv | table ServerName | rename ServerName as Server ]
| dedup Server |  eval tnow = now() | eval timediff = (tnow - _time)| eval timediff = timediff/60/60| convert ctime(tnow) |table _time,tnow,timediff
| append [| inputlookup server.csv  | rename ServerName as Server ]
| stats values(_time) as _time values(tnow) as tnow values(timediff) as timediff values(Environment) as Environment ,values(App) as App   by Server
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Jun 2017 17:13:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/inputlookup-loops/m-p/363529#M160547</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-06-26T17:13:14Z</dc:date>
    </item>
    <item>
      <title>Re: inputlookup loops</title>
      <link>https://community.splunk.com/t5/Splunk-Search/inputlookup-loops/m-p/363530#M160548</link>
      <description>&lt;P&gt;Just needed to add &lt;STRONG&gt;,server&lt;/STRONG&gt; below and it worked perfectly. Thanks!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|table _time,tnow,timediff,server
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Jun 2017 19:17:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/inputlookup-loops/m-p/363530#M160548</guid>
      <dc:creator>synsoc</dc:creator>
      <dc:date>2017-06-27T19:17:54Z</dc:date>
    </item>
  </channel>
</rss>

