<?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: tstats SPL query need help in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-with-tstats-SPL-query/m-p/639300#M221532</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;| tstats latest(_time) as latest where (index=*_nmap OR index=*_net OR index=*_ds OR index=*_other OR index=*_cld) earliest=-1h by host&lt;BR /&gt;| lookup&amp;nbsp;list123.csv trit_host as host output vore_or_yroe&amp;nbsp;vrit_cpco&lt;BR /&gt;| search&amp;nbsp;vore_or_yroe=* vrit_cpco=try&lt;BR /&gt;| table host&amp;nbsp;vore_or_yroe&lt;BR /&gt;| sort host&lt;BR /&gt;| outputlookup rtun1_clone.csv&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 09 Apr 2023 16:13:03 GMT</pubDate>
    <dc:creator>tscroggins</dc:creator>
    <dc:date>2023-04-09T16:13:03Z</dc:date>
    <item>
      <title>Help with tstats SPL query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-tstats-SPL-query/m-p/639299#M221531</link>
      <description>&lt;P&gt;Hi Team,&lt;/P&gt;
&lt;P&gt;In below query I am trying to pull all the host from various index and match those host in a list lookup file(list123) and keep that in a table and retuns values with host fields and their respective field value available in the column "vore_or_yroe" in the&amp;nbsp;list123 file.&lt;/P&gt;
&lt;P&gt;I used below query, I can pull only host values in a table but not&amp;nbsp;vore_or_yroe. (vore_or_yroe) it's not returning exact values from the list123 lookup file&lt;/P&gt;
&lt;P&gt;| tstats latest(_time) as latest where (index=*_nmap OR index=*_net OR index=*_ds OR index=*_other OR index=*_cld) earliest=-1h by host&lt;BR /&gt;| search&lt;BR /&gt;[| inputlookup list123.csv&lt;BR /&gt;| search vore_or_yroe="*"&lt;BR /&gt;| search vrit_cpco="try"&lt;BR /&gt;| rename trit_host AS host&lt;BR /&gt;| table host&amp;nbsp;vore_or_yroe ]&lt;BR /&gt;| lookup list123.csv trit_host AS host OUTPUT crit_opco&lt;BR /&gt;| eval OPCO=upper(vrit_cpco)&lt;BR /&gt;| table host&amp;nbsp;vore_or_yroe&lt;BR /&gt;| sort host&lt;BR /&gt;| outputlookup rtun1_clone.csv&lt;/P&gt;</description>
      <pubDate>Mon, 10 Apr 2023 17:11:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-tstats-SPL-query/m-p/639299#M221531</guid>
      <dc:creator>SabariRajanT</dc:creator>
      <dc:date>2023-04-10T17:11:57Z</dc:date>
    </item>
    <item>
      <title>Re: tstats SPL query need help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-tstats-SPL-query/m-p/639300#M221532</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;| tstats latest(_time) as latest where (index=*_nmap OR index=*_net OR index=*_ds OR index=*_other OR index=*_cld) earliest=-1h by host&lt;BR /&gt;| lookup&amp;nbsp;list123.csv trit_host as host output vore_or_yroe&amp;nbsp;vrit_cpco&lt;BR /&gt;| search&amp;nbsp;vore_or_yroe=* vrit_cpco=try&lt;BR /&gt;| table host&amp;nbsp;vore_or_yroe&lt;BR /&gt;| sort host&lt;BR /&gt;| outputlookup rtun1_clone.csv&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 09 Apr 2023 16:13:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-tstats-SPL-query/m-p/639300#M221532</guid>
      <dc:creator>tscroggins</dc:creator>
      <dc:date>2023-04-09T16:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: tstats SPL query need help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-tstats-SPL-query/m-p/639372#M221533</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/49493"&gt;@tscroggins&lt;/a&gt;&amp;nbsp;:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;we don't see all the data being pulled from list123.csv. There is a disperancy in data match from the search index and match with lookup file.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Please help with other alternative query.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Sabari&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Apr 2023 14:44:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-tstats-SPL-query/m-p/639372#M221533</guid>
      <dc:creator>SabariRajanT</dc:creator>
      <dc:date>2023-04-10T14:44:56Z</dc:date>
    </item>
    <item>
      <title>Re: tstats SPL query need help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-tstats-SPL-query/m-p/639375#M221534</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/224126"&gt;@SabariRajanT&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;If you can provide samples of your events and a sample of list123.csv, I can help with alternatives.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Apr 2023 15:15:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-tstats-SPL-query/m-p/639375#M221534</guid>
      <dc:creator>tscroggins</dc:creator>
      <dc:date>2023-04-10T15:15:36Z</dc:date>
    </item>
    <item>
      <title>Re: tstats SPL query need help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-tstats-SPL-query/m-p/639385#M221535</link>
      <description>&lt;P&gt;Firstly, don't use constructions like:&lt;/P&gt;&lt;PRE&gt;&amp;lt;something&amp;gt; | search &amp;lt;some_condition&amp;gt;&lt;/PRE&gt;&lt;P&gt;If the condition can be a part of the &amp;lt;something&amp;gt;. Yes, Splunk can often optimize the search and append the condition to the preceeding command but I suppose it's not always that it's able to do so and also let's not get into a habit of writing bad searches.&lt;/P&gt;&lt;P&gt;So your subsearch-generated set of conditions should be a part of the initial tstats command.&lt;/P&gt;&lt;PRE&gt;| tstats latest(_time) as latest where (index=*_nmap OR index=*_net OR index=*_ds OR index=*_other OR index=*_cld) earliest=-1h &lt;BR /&gt;[| inputlookup list123.csv&lt;BR /&gt;| search vore_or_yroe="*" vrit_cpco="try"&lt;BR /&gt;| rename trit_host AS host&lt;BR /&gt;| table host vore_or_yroe ]&lt;BR /&gt;by host&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;BTW, latest(_time) is a tricky usage of latest(). In case of the _time field it will be OK, but if you do latest() on other timestamp field, you could get something different than you wished for.&lt;/P&gt;&lt;P&gt;And what do you mean by "it's not returning exact values from the lookup"? You apply the lookup and only want a single field as output so other fields are not getting returned. You asked for it.&lt;/P&gt;&lt;P&gt;From your search I see that your lookup must at least have fields:&lt;/P&gt;&lt;P&gt;- vore_or_yroe&lt;BR /&gt;- vrit_cpco&lt;BR /&gt;- trit_host&lt;BR /&gt;- crit_opco&lt;/P&gt;&lt;P&gt;Your lookup only matches on the host field from the tstats output to the trit_host in the lookup file and outputs just crit_opco field from the lookup.&lt;/P&gt;&lt;P&gt;If you want to return more fields from the lookup either don't specify the OUTPUT clause for the lookup command (but be wary of duplicate-named fields) or OUTPUT a specific list of fields you want to get as a result.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Apr 2023 16:57:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-tstats-SPL-query/m-p/639385#M221535</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-04-10T16:57:31Z</dc:date>
    </item>
  </channel>
</rss>

