Splunk Search

How to exclude results in search?

alexspunkshell
Contributor

I want to exclude duration results if greater than 7 days. So i used search NOT but it is not working.

Can someone help here?

Query

index=sentinelone | eval duration=tostring(now()-strptime(installedAt,"%Y-%m-%dT%H:%M:%S.%6N"),"duration") | table _time installedAt agentDomain duration |search installedAt!="Null"

 

alexspunkshell_0-1663783620212.png

 

Labels (2)
0 Karma
1 Solution

yuanliu
SplunkTrust
SplunkTrust

Something like 

index=sentinelone installedAt!="Null"
| eval duration=now()-strptime(installedAt,"%Y-%m-%dT%H:%M:%S.%6N")
| eval duration=if(duration < 7 * 86400, tostring(duration, "duration"), null())
| table _time installedAt agentDomain duration

Note your last search is based on a field that already exists in raw data.  Moving it to the base search is more efficient.

View solution in original post

yuanliu
SplunkTrust
SplunkTrust

Something like 

index=sentinelone installedAt!="Null"
| eval duration=now()-strptime(installedAt,"%Y-%m-%dT%H:%M:%S.%6N")
| eval duration=if(duration < 7 * 86400, tostring(duration, "duration"), null())
| table _time installedAt agentDomain duration

Note your last search is based on a field that already exists in raw data.  Moving it to the base search is more efficient.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Dynamic formatting from XML events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  &#x1f680; Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...