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
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

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

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...