<?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 How can I pull two lists of hosts from a datamodel and from metadata search in one search? in Knowledge Management</title>
    <link>https://community.splunk.com/t5/Knowledge-Management/How-can-I-pull-two-lists-of-hosts-from-a-datamodel-and-from/m-p/315501#M2722</link>
    <description>&lt;P&gt;I am trying to concatinate two searches that I already have working. One pulls host list from an Asset List in the PCI App, another pulls a host list from metadata. I am trying to come up with a diff between what hosts I have in the asset list verses everything that is logging. Here is my attempt so far:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[| metadata type=hosts 
    | eval "Last Logged Date"=strftime(recentTime, "%+") 
    | eval "Days Since Last Logged"=round((now() - lastTime)/86400) 
    | search "Days Since Last Logged"&amp;lt;=30 ] 
    [| `asset_eventcount` 
    | search (`get_category(*)`) () 
    | sort 0 - lastTime 
    | `uitime(firstTime)` 
    | `uitime(lastTime)` 
    | eval last_logged = round((now() - lastTime)/86400) 
    | replace -1 with 0 in last_logged 
    | eval last_logged = if(last_logged&amp;lt;30, "Logging", last_logged) 
    | eval last_logged = if(last_logged&amp;gt;30, "Stopped Logging", last_logged) 
    | eval last_logged = if(isnull(last_logged) OR last_logged="", "Never Logged", last_logged) ] | table host nt_host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 01 Sep 2017 05:39:27 GMT</pubDate>
    <dc:creator>mattbellezza</dc:creator>
    <dc:date>2017-09-01T05:39:27Z</dc:date>
    <item>
      <title>How can I pull two lists of hosts from a datamodel and from metadata search in one search?</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/How-can-I-pull-two-lists-of-hosts-from-a-datamodel-and-from/m-p/315501#M2722</link>
      <description>&lt;P&gt;I am trying to concatinate two searches that I already have working. One pulls host list from an Asset List in the PCI App, another pulls a host list from metadata. I am trying to come up with a diff between what hosts I have in the asset list verses everything that is logging. Here is my attempt so far:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[| metadata type=hosts 
    | eval "Last Logged Date"=strftime(recentTime, "%+") 
    | eval "Days Since Last Logged"=round((now() - lastTime)/86400) 
    | search "Days Since Last Logged"&amp;lt;=30 ] 
    [| `asset_eventcount` 
    | search (`get_category(*)`) () 
    | sort 0 - lastTime 
    | `uitime(firstTime)` 
    | `uitime(lastTime)` 
    | eval last_logged = round((now() - lastTime)/86400) 
    | replace -1 with 0 in last_logged 
    | eval last_logged = if(last_logged&amp;lt;30, "Logging", last_logged) 
    | eval last_logged = if(last_logged&amp;gt;30, "Stopped Logging", last_logged) 
    | eval last_logged = if(isnull(last_logged) OR last_logged="", "Never Logged", last_logged) ] | table host nt_host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 01 Sep 2017 05:39:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/How-can-I-pull-two-lists-of-hosts-from-a-datamodel-and-from/m-p/315501#M2722</guid>
      <dc:creator>mattbellezza</dc:creator>
      <dc:date>2017-09-01T05:39:27Z</dc:date>
    </item>
    <item>
      <title>Re: How can I pull two lists of hosts from a datamodel and from metadata search in one search?</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/How-can-I-pull-two-lists-of-hosts-from-a-datamodel-and-from/m-p/315502#M2723</link>
      <description>&lt;P&gt;I should note: All of the evals are there so that I can do an inline search after that looks for hosts only seen in the last 30 days, anything else I assume has stopped sending me logs. The results of the search should be asset_list_hosts - non_matching_metadata_hosts = total hosts logging that are not part of the asset list&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 15:35:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/How-can-I-pull-two-lists-of-hosts-from-a-datamodel-and-from/m-p/315502#M2723</guid>
      <dc:creator>mattbellezza</dc:creator>
      <dc:date>2020-09-29T15:35:47Z</dc:date>
    </item>
    <item>
      <title>Re: How can I pull two lists of hosts from a datamodel and from metadata search in one search?</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/How-can-I-pull-two-lists-of-hosts-from-a-datamodel-and-from/m-p/315503#M2724</link>
      <description>&lt;P&gt;You need a connection verb between the two, probably &lt;CODE&gt;append&lt;/CODE&gt;.   Assuming that your macro &lt;CODE&gt;asset_evencount&lt;/CODE&gt; resolves to a generating command, then this should work...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | `asset_eventcount` 
 | search (`get_category(*)`) () 
 | sort 0 - lastTime 
 | `uitime(firstTime)` 
 | `uitime(lastTime)` 
 | eval last_logged = round((now() - lastTime)/86400) 
 | replace -1 with 0 in last_logged 
 | eval last_logged = if(last_logged&amp;lt;30, "Logging", last_logged) 
 | eval last_logged = if(last_logged&amp;gt;30, "Stopped Logging", last_logged) 
 | eval last_logged = if(isnull(last_logged) OR last_logged="", "Never Logged", last_logged) 

 | append [| metadata type=hosts 
     | eval "Last Logged Date"=strftime(recentTime, "%+") 
     | eval "Days Since Last Logged"=round((now() - lastTime)/86400) 
     | search "Days Since Last Logged"&amp;lt;=30 
     ]

| table host nt_host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 01 Sep 2017 13:27:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/How-can-I-pull-two-lists-of-hosts-from-a-datamodel-and-from/m-p/315503#M2724</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-09-01T13:27:25Z</dc:date>
    </item>
    <item>
      <title>Re: How can I pull two lists of hosts from a datamodel and from metadata search in one search?</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/How-can-I-pull-two-lists-of-hosts-from-a-datamodel-and-from/m-p/315504#M2725</link>
      <description>&lt;P&gt;That almost worked. The "host" column is empty... I think its an issue with the metadata search. It seems to only want to output results from my Asset_Eventcount macro...&lt;/P&gt;</description>
      <pubDate>Fri, 01 Sep 2017 18:03:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/How-can-I-pull-two-lists-of-hosts-from-a-datamodel-and-from/m-p/315504#M2725</guid>
      <dc:creator>mattbellezza</dc:creator>
      <dc:date>2017-09-01T18:03:42Z</dc:date>
    </item>
    <item>
      <title>Re: How can I pull two lists of hosts from a datamodel and from metadata search in one search?</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/How-can-I-pull-two-lists-of-hosts-from-a-datamodel-and-from/m-p/315505#M2726</link>
      <description>&lt;P&gt;1) There is no field &lt;CODE&gt;nt_host&lt;/CODE&gt; on the &lt;CODE&gt;metadata type=hosts&lt;/CODE&gt;, so that should result in ONLY the &lt;CODE&gt;host&lt;/CODE&gt; field values.  &lt;/P&gt;

&lt;P&gt;2) There is no sense in calculating "Last Logged Date" if you are not going to use it.&lt;/P&gt;

&lt;P&gt;While debugging, change the table command to this...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| table host nt_host last_logged "Last Logged Date" "Days Since Last Logged"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 01 Sep 2017 19:56:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/How-can-I-pull-two-lists-of-hosts-from-a-datamodel-and-from/m-p/315505#M2726</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-09-01T19:56:10Z</dc:date>
    </item>
    <item>
      <title>Re: How can I pull two lists of hosts from a datamodel and from metadata search in one search?</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/How-can-I-pull-two-lists-of-hosts-from-a-datamodel-and-from/m-p/315506#M2727</link>
      <description>&lt;P&gt;After much back and forth I figured it out. My subsearches were not properly ordered...&lt;BR /&gt;
    | metadata type=hosts &lt;BR /&gt;
    | dedup host &lt;BR /&gt;
    | eval "Last Logged Date"=strftime(recentTime, "%+") &lt;BR /&gt;
    | eval "Days Since Last Logged"=round((now() - lastTime)/86400) &lt;BR /&gt;
    | search "Days Since Last Logged"&amp;lt;=30 &lt;BR /&gt;
    | eval host=lower(host)&lt;BR /&gt;
    | search NOT &lt;BR /&gt;
        [| &lt;CODE&gt;asset_eventcount&lt;/CODE&gt; &lt;BR /&gt;
        | search (&lt;CODE&gt;get_category(*)&lt;/CODE&gt;) () &lt;BR /&gt;
        | sort 0 - lastTime &lt;BR /&gt;
        | &lt;CODE&gt;uitime(firstTime)&lt;/CODE&gt; &lt;BR /&gt;
        | &lt;CODE&gt;uitime(lastTime)&lt;/CODE&gt; &lt;BR /&gt;
        | eval last_logged = round((now() - lastTime)/86400) &lt;BR /&gt;
        | replace -1 with 0 in last_logged &lt;BR /&gt;
        | eval last_logged = if(last_logged&amp;lt;30, "Logging", last_logged) &lt;BR /&gt;
        | eval last_logged = if(last_logged&amp;gt;30, "Stopped Logging", last_logged) &lt;BR /&gt;
        | eval last_logged = if(isnull(last_logged) OR last_logged="", "Never Logged", last_logged) &lt;BR /&gt;
        | table ip,mac,nt_host,dns,owner,bunit,category,pci_domain,is_expected,firstTime,lastTime,last_logged &lt;BR /&gt;
        | search last_logged="Logging" &lt;BR /&gt;
        | fields nt_host &lt;BR /&gt;
        | rename nt_host as host] | stats dc(host)&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 15:36:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/How-can-I-pull-two-lists-of-hosts-from-a-datamodel-and-from/m-p/315506#M2727</guid>
      <dc:creator>mattbellezza</dc:creator>
      <dc:date>2020-09-29T15:36:11Z</dc:date>
    </item>
  </channel>
</rss>

