Splunk Enterprise

About the results when multiple search conditions are specified

Msugiyama
Path Finder

Is there an SPL idea that allows you to specify multiple conditions with "OR" and assign a control number to the search results for each condition?

=====SPL=====
index=xxxx sourcetype=yyyy
(ip=10.1.1.10 url=google.com earlest=1642899600 latest=1642900200 )
OR
(ip=10.1.1.20 url=facebook.com earlest=1642849200 latest=1642849800 )
OR
(ip= ・・・・

=====The expected search results=====
NO,ip,url,_time
1,10.1.1.10,google.com/xxx,2022-01-23 10:04:30
2,10.1.1.20,facecook.com/xxxxx,2022-01-22 20:01:00
2,10.1.1.20,facecook.com/xxxxx,2022-01-22 20:01:30
3,・・・・



0 Karma

isoutamo
SplunkTrust
SplunkTrust

Hi

Your example should work after you fix earlest -> earliest.

At least this works for me

 

index=index1 (user=user1 earliest=1637144468 latest=1637154468) OR (user=user2 earliest=1637145675 latest=1647145675) OR (user=user3 earliest=0 latest=now)
| stats count min(_time) as minTime max(_time) as maxTime values(_time) as Times by user
| streamstats count as NO
| convert ctime(Times) as _time
| table NO, user, _time

Even user1 exists outside of it's earliest - latests period and user3 has all time, it did't found user1, but user2 and user3 have found.

You 

r. Ismo

 

0 Karma

Msugiyama
Path Finder

Thank you for your reply, and I'm sorry for the typo

As for the search condition, I want to create a subsearch from the lookup file with the format command and execute it.
The lookup file is expected to be updated at the request of the user.
If the user specification is blank, multiple hits may occur, so numbers cannot be assigned for each user.
I want to assign a control number within the range specified by OR.

The idea was helpful. thank you.

0 Karma
Get Updates on the Splunk Community!

Strengthen Your Future: A Look Back at Splunk 10 Innovations and .conf25 Highlights!

The Big One: Splunk 10 is Here!  The moment many of you have been waiting for has arrived! We are thrilled to ...

Now Offering the AI Assistant Usage Dashboard in Cloud Monitoring Console

Today, we’re excited to announce the release of a brand new AI assistant usage dashboard in Cloud Monitoring ...

Stay Connected: Your Guide to October Tech Talks, Office Hours, and Webinars!

What are Community Office Hours? Community Office Hours is an interactive 60-minute Zoom series where ...