<?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 Storing top result as variable then displaying systems with that variable in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Storing-top-result-as-variable-then-displaying-systems-with-that/m-p/555343#M157640</link>
    <description>&lt;P&gt;For some reason my search is not acting as expected. I am trying to produce a list of systems with the specific isolatedCVE I get from the TOP command. But instead of getting stats count of systems with the isolatedCVE i get just the TOP output still as seen below. It seems like the TOP command somehow trumps the second set of commands and i dont understand why.&lt;/P&gt;&lt;P&gt;output for this command =&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;VulnerabilityCVEIDs	count	percent	isolatedCVE
CVE-2021-31959	       106      29.12  	 CVE-2021-31959&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Full search =&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| search index=rapid7 sourcetype="vuln_db"
| eval Epoch_Time=strptime(VulnerabilityPublishedDate, "%Y-%m-%d") 
| eval disctime=strftime(_time, "%Y-%m-%d") 
| eval Addtime=strftime(Epoch_Time + (30 * 86400), "%Y-%m-%d") 
| where VulnerabilityTitle LIKE "Microsoft%" AND Addtime &amp;gt; disctime 
| top VulnerabilityCVEIDs limit=1 
| eval isolatedCVE=VulnerabilityCVEIDs 
| appendcols 
    [| search index=rapid7 sourcetype="vuln_db" VulnerabilityCVEIDs=isolatedCVE
    | dedup AssetNames 
    | dedup AssetIPAddress 
    | stats count by AssetIPAddress AssetNames User VulnerabilityCVEIDs
    | fields - count]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 10 Jun 2021 16:36:37 GMT</pubDate>
    <dc:creator>jlovik</dc:creator>
    <dc:date>2021-06-10T16:36:37Z</dc:date>
    <item>
      <title>Storing top result as variable then displaying systems with that variable</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Storing-top-result-as-variable-then-displaying-systems-with-that/m-p/555343#M157640</link>
      <description>&lt;P&gt;For some reason my search is not acting as expected. I am trying to produce a list of systems with the specific isolatedCVE I get from the TOP command. But instead of getting stats count of systems with the isolatedCVE i get just the TOP output still as seen below. It seems like the TOP command somehow trumps the second set of commands and i dont understand why.&lt;/P&gt;&lt;P&gt;output for this command =&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;VulnerabilityCVEIDs	count	percent	isolatedCVE
CVE-2021-31959	       106      29.12  	 CVE-2021-31959&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Full search =&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| search index=rapid7 sourcetype="vuln_db"
| eval Epoch_Time=strptime(VulnerabilityPublishedDate, "%Y-%m-%d") 
| eval disctime=strftime(_time, "%Y-%m-%d") 
| eval Addtime=strftime(Epoch_Time + (30 * 86400), "%Y-%m-%d") 
| where VulnerabilityTitle LIKE "Microsoft%" AND Addtime &amp;gt; disctime 
| top VulnerabilityCVEIDs limit=1 
| eval isolatedCVE=VulnerabilityCVEIDs 
| appendcols 
    [| search index=rapid7 sourcetype="vuln_db" VulnerabilityCVEIDs=isolatedCVE
    | dedup AssetNames 
    | dedup AssetIPAddress 
    | stats count by AssetIPAddress AssetNames User VulnerabilityCVEIDs
    | fields - count]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Jun 2021 16:36:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Storing-top-result-as-variable-then-displaying-systems-with-that/m-p/555343#M157640</guid>
      <dc:creator>jlovik</dc:creator>
      <dc:date>2021-06-10T16:36:37Z</dc:date>
    </item>
    <item>
      <title>Re: Storing top result as variable then displaying systems with that variable</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Storing-top-result-as-variable-then-displaying-systems-with-that/m-p/555369#M157645</link>
      <description>&lt;P&gt;You didn't get&amp;nbsp;&lt;SPAN&gt;stats count of systems with the isolatedCVE because you have that in a subsearch for appendcols. appendcols will just add the output as a columns to existing main results). So if your appendcols worked correctly, it will just add "AssetIPAddress, AssetNames ,User,VulnerabilityCVEIDs" colunms to your search results.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;But that appendcols won't do anything unless you have any events where&amp;nbsp;VulnerabilityCVEIDs has literal value&amp;nbsp; 'isolatedCVE".&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Note1 :&amp;nbsp;isolatedCVE field you created using eval doesn't exist in the subsearch you used for appendcols command.&lt;BR /&gt;Note 2:&amp;nbsp; field1=field2 can be used only with where command&amp;nbsp;&lt;BR /&gt;&lt;A href="https://docs.splunk.com/Documentation/SCS/current/SearchReference/WhereCommandUsage#Comparing_two_fields" target="_blank"&gt;https://docs.splunk.com/Documentation/SCS/current/SearchReference/WhereCommandUsage#Comparing_two_fields&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Jun 2021 19:08:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Storing-top-result-as-variable-then-displaying-systems-with-that/m-p/555369#M157645</guid>
      <dc:creator>rupkumar4sec</dc:creator>
      <dc:date>2021-06-10T19:08:31Z</dc:date>
    </item>
    <item>
      <title>Re: Storing top result as variable then displaying systems with that variable</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Storing-top-result-as-variable-then-displaying-systems-with-that/m-p/555370#M157646</link>
      <description>&lt;P&gt;To get the result you want, you have to use "join" command, where you can use&amp;nbsp;&lt;SPAN&gt;VulnerabilityCVEIDs&amp;nbsp; and common field and get the other fields you need from the main search.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Jun 2021 19:15:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Storing-top-result-as-variable-then-displaying-systems-with-that/m-p/555370#M157646</guid>
      <dc:creator>rupkumar4sec</dc:creator>
      <dc:date>2021-06-10T19:15:22Z</dc:date>
    </item>
  </channel>
</rss>

