<?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 count as output to eval subsearch in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-tstats-count-as-output-to-eval-subsearch/m-p/607243#M211123</link>
    <description>&lt;P&gt;Was able to add the map command output to the main search output by appending a bunch of eval commands to the map search. Thank you &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 27 Jul 2022 19:04:05 GMT</pubDate>
    <dc:creator>bradw2021</dc:creator>
    <dc:date>2022-07-27T19:04:05Z</dc:date>
    <item>
      <title>How to use tstats count as output to eval subsearch?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-tstats-count-as-output-to-eval-subsearch/m-p/606956#M211049</link>
      <description>&lt;P&gt;Have a search that returns emails of interest (possibly malicious). Trying to add a subsearch that will return a count of how many times each sender address has been seen in the last 30 days (regardless of the timeframe used in the main search).&lt;/P&gt;
&lt;P&gt;When using the search below, Splunk returns a "Error in eval command: Fields cannot be assigned a boolean result" error based on the eval command. The tstats command works fine independently.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=proofpoint
| rex field=msg.header.reply-to{} ".*\&amp;lt;(?&amp;lt;Sender_Address&amp;gt;[a-zA-Z0-9\.\-\+]+@[a-zA-Z0-9\.\-]+)\&amp;gt;"
| eval Sender_Count=[ | tstats count where index=proofpoint TERM($Sender_Address$) earliest=-30d@m latest=now]
| table _time msg_header_from msg.header.reply-to{} Sender_Address Sender_Count&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Don't worry about the sub-optimal email matching regex - just POC.&lt;/P&gt;
&lt;P&gt;Tried appendcols, too, with no luck. Is this possible? Thank you&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jul 2022 13:56:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-tstats-count-as-output-to-eval-subsearch/m-p/606956#M211049</guid>
      <dc:creator>bradw2021</dc:creator>
      <dc:date>2022-07-26T13:56:27Z</dc:date>
    </item>
    <item>
      <title>Re: tstats count as output to eval subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-tstats-count-as-output-to-eval-subsearch/m-p/606983#M211060</link>
      <description>&lt;P&gt;You could try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| map search="| tstats count as Sender_Count where index=proofpoint TERM($Sender_Address$) earliest=-30d@m latest=now"&lt;/LI-CODE&gt;&lt;P&gt;Note that by default, map is limited to 10 searches, so you might need to add the maxsearches parameter.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jul 2022 07:58:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-tstats-count-as-output-to-eval-subsearch/m-p/606983#M211060</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-07-26T07:58:09Z</dc:date>
    </item>
    <item>
      <title>Re: tstats count as output to eval subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-tstats-count-as-output-to-eval-subsearch/m-p/607066#M211095</link>
      <description>&lt;P&gt;Thank you &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt; - This could potentially be a part of the solution, but seems to be focused on passing a variable from the main search to a secondary search, whereas I am trying to take secondary search results (Sender_Count below) and add them to the table generated by the main search, e.g.&lt;/P&gt;&lt;P&gt;Before:&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="25%"&gt;_time&lt;/TD&gt;&lt;TD width="25%"&gt;Sender_Address&lt;/TD&gt;&lt;TD width="25%"&gt;Subject&lt;/TD&gt;&lt;TD width="25%"&gt;Recipient&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%"&gt;7/26/2022 12:16:00&lt;/TD&gt;&lt;TD width="25%"&gt;jdoe@acme.tld&lt;/TD&gt;&lt;TD width="25%"&gt;Please sign this document&lt;/TD&gt;&lt;TD width="25%"&gt;user1@mycorp.tld&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%"&gt;7/26/2022 12:16:05&lt;/TD&gt;&lt;TD width="25%"&gt;jane.doe@hacker.tld&lt;/TD&gt;&lt;TD width="25%"&gt;You can trust me&lt;/TD&gt;&lt;TD width="25%"&gt;user2@mycorp.tld&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%"&gt;7/26/2022 12:16:10&lt;/TD&gt;&lt;TD width="25%"&gt;benign@mycorp.tld&lt;/TD&gt;&lt;TD width="25%"&gt;You're fired&lt;/TD&gt;&lt;TD width="25%"&gt;user3@mycorp.tld&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After:&lt;/P&gt;&lt;TABLE border="1" width="120%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="25%"&gt;_time&lt;/TD&gt;&lt;TD width="25%"&gt;Sender_Address&lt;/TD&gt;&lt;TD width="25%"&gt;Subject&lt;/TD&gt;&lt;TD width="25%"&gt;Recipient&lt;/TD&gt;&lt;TD width="20%"&gt;Sender_Count&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%"&gt;7/26/2022 12:16:00&lt;/TD&gt;&lt;TD width="25%"&gt;jdoe@acme.tld&lt;/TD&gt;&lt;TD width="25%"&gt;Please sign this document&lt;/TD&gt;&lt;TD width="25%"&gt;user1@mycorp.tld&lt;/TD&gt;&lt;TD width="20%"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%"&gt;7/26/2022 12:16:05&lt;/TD&gt;&lt;TD width="25%"&gt;jane.doe@hacker.tld&lt;/TD&gt;&lt;TD width="25%"&gt;You can trust me&lt;/TD&gt;&lt;TD width="25%"&gt;user2@mycorp.tld&lt;/TD&gt;&lt;TD width="20%"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%"&gt;7/26/2022 12:16:10&lt;/TD&gt;&lt;TD width="25%"&gt;benign@mycorp.tld&lt;/TD&gt;&lt;TD width="25%"&gt;You're fired&lt;/TD&gt;&lt;TD width="25%"&gt;user3@mycorp.tld&lt;/TD&gt;&lt;TD width="20%"&gt;48&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Tue, 26 Jul 2022 16:20:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-tstats-count-as-output-to-eval-subsearch/m-p/607066#M211095</guid>
      <dc:creator>bradw2021</dc:creator>
      <dc:date>2022-07-26T16:20:51Z</dc:date>
    </item>
    <item>
      <title>Re: tstats count as output to eval subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-tstats-count-as-output-to-eval-subsearch/m-p/607097#M211099</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;doing an eval from a second search is working like this - same like yours but "| return $fieldname" added&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval indexcount=[| tstats count as indexcount where index=_internal earliest=-24h@h | return $indexcount]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but, i guess this would not work in your token you are passing down from main search..&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Andreas&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jul 2022 21:02:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-tstats-count-as-output-to-eval-subsearch/m-p/607097#M211099</guid>
      <dc:creator>schose</dc:creator>
      <dc:date>2022-07-26T21:02:28Z</dc:date>
    </item>
    <item>
      <title>Re: tstats count as output to eval subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-tstats-count-as-output-to-eval-subsearch/m-p/607243#M211123</link>
      <description>&lt;P&gt;Was able to add the map command output to the main search output by appending a bunch of eval commands to the map search. Thank you &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2022 19:04:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-tstats-count-as-output-to-eval-subsearch/m-p/607243#M211123</guid>
      <dc:creator>bradw2021</dc:creator>
      <dc:date>2022-07-27T19:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: tstats count as output to eval subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-tstats-count-as-output-to-eval-subsearch/m-p/607244#M211124</link>
      <description>&lt;P&gt;Thank you &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/194518"&gt;@schose&lt;/a&gt; - Will play some more with the return function, as the map command is slooooooooooow and defeats the benefit of using the tstats/TERM search for a rapid count&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2022 19:06:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-tstats-count-as-output-to-eval-subsearch/m-p/607244#M211124</guid>
      <dc:creator>bradw2021</dc:creator>
      <dc:date>2022-07-27T19:06:35Z</dc:date>
    </item>
  </channel>
</rss>

