Splunk Enterprise Security

How to use tstats command with datamodel and like function

N92
Path Finder

How to use tstats command with like function.
Ex:

| tstats count(eval(Authentication.action, "failure%")) as failure,  count(eval(Authentication.action, "success%"))  as success by src

Why does it give an error?

0 Karma
1 Solution

harsmarvania57
Ultra Champion

Hi,

tstats does not support complex aggregation function. ref. doc https://docs.splunk.com/Documentation/Splunk/7.2.6/SearchReference/Tstats#Complex_aggregate_function...

So you can use below query

| tstats count from datamodel=Authentication by Authentication.src,Authentication.action
| stats sum(eval(if(like('Authentication.action', "failure%"),count,0))) as failure sum(eval(if(like('Authentication.action', "success%"),count,0))) as success by Authentication.src

View solution in original post

harsmarvania57
Ultra Champion

Hi,

tstats does not support complex aggregation function. ref. doc https://docs.splunk.com/Documentation/Splunk/7.2.6/SearchReference/Tstats#Complex_aggregate_function...

So you can use below query

| tstats count from datamodel=Authentication by Authentication.src,Authentication.action
| stats sum(eval(if(like('Authentication.action', "failure%"),count,0))) as failure sum(eval(if(like('Authentication.action', "success%"),count,0))) as success by Authentication.src
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

December 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...