<?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: Basic use of tstats and a lookup in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Basic-use-of-tstats-and-a-lookup/m-p/552022#M156655</link>
    <description>&lt;P&gt;Thank you!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":face_savoring_food:"&gt;😋&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 18 May 2021 11:08:03 GMT</pubDate>
    <dc:creator>dmbr</dc:creator>
    <dc:date>2021-05-18T11:08:03Z</dc:date>
    <item>
      <title>Basic use of tstats and a lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Basic-use-of-tstats-and-a-lookup/m-p/551936#M156625</link>
      <description>&lt;P&gt;Here is a basic tstats search I use to check network traffic.&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;| tstats summariesonly=t fillnull_value="MISSING" count from datamodel=Network_Traffic.All_Traffic where All_Traffic.src IN ("11.2.2.1","11.2.2.2","11.2.2.3") by All_Traffic.src, All_Traffic.dest, All_Traffic.action, All_Traffic.dest_port, All_Traffic.bytes, sourcetype
| sort -count&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a lookup file called "ip_ioc.csv" containing a single column of IPv4 addresses which constitute potential bad actors. &amp;nbsp;&lt;/P&gt;&lt;P&gt;Instead of searching through a list of IP addresses as per above, I want the tstats search to check the lookup file.&lt;/P&gt;&lt;P&gt;How can I modify the above search?&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Here is a terrible and incorrect attempt at what I am trying to perform:&lt;/EM&gt;&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;| tstats count from datamodel=Network_Traffic.All_Traffic by All_Traffic.src, All_Traffic.dest, All_Traffic.action, All_Traffic.dest_port, All_Traffic.bytes, sourcetype
| lookup ip_ioc.csv ip_ioc
| where ip_ioc == All_Traffic.src OR ip_ioc == All_Traffic.dest&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;</description>
      <pubDate>Tue, 18 May 2021 00:56:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Basic-use-of-tstats-and-a-lookup/m-p/551936#M156625</guid>
      <dc:creator>dmbr</dc:creator>
      <dc:date>2021-05-18T00:56:42Z</dc:date>
    </item>
    <item>
      <title>Re: Basic use of tstats and a lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Basic-use-of-tstats-and-a-lookup/m-p/551937#M156626</link>
      <description>&lt;P&gt;Not so terrible, but incorrect &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; One way is to replace the last two lines with&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| lookup ip_ioc.csv ip_ioc as All_Traffic.src OUTPUT ip_ioc as src_found
| lookup ip_ioc.csv ip_ioc as All_Traffic.dest OUTPUT ip_ioc as dest_found
| where !isnull(src_found) OR !isnull(dest_found)&lt;/LI-CODE&gt;&lt;P&gt;looks like you want to check either src or dest, so you could possible use a subsearch in the tstats to pull in your IP addresses to be part of the where IN statement for each of src and dest, but the merits of each would be down to performance - the above is quite simple and easy to read.&lt;/P&gt;</description>
      <pubDate>Tue, 18 May 2021 01:04:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Basic-use-of-tstats-and-a-lookup/m-p/551937#M156626</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2021-05-18T01:04:52Z</dc:date>
    </item>
    <item>
      <title>Re: Basic use of tstats and a lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Basic-use-of-tstats-and-a-lookup/m-p/552022#M156655</link>
      <description>&lt;P&gt;Thank you!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":face_savoring_food:"&gt;😋&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 May 2021 11:08:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Basic-use-of-tstats-and-a-lookup/m-p/552022#M156655</guid>
      <dc:creator>dmbr</dc:creator>
      <dc:date>2021-05-18T11:08:03Z</dc:date>
    </item>
    <item>
      <title>Re: Basic use of tstats and a lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Basic-use-of-tstats-and-a-lookup/m-p/564817#M196755</link>
      <description>&lt;P&gt;Hello guys.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can i hitch on this to further check, how do i include timestamp for each match?&lt;/P&gt;&lt;P&gt;If i add by _time (in red below),&amp;nbsp; the output is automatically bucket.&amp;nbsp; If i specify span=1s, can i still pipe the result timechart span=1d?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;| tstats count from datamodel=Network_Traffic.All_Traffic by &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;_time span=1s&lt;/STRONG&gt;&lt;/FONT&gt;, All_Traffic.src, All_Traffic.dest, All_Traffic.action, All_Traffic.dest_port, All_Traffic.bytes, sourcetype&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;The desired output is for each match to carry _time, src, dst, ports fields, which can be used to generate timechart.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Aug 2021 02:53:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Basic-use-of-tstats-and-a-lookup/m-p/564817#M196755</guid>
      <dc:creator>linwqg</dc:creator>
      <dc:date>2021-08-26T02:53:10Z</dc:date>
    </item>
  </channel>
</rss>

